aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-04-03 22:37:43 (GMT)
committerrathnor <rathnor>2003-04-03 22:37:43 (GMT)
commit67f058496a98789562fa61ccc4e9c5b0b81abd90 (patch)
tree628097db55b28b49eb8e7022daceef69cdadceb7
parent9183cd20617eb00b8012712a6d18ff61c302924e (diff)
downloadfluxbox_paul-67f058496a98789562fa61ccc4e9c5b0b81abd90.zip
fluxbox_paul-67f058496a98789562fa61ccc4e9c5b0b81abd90.tar.bz2
fix shading bug (Simon)
-rw-r--r--src/FbWinFrame.cc100
1 files changed, 51 insertions, 49 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index a96d96c..2564263 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.14 2003/02/23 21:32:37 rathnor Exp $ 22// $Id: FbWinFrame.cc,v 1.15 2003/04/03 22:37:43 rathnor Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25#include "ImageControl.hh" 25#include "ImageControl.hh"
@@ -137,18 +137,16 @@ void FbWinFrame::shade() {
137 if (!m_use_titlebar) 137 if (!m_use_titlebar)
138 return; 138 return;
139 139
140 if (!m_shaded) { 140 // toggle shade
141 m_shaded = !m_shaded;
142 if (m_shaded) { // i.e. should be shaded now
141 m_width_before_shade = m_window.width(); 143 m_width_before_shade = m_window.width();
142 m_height_before_shade = m_window.height(); 144 m_height_before_shade = m_window.height();
143 m_window.resize(m_window.width(), m_titlebar.height()); 145 m_window.resize(m_window.width(), m_titlebar.height());
144 } else { 146 } else { // should be unshaded
145 m_window.resize(m_width_before_shade, m_height_before_shade); 147 m_window.resize(m_width_before_shade, m_height_before_shade);
146 m_grip_left.clear(); 148 reconfigure();
147 m_grip_right.clear();
148 m_handle.clear();
149 } 149 }
150 // toggle shade
151 m_shaded = !m_shaded;
152} 150}
153 151
154 152
@@ -434,50 +432,54 @@ void FbWinFrame::reconfigure() {
434 if (m_use_titlebar) 432 if (m_use_titlebar)
435 reconfigureTitlebar(); 433 reconfigureTitlebar();
436 434
437 int client_top = 0; 435 // leave client+grips alone if we're shaded (it'll get fixed when we unshade)
438 int client_height = m_window.height(); 436 if (!m_shaded) {
439 if (m_use_titlebar) { 437 int client_top = 0;
440 // only one borderwidth as titlebar is really at -borderwidth 438 int client_height = m_window.height();
441 int titlebar_height = m_titlebar.height() + m_titlebar.borderWidth(); 439 if (m_use_titlebar) {
442 client_top += titlebar_height; 440 // only one borderwidth as titlebar is really at -borderwidth
443 client_height -= titlebar_height; 441 int titlebar_height = m_titlebar.height() + m_titlebar.borderWidth();
444 } 442 client_top += titlebar_height;
445 443 client_height -= titlebar_height;
446 if (m_use_handle) { 444 }
447 client_height -= m_handle.height() + m_handle.borderWidth(); 445
448 } 446 if (m_use_handle) {
449 447 client_height -= m_handle.height() + m_handle.borderWidth();
450 m_clientarea.moveResize(0, client_top, 448 }
451 m_window.width(), client_height); 449
452 450 m_clientarea.moveResize(0, client_top,
453 if (m_clientwin != 0) { 451 m_window.width(), client_height);
454 XMoveResizeWindow(FbTk::App::instance()->display(), m_clientwin, 452
455 0, 0, 453 if (m_clientwin != 0) {
456 m_clientarea.width(), m_clientarea.height()); 454 XMoveResizeWindow(FbTk::App::instance()->display(), m_clientwin,
457 } 455 0, 0,
458 456 m_clientarea.width(), m_clientarea.height());
459 457 }
460 if (!m_use_handle) // no need to do anything more 458
461 return; 459
462 460 if (!m_use_handle) // no need to do anything more
463 // align handle and grips 461 return;
464 const int grip_height = m_handle.height(); 462
465 const int grip_width = 20; //TODO 463 // align handle and grips
466 464 const int grip_height = m_handle.height();
467 const int ypos = m_window.height() - grip_height - m_handle.borderWidth(); 465 const int grip_width = 20; //TODO
468 466
469 m_grip_left.moveResize(-m_handle.borderWidth(), ypos, 467 const int ypos = m_window.height() - grip_height - m_handle.borderWidth();
470 grip_width, grip_height); 468
471 469 m_grip_left.moveResize(-m_handle.borderWidth(), ypos,
472 m_handle.moveResize(grip_width, ypos, 470 grip_width, grip_height);
473 m_window.width() - grip_width*2 - m_handle.borderWidth()*2, grip_height); 471
474 472 m_handle.moveResize(grip_width, ypos,
475 m_grip_right.moveResize(m_window.width() - grip_width - m_handle.borderWidth(), ypos, 473 m_window.width() - grip_width*2 - m_handle.borderWidth()*2, grip_height);
476 grip_width, grip_height); 474
475 m_grip_right.moveResize(m_window.width() - grip_width - m_handle.borderWidth(), ypos,
476 grip_width, grip_height);
477 }
477 478
478 // render the theme 479 // render the theme
479 renderButtons(); 480 renderButtons();
480 renderHandles(); 481 if (!m_shaded)
482 renderHandles();
481 redrawTitle(); 483 redrawTitle();
482 redrawTitlebar(); 484 redrawTitlebar();
483} 485}