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 | |
parent | 6984eb8970b61c0a6bcacba301707807d47d9b42 (diff) | |
download | fluxbox_paul-9a155ea7b5cf1b76aa7b9864aa3c1a7342f1f67c.zip fluxbox_paul-9a155ea7b5cf1b76aa7b9864aa3c1a7342f1f67c.tar.bz2 |
fix window size when changing titlebar height
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/FbWinFrame.cc | 44 | ||||
-rw-r--r-- | src/FbWinFrame.hh | 15 | ||||
-rw-r--r-- | src/Window.cc | 24 |
4 files changed, 54 insertions, 32 deletions
@@ -1,6 +1,9 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 0.9.6: | 2 | Changes for 0.9.6: |
3 | *03/10/05: | 3 | *03/10/05: |
4 | * Fix frame size when changing titlebar size (Simon) | ||
5 | - also send configure notify when toggling decorations | ||
6 | FbWinFrame.hh/cc Window.cc | ||
4 | * Move a bunch of functionality from Keys into FbTk::KeyUtil (Simon) | 7 | * Move a bunch of functionality from Keys into FbTk::KeyUtil (Simon) |
5 | - also fix issue where Capslock mod was taken to be whatever caps | 8 | - also fix issue where Capslock mod was taken to be whatever caps |
6 | key was mapped to (why??). Now uses LockMask (ditto num,scroll). | 9 | key was mapped to (why??). Now uses LockMask (ditto num,scroll). |
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 | ||
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index 6d218d4..f1ca769 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh | |||
@@ -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.hh,v 1.22 2003/10/02 14:14:46 rathnor Exp $ | 22 | // $Id: FbWinFrame.hh,v 1.23 2003/10/05 09:03:43 rathnor Exp $ |
23 | 23 | ||
24 | #ifndef FBWINFRAME_HH | 24 | #ifndef FBWINFRAME_HH |
25 | #define FBWINFRAME_HH | 25 | #define FBWINFRAME_HH |
@@ -118,12 +118,13 @@ public: | |||
118 | /// remove any handler for the windows | 118 | /// remove any handler for the windows |
119 | void removeEventHandler(); | 119 | void removeEventHandler(); |
120 | 120 | ||
121 | void hideTitlebar(); | 121 | // these return true/false for if something changed |
122 | void showTitlebar(); | 122 | bool hideTitlebar(); |
123 | void hideHandle(); | 123 | bool showTitlebar(); |
124 | void showHandle(); | 124 | bool hideHandle(); |
125 | void hideAllDecorations(); | 125 | bool showHandle(); |
126 | void showAllDecorations(); | 126 | bool hideAllDecorations(); |
127 | bool showAllDecorations(); | ||
127 | 128 | ||
128 | // this function translates its arguments according to win_gravity | 129 | // this function translates its arguments according to win_gravity |
129 | // if win_gravity is negative, it does an inverse translation | 130 | // if win_gravity is negative, it does an inverse translation |
diff --git a/src/Window.cc b/src/Window.cc index e104ae6..ccf52a2 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.239 2003/10/05 02:31:22 rathnor Exp $ | 25 | // $Id: Window.cc,v 1.240 2003/10/05 09:03:43 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -512,7 +512,6 @@ void FluxboxWindow::init() { | |||
512 | if (!place_window) | 512 | if (!place_window) |
513 | moveResize(frame().x(), frame().y(), frame().width(), frame().height()); | 513 | moveResize(frame().x(), frame().y(), frame().width(), frame().height()); |
514 | 514 | ||
515 | |||
516 | screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); | 515 | screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); |
517 | 516 | ||
518 | if (shaded) { // start shaded | 517 | if (shaded) { // start shaded |
@@ -2627,6 +2626,7 @@ void FluxboxWindow::setDecoration(Decoration decoration) { | |||
2627 | // commit current decoration values to actual displayed things | 2626 | // commit current decoration values to actual displayed things |
2628 | void FluxboxWindow::applyDecorations(bool initial) { | 2627 | void FluxboxWindow::applyDecorations(bool initial) { |
2629 | frame().clientArea().setBorderWidth(0); // client area bordered by other things | 2628 | frame().clientArea().setBorderWidth(0); // client area bordered by other things |
2629 | bool client_move = false; | ||
2630 | 2630 | ||
2631 | int grav_x=0, grav_y=0; | 2631 | int grav_x=0, grav_y=0; |
2632 | // negate gravity | 2632 | // negate gravity |
@@ -2636,28 +2636,34 @@ void FluxboxWindow::applyDecorations(bool initial) { | |||
2636 | if (decorations.border) | 2636 | if (decorations.border) |
2637 | border_width = frame().theme().border().width(); | 2637 | border_width = frame().theme().border().width(); |
2638 | 2638 | ||
2639 | if (initial || frame().window().borderWidth() != border_width) | 2639 | if (initial || frame().window().borderWidth() != border_width) { |
2640 | client_move = true; | ||
2640 | frame().setBorderWidth(border_width); | 2641 | frame().setBorderWidth(border_width); |
2642 | } | ||
2641 | 2643 | ||
2642 | // we rely on frame not doing anything if it is already shown/hidden | 2644 | // we rely on frame not doing anything if it is already shown/hidden |
2643 | if (decorations.titlebar) | 2645 | if (decorations.titlebar) |
2644 | frame().showTitlebar(); | 2646 | client_move |= frame().showTitlebar(); |
2645 | else | 2647 | else |
2646 | frame().hideTitlebar(); | 2648 | client_move |= frame().hideTitlebar(); |
2647 | 2649 | ||
2648 | if (decorations.handle) { | 2650 | if (decorations.handle) { |
2649 | frame().showHandle(); | 2651 | client_move |= frame().showHandle(); |
2650 | } else | 2652 | } else |
2651 | frame().hideHandle(); | 2653 | client_move |= frame().hideHandle(); |
2652 | 2654 | ||
2653 | // apply gravity once more | 2655 | // apply gravity once more |
2654 | frame().gravityTranslate(grav_x, grav_y, m_client->gravity(), false); | 2656 | frame().gravityTranslate(grav_x, grav_y, m_client->gravity(), false); |
2655 | 2657 | ||
2656 | // if the location changes, shift it | 2658 | // if the location changes, shift it |
2657 | if (grav_x != 0 || grav_y != 0) | 2659 | if (grav_x != 0 || grav_y != 0) { |
2658 | move(grav_x + frame().x(), grav_y + frame().y()); | 2660 | move(grav_x + frame().x(), grav_y + frame().y()); |
2661 | client_move = true; | ||
2662 | } | ||
2659 | 2663 | ||
2660 | frame().reconfigure(); | 2664 | frame().reconfigure(); |
2665 | if (client_move) | ||
2666 | sendConfigureNotify(); | ||
2661 | } | 2667 | } |
2662 | 2668 | ||
2663 | void FluxboxWindow::toggleDecoration() { | 2669 | void FluxboxWindow::toggleDecoration() { |
@@ -2989,8 +2995,6 @@ void FluxboxWindow::attachTo(int x, int y) { | |||
2989 | if (client) | 2995 | if (client) |
2990 | attach_to_win = client->fbwindow(); | 2996 | attach_to_win = client->fbwindow(); |
2991 | 2997 | ||
2992 | cerr<<"client = "<<client<<", child = "<<hex<<child<<dec<<", fbwin = "<<attach_to_win<<endl; | ||
2993 | |||
2994 | if (attach_to_win != this && | 2998 | if (attach_to_win != this && |
2995 | attach_to_win != 0) { | 2999 | attach_to_win != 0) { |
2996 | attach_to_win->attachClient(*m_attaching_tab); | 3000 | attach_to_win->attachClient(*m_attaching_tab); |