diff options
author | rathnor <rathnor> | 2003-10-05 09:03:43 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-10-05 09:03:43 (GMT) |
commit | 9a155ea7b5cf1b76aa7b9864aa3c1a7342f1f67c (patch) | |
tree | 4656a6fe71b5e18bf4b5044df9e1980162823c58 /src/FbWinFrame.cc | |
parent | 6984eb8970b61c0a6bcacba301707807d47d9b42 (diff) | |
download | fluxbox-9a155ea7b5cf1b76aa7b9864aa3c1a7342f1f67c.zip fluxbox-9a155ea7b5cf1b76aa7b9864aa3c1a7342f1f67c.tar.bz2 |
fix window size when changing titlebar height
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r-- | src/FbWinFrame.cc | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index ce92813..5cfd751 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.56 2003/10/02 14:14:45 rathnor Exp $ | 22 | // $Id: FbWinFrame.cc,v 1.57 2003/10/05 09:03:43 rathnor Exp $ |
23 | 23 | ||
24 | #include "FbWinFrame.hh" | 24 | #include "FbWinFrame.hh" |
25 | 25 | ||
@@ -391,9 +391,9 @@ void FbWinFrame::setClientWindow(Window win) { | |||
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
394 | void FbWinFrame::hideTitlebar() { | 394 | bool FbWinFrame::hideTitlebar() { |
395 | if (!m_use_titlebar) | 395 | if (!m_use_titlebar) |
396 | return; | 396 | return false; |
397 | 397 | ||
398 | m_titlebar.hide(); | 398 | m_titlebar.hide(); |
399 | m_use_titlebar = false; | 399 | m_use_titlebar = false; |
@@ -402,11 +402,12 @@ void FbWinFrame::hideTitlebar() { | |||
402 | // only take away one borderwidth (as the other border is still the "top" border) | 402 | // only take away one borderwidth (as the other border is still the "top" border) |
403 | m_window.resize(m_window.width(), m_window.height() - m_titlebar.height() - | 403 | m_window.resize(m_window.width(), m_window.height() - m_titlebar.height() - |
404 | m_titlebar.borderWidth()); | 404 | m_titlebar.borderWidth()); |
405 | return true; | ||
405 | } | 406 | } |
406 | 407 | ||
407 | void FbWinFrame::showTitlebar() { | 408 | bool FbWinFrame::showTitlebar() { |
408 | if (m_use_titlebar) | 409 | if (m_use_titlebar) |
409 | return; | 410 | return false; |
410 | 411 | ||
411 | m_titlebar.show(); | 412 | m_titlebar.show(); |
412 | m_use_titlebar = true; | 413 | m_use_titlebar = true; |
@@ -414,24 +415,26 @@ void FbWinFrame::showTitlebar() { | |||
414 | // only add one borderwidth (as the other border is still the "top" border) | 415 | // only add one borderwidth (as the other border is still the "top" border) |
415 | m_window.resize(m_window.width(), m_window.height() + m_titlebar.height() + | 416 | m_window.resize(m_window.width(), m_window.height() + m_titlebar.height() + |
416 | m_titlebar.borderWidth()); | 417 | m_titlebar.borderWidth()); |
418 | return true; | ||
417 | 419 | ||
418 | } | 420 | } |
419 | 421 | ||
420 | void FbWinFrame::hideHandle() { | 422 | bool FbWinFrame::hideHandle() { |
421 | if (!m_use_handle) | 423 | if (!m_use_handle) |
422 | return; | 424 | return false; |
423 | m_handle.hide(); | 425 | m_handle.hide(); |
424 | m_grip_left.hide(); | 426 | m_grip_left.hide(); |
425 | m_grip_right.hide(); | 427 | m_grip_right.hide(); |
426 | m_use_handle = false; | 428 | m_use_handle = false; |
427 | m_window.resize(m_window.width(), m_window.height() - m_handle.height() - | 429 | m_window.resize(m_window.width(), m_window.height() - m_handle.height() - |
428 | m_handle.borderWidth()); | 430 | m_handle.borderWidth()); |
431 | return true; | ||
429 | 432 | ||
430 | } | 433 | } |
431 | 434 | ||
432 | void FbWinFrame::showHandle() { | 435 | bool FbWinFrame::showHandle() { |
433 | if (m_use_handle) | 436 | if (m_use_handle) |
434 | return; | 437 | return false; |
435 | 438 | ||
436 | m_handle.show(); | 439 | m_handle.show(); |
437 | m_handle.showSubwindows(); // shows grips | 440 | m_handle.showSubwindows(); // shows grips |
@@ -439,22 +442,29 @@ void FbWinFrame::showHandle() { | |||
439 | m_use_handle = true; | 442 | m_use_handle = true; |
440 | m_window.resize(m_window.width(), m_window.height() + m_handle.height() + | 443 | m_window.resize(m_window.width(), m_window.height() + m_handle.height() + |
441 | m_handle.borderWidth()); | 444 | m_handle.borderWidth()); |
445 | return true; | ||
442 | } | 446 | } |
443 | 447 | ||
444 | void FbWinFrame::hideAllDecorations() { | 448 | bool FbWinFrame::hideAllDecorations() { |
445 | hideHandle(); | 449 | bool changed = false; |
446 | hideTitlebar(); | 450 | changed |= hideHandle(); |
451 | changed |= hideTitlebar(); | ||
447 | // resize done by hide* | 452 | // resize done by hide* |
448 | reconfigure(); | 453 | reconfigure(); |
454 | |||
455 | return changed; | ||
449 | } | 456 | } |
450 | 457 | ||
451 | void FbWinFrame::showAllDecorations() { | 458 | bool FbWinFrame::showAllDecorations() { |
459 | bool changed = false; | ||
452 | if (!m_use_handle) | 460 | if (!m_use_handle) |
453 | showHandle(); | 461 | changed |= showHandle(); |
454 | if (!m_use_titlebar) | 462 | if (!m_use_titlebar) |
455 | showTitlebar(); | 463 | changed |= showTitlebar(); |
456 | // resize shouldn't be necessary | 464 | // resize shouldn't be necessary |
457 | reconfigure(); | 465 | reconfigure(); |
466 | |||
467 | return changed; | ||
458 | } | 468 | } |
459 | 469 | ||
460 | /** | 470 | /** |
@@ -740,12 +750,16 @@ void FbWinFrame::reconfigureTitlebar() { | |||
740 | if (!m_use_titlebar) | 750 | if (!m_use_titlebar) |
741 | return; | 751 | return; |
742 | 752 | ||
753 | int orig_height = m_titlebar.height(); | ||
743 | // resize titlebar to window size with font height | 754 | // resize titlebar to window size with font height |
744 | int title_height = m_theme.font().height() == 0 ? 16 : | 755 | int title_height = m_theme.font().height() == 0 ? 16 : |
745 | m_theme.font().height() + m_bevel*2 + 2; | 756 | m_theme.font().height() + m_bevel*2 + 2; |
746 | if (m_theme.titleHeight() != 0) | 757 | if (m_theme.titleHeight() != 0) |
747 | title_height = m_theme.titleHeight(); | 758 | title_height = m_theme.titleHeight(); |
748 | 759 | ||
760 | // if the titlebar grows in size, make sure the whole window does too | ||
761 | if (orig_height != title_height) | ||
762 | m_window.resize(m_window.width(), m_window.height()-orig_height+title_height); | ||
749 | m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(), | 763 | m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(), |
750 | m_window.width(), title_height); | 764 | m_window.width(), title_height); |
751 | 765 | ||