aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-02-23 13:40:22 (GMT)
committerrathnor <rathnor>2003-02-23 13:40:22 (GMT)
commitb3ba75792908cbc14555001d7495828206a23fdc (patch)
treec7394cff7c2d97286570f0b52c85a990423d04c3 /src/FbWinFrame.cc
parent0470d0087cd7d95f906e901414de80da318a1bfa (diff)
downloadfluxbox-b3ba75792908cbc14555001d7495828206a23fdc.zip
fluxbox-b3ba75792908cbc14555001d7495828206a23fdc.tar.bz2
various frame size, and window resize/moving/outline bugs
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc88
1 files changed, 53 insertions, 35 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 05c6f00..1444438 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbWinFrame.cc,v 1.12 2003/02/23 00:57:55 fluxgen Exp $ 22// $Id: FbWinFrame.cc,v 1.13 2003/02/23 13:40:22 rathnor Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25#include "ImageControl.hh" 25#include "ImageControl.hh"
@@ -170,16 +170,16 @@ void FbWinFrame::resize(unsigned int width, unsigned int height) {
170} 170}
171 171
172void FbWinFrame::resizeForClient(unsigned int width, unsigned int height) { 172void FbWinFrame::resizeForClient(unsigned int width, unsigned int height) {
173 // total height for frame without client 173 // total height for frame
174 int handle_height = m_handle.height() + m_handle.borderWidth(); 174 unsigned int total_height = height;
175 int titlebar_height = m_titlebar.height() + m_titlebar.borderWidth(); 175
176 unsigned int total_height = handle_height + titlebar_height; 176 // having a titlebar = 1 extra border + titlebar height
177 // resize frame height with total height + specified height 177 if (m_use_titlebar)
178 if (!m_use_titlebar) 178 total_height += m_titlebar.height() + m_titlebar.borderWidth();
179 total_height -= titlebar_height; 179 // having a handle = 1 extra border + handle height
180 if (!m_use_handle) 180 if (m_use_handle)
181 total_height -= handle_height; 181 total_height += m_handle.height() + m_handle.borderWidth();
182 resize(width, total_height + height); 182 resize(width, total_height);
183} 183}
184 184
185void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height) { 185void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height) {
@@ -280,8 +280,10 @@ void FbWinFrame::hideTitlebar() {
280 m_titlebar.hide(); 280 m_titlebar.hide();
281 m_use_titlebar = false; 281 m_use_titlebar = false;
282 m_clientarea.raise(); 282 m_clientarea.raise();
283
284 // only take away one borderwidth (as the other border is still the "top" border)
283 m_window.resize(m_window.width(), m_window.height() - m_titlebar.height() - 285 m_window.resize(m_window.width(), m_window.height() - m_titlebar.height() -
284 m_titlebar.borderWidth()*2); 286 m_titlebar.borderWidth());
285#ifdef DEBUG 287#ifdef DEBUG
286 cerr<<__FILE__<<": Hide Titlebar"<<endl; 288 cerr<<__FILE__<<": Hide Titlebar"<<endl;
287#endif // DEBUG 289#endif // DEBUG
@@ -293,30 +295,43 @@ void FbWinFrame::showTitlebar() {
293 295
294 m_titlebar.show(); 296 m_titlebar.show();
295 m_use_titlebar = true; 297 m_use_titlebar = true;
298
299 // only add one borderwidth (as the other border is still the "top" border)
300 m_window.resize(m_window.width(), m_window.height() + m_titlebar.height() +
301 m_titlebar.borderWidth());
302
296#ifdef DEBUG 303#ifdef DEBUG
297 cerr<<__FILE__<<": Show Titlebar"<<endl; 304 cerr<<__FILE__<<": Show Titlebar"<<endl;
298#endif // DEBUG 305#endif // DEBUG
299} 306}
300 307
301void FbWinFrame::hideHandle() { 308void FbWinFrame::hideHandle() {
309 if (!m_use_handle)
310 return;
302 m_handle.hide(); 311 m_handle.hide();
303 m_grip_left.hide(); 312 m_grip_left.hide();
304 m_grip_right.hide(); 313 m_grip_right.hide();
305 m_use_handle = false; 314 m_use_handle = false;
315 m_window.resize(m_window.width(), m_window.height() - m_handle.height() -
316 m_handle.borderWidth());
317
306} 318}
307 319
308void FbWinFrame::showHandle() { 320void FbWinFrame::showHandle() {
321 if (m_use_handle)
322 return;
309 m_handle.show(); 323 m_handle.show();
310 m_grip_left.show(); 324 m_grip_left.show();
311 m_grip_right.show(); 325 m_grip_right.show();
312 m_use_handle = true; 326 m_use_handle = true;
327 m_window.resize(m_window.width(), m_window.height() + m_handle.height() +
328 m_handle.borderWidth());
313} 329}
314 330
315void FbWinFrame::hideAllDecorations() { 331void FbWinFrame::hideAllDecorations() {
316 hideHandle(); 332 hideHandle();
317 hideTitlebar(); 333 hideTitlebar();
318 m_window.setBorderWidth(0); 334 // resize done by hide*
319 m_window.resize(m_clientarea.width(), m_clientarea.height());
320 reconfigure(); 335 reconfigure();
321} 336}
322 337
@@ -325,7 +340,7 @@ void FbWinFrame::showAllDecorations() {
325 showHandle(); 340 showHandle();
326 if (!m_use_titlebar) 341 if (!m_use_titlebar)
327 showTitlebar(); 342 showTitlebar();
328 resizeForClient(m_clientarea.width(), m_clientarea.height()); 343 // resize shouldn't be necessary
329 reconfigure(); 344 reconfigure();
330} 345}
331 346
@@ -395,6 +410,10 @@ void FbWinFrame::exposeEvent(XExposeEvent &event) {
395 redrawTitlebar(); 410 redrawTitlebar();
396 else if (m_label == event.window) 411 else if (m_label == event.window)
397 redrawTitle(); 412 redrawTitle();
413 else if (m_handle == event.window ||
414 m_grip_left == event.window ||
415 m_grip_right == event.window)
416 renderHandles();
398} 417}
399 418
400void FbWinFrame::handleEvent(XEvent &event) { 419void FbWinFrame::handleEvent(XEvent &event) {
@@ -415,28 +434,28 @@ void FbWinFrame::reconfigure() {
415 if (m_use_titlebar) 434 if (m_use_titlebar)
416 reconfigureTitlebar(); 435 reconfigureTitlebar();
417 436
418 // setup client area size/pos 437 int client_top = 0;
419 int next_y = m_titlebar.height() + m_titlebar.borderWidth(); 438 int client_height = m_window.height();
420 unsigned int client_height = 439 if (m_use_titlebar) {
421 m_window.height() - next_y; 440 // only one borderwidth as titlebar is really at -borderwidth
422 /*- m_titlebar.height() - m_titlebar.y() - m_handle.height();*/ 441 int titlebar_height = m_titlebar.height() + m_titlebar.borderWidth();
442 client_top += titlebar_height;
443 client_height -= titlebar_height;
444 }
423 445
424 if (!m_use_titlebar) { 446 if (m_use_handle) {
425 next_y = -m_titlebar.y(); 447 client_height -= m_handle.height() + m_handle.borderWidth();
426 if (!m_use_handle)
427 client_height = m_window.height();
428 else
429 client_height = m_window.height() - m_handle.height();
430 } 448 }
431 449
432 m_clientarea.moveResize(0, m_titlebar.y() + next_y, 450 m_clientarea.moveResize(0, client_top,
433 m_window.width(), client_height); 451 m_window.width(), client_height);
434 452
435 if (m_clientwin != 0) { 453 if (m_clientwin != 0) {
436 XMoveResizeWindow(FbTk::App::instance()->display(), m_clientwin, 454 XMoveResizeWindow(FbTk::App::instance()->display(), m_clientwin,
437 0, 0, 455 0, 0,
438 m_clientarea.width(), m_clientarea.height()); 456 m_clientarea.width(), m_clientarea.height());
439 } 457 }
458
440 459
441 if (!m_use_handle) // no need to do anything more 460 if (!m_use_handle) // no need to do anything more
442 return; 461 return;
@@ -444,19 +463,18 @@ void FbWinFrame::reconfigure() {
444 // align handle and grips 463 // align handle and grips
445 const int grip_height = m_handle.height(); 464 const int grip_height = m_handle.height();
446 const int grip_width = 20; //TODO 465 const int grip_width = 20; //TODO
447
448 const int ypos = m_window.height() - grip_height;
449 466
450 m_grip_left.moveResize(0, ypos, 467 const int ypos = m_window.height() - grip_height - m_handle.borderWidth();
468
469 m_grip_left.moveResize(-m_handle.borderWidth(), ypos,
451 grip_width, grip_height); 470 grip_width, grip_height);
452 471
453 m_handle.moveResize(grip_width, ypos, 472 m_handle.moveResize(grip_width, ypos,
454 m_window.width() - grip_width*2, grip_height); 473 m_window.width() - grip_width*2 - m_handle.borderWidth()*2, grip_height);
455 474
456 m_grip_right.moveResize(m_window.width() - grip_width, ypos, 475 m_grip_right.moveResize(m_window.width() - grip_width - m_handle.borderWidth(), ypos,
457 grip_width, grip_height); 476 grip_width, grip_height);
458 477
459
460 // render the theme 478 // render the theme
461 renderButtons(); 479 renderButtons();
462 renderHandles(); 480 renderHandles();