aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-22 23:29:09 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-22 23:29:09 (GMT)
commite3fb16c993331de931042b3fbd4300124e2cc9eb (patch)
treebaaceb1b040a71a1f8bcc8fdea42eb0a683e02ff
parentc37a91e1504fa73da233cc59fe67ead56dbd3083 (diff)
downloadfluxbox_paul-e3fb16c993331de931042b3fbd4300124e2cc9eb.zip
fluxbox_paul-e3fb16c993331de931042b3fbd4300124e2cc9eb.tar.bz2
allow various combinations of shaded, maximized, and fullscreen states
-rw-r--r--src/FbWinFrame.cc82
-rw-r--r--src/FbWinFrame.hh1
-rw-r--r--src/Window.cc8
3 files changed, 41 insertions, 50 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index bac06d2..1f0a52e 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -88,7 +88,6 @@ FbWinFrame::FbWinFrame(BScreen &screen,
88 m_active_orig_client_bw(0), 88 m_active_orig_client_bw(0),
89 m_need_render(true), 89 m_need_render(true),
90 m_button_size(1), 90 m_button_size(1),
91 m_height_before_shade(1),
92 m_focused_alpha(AlphaAcc(*theme.focusedTheme(), &FbWinFrameTheme::alpha)), 91 m_focused_alpha(AlphaAcc(*theme.focusedTheme(), &FbWinFrameTheme::alpha)),
93 m_unfocused_alpha(AlphaAcc(*theme.unfocusedTheme(), &FbWinFrameTheme::alpha)), 92 m_unfocused_alpha(AlphaAcc(*theme.unfocusedTheme(), &FbWinFrameTheme::alpha)),
94 m_shape(m_window, theme->shapePlace()) { 93 m_shape(m_window, theme->shapePlace()) {
@@ -195,21 +194,14 @@ void FbWinFrame::show() {
195 Toggle shade state, and resize window 194 Toggle shade state, and resize window
196 */ 195 */
197void FbWinFrame::shade() { 196void FbWinFrame::shade() {
198 if (!m_use_titlebar) 197 if (!(m_state.deco_mask & DECORM_TITLEBAR))
199 return; 198 return;
200 199
201 // toggle shade 200 // toggle shade
201 if (!m_state.shaded)
202 saveGeometry();
202 m_state.shaded = !m_state.shaded; 203 m_state.shaded = !m_state.shaded;
203 if (m_state.shaded) { // i.e. should be shaded now 204 applyState();
204 m_height_before_shade = m_window.height();
205 m_window.resize(m_window.width(), m_titlebar.height());
206 alignTabs();
207 // need to update our shape
208 m_shape.update();
209 } else { // should be unshaded
210 m_window.resize(m_window.width(), m_height_before_shade);
211 reconfigure();
212 }
213} 205}
214 206
215 207
@@ -246,8 +238,8 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh
246 if (move && x == window().x() && y == window().y()) 238 if (move && x == window().x() && y == window().y())
247 move = false; 239 move = false;
248 240
249 if (resize && (m_state.shaded || (width == FbWinFrame::width() && 241 if (resize && width == FbWinFrame::width() &&
250 height == FbWinFrame::height()))) 242 height == FbWinFrame::height())
251 resize = false; 243 resize = false;
252 244
253 if (!move && !resize) 245 if (!move && !resize)
@@ -544,44 +536,52 @@ void FbWinFrame::setMaximized(int value) {
544} 536}
545 537
546void FbWinFrame::saveGeometry() { 538void FbWinFrame::saveGeometry() {
547 if (m_state.fullscreen || m_state.maximized) 539 if (m_state.fullscreen || m_state.maximized == MAX_FULL)
548 return; 540 return;
549 541
550 m_state.x = x(); 542 m_state.x = x();
551 m_state.y = y(); 543 m_state.y = y();
552 m_state.width = width(); 544 if (!(m_state.maximized & MAX_HORZ))
553 m_state.height = height(); 545 m_state.width = width();
546 if (!m_state.shaded && !(m_state.maximized & MAX_VERT))
547 m_state.height = height();
554} 548}
555 549
556void FbWinFrame::applyState() { 550void FbWinFrame::applyState() {
557 applyDecorations(); 551 applyDecorations();
558 552
559 if (m_state.fullscreen) { 553 const int head = m_screen.getHead(window());
560 const int head = m_screen.getHead(window()); 554 int new_x = m_state.x, new_y = m_state.y;
561 moveResize(m_screen.getHeadX(head), m_screen.getHeadY(head), 555 unsigned int new_w = m_state.width, new_h = m_state.height;
562 m_screen.getHeadWidth(head), m_screen.getHeadHeight(head)); 556
563 } else if (m_state.maximized) { 557 if (m_state.maximized & MAX_VERT) {
564 const int head = m_screen.getHead(window()); 558 new_y = m_screen.maxTop(head);
565 int new_x = m_state.x, new_y = m_state.y; 559 new_h = m_screen.maxBottom(head) - new_y - 2*window().borderWidth();
566 unsigned int new_w = m_state.width, new_h = m_state.height;
567 if (m_state.maximized & MAX_VERT) {
568 new_y = m_screen.maxTop(head);
569 new_h = m_screen.maxBottom(head) - new_y - 2*window().borderWidth();
570 }
571 if (m_state.maximized & MAX_HORZ) {
572 new_x = m_screen.maxLeft(head);
573 new_w = m_screen.maxRight(head) - new_x - 2*window().borderWidth();
574 }
575 if (!m_screen.getMaxOverTabs()) { 560 if (!m_screen.getMaxOverTabs()) {
576 new_y += yOffset(); 561 new_y += yOffset();
577 new_h -= heightOffset(); 562 new_h -= heightOffset();
563 }
564 }
565 if (m_state.maximized & MAX_HORZ) {
566 new_x = m_screen.maxLeft(head);
567 new_w = m_screen.maxRight(head) - new_x - 2*window().borderWidth();
568 if (!m_screen.getMaxOverTabs()) {
578 new_x += xOffset(); 569 new_x += xOffset();
579 new_w -= widthOffset(); 570 new_w -= widthOffset();
580 } 571 }
581 moveResize(new_x, new_y, new_w, new_h); 572 }
582 } else 573
583 moveResize(m_state.x, m_state.y, m_state.width, m_state.height); 574 if (m_state.shaded)
575 new_h = m_titlebar.height();
584 576
577 if (m_state.fullscreen) {
578 new_x = m_screen.getHeadX(head);
579 new_y = m_screen.getHeadY(head);
580 new_w = m_screen.getHeadWidth(head);
581 new_h = m_screen.getHeadHeight(head);
582 }
583
584 moveResize(new_x, new_y, new_w, new_h);
585 frameExtentSig().notify(); 585 frameExtentSig().notify();
586} 586}
587 587
@@ -973,7 +973,7 @@ void FbWinFrame::reconfigure() {
973 } 973 }
974 974
975 // leave client+grips alone if we're shaded (it'll get fixed when we unshade) 975 // leave client+grips alone if we're shaded (it'll get fixed when we unshade)
976 if (!m_state.shaded) { 976 if (!m_state.shaded || m_state.fullscreen) {
977 int client_top = 0; 977 int client_top = 0;
978 int client_height = m_window.height(); 978 int client_height = m_window.height();
979 if (m_use_titlebar) { 979 if (m_use_titlebar) {
@@ -1369,7 +1369,6 @@ void FbWinFrame::init() {
1369 m_button_size = 26; 1369 m_button_size = 26;
1370 1370
1371 m_label.setBorderWidth(0); 1371 m_label.setBorderWidth(0);
1372 m_state.shaded = false;
1373 1372
1374 setTabMode(NOTSET); 1373 setTabMode(NOTSET);
1375 1374
@@ -1516,7 +1515,8 @@ bool FbWinFrame::useTitlebar() const {
1516} 1515}
1517 1516
1518bool FbWinFrame::useHandle() const { 1517bool FbWinFrame::useHandle() const {
1519 return !m_state.fullscreen && m_state.deco_mask & DECORM_HANDLE; 1518 return !m_state.fullscreen && !m_state.shaded &&
1519 m_state.deco_mask & DECORM_HANDLE;
1520} 1520}
1521 1521
1522int FbWinFrame::getShape() const { 1522int FbWinFrame::getShape() const {
@@ -1734,10 +1734,8 @@ unsigned int FbWinFrame::normalWidth() const {
1734} 1734}
1735 1735
1736unsigned int FbWinFrame::normalHeight() const { 1736unsigned int FbWinFrame::normalHeight() const {
1737 if ((m_state.maximized & MAX_VERT) || m_state.fullscreen) 1737 if ((m_state.maximized & MAX_VERT) || m_state.fullscreen || m_state.shaded)
1738 return m_state.height; 1738 return m_state.height;
1739 if (m_state.shaded)
1740 return m_height_before_shade;
1741 return height(); 1739 return height();
1742} 1740}
1743 1741
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 7f08175..55d47ed 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -467,7 +467,6 @@ private:
467 467
468 bool m_need_render; 468 bool m_need_render;
469 int m_button_size; ///< size for all titlebar buttons 469 int m_button_size; ///< size for all titlebar buttons
470 unsigned int m_height_before_shade; ///< height before shade, so we can restore it when we unshade
471 /// alpha values 470 /// alpha values
472 typedef FbTk::ConstObjectAccessor<unsigned char, FbWinFrameTheme> AlphaAcc; 471 typedef FbTk::ConstObjectAccessor<unsigned char, FbWinFrameTheme> AlphaAcc;
473 FbTk::DefaultValue<unsigned char, AlphaAcc> m_focused_alpha; 472 FbTk::DefaultValue<unsigned char, AlphaAcc> m_focused_alpha;
diff --git a/src/Window.cc b/src/Window.cc
index 52672c0..b175314 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1465,9 +1465,6 @@ void FluxboxWindow::setFullscreen(bool flag) {
1465 1465
1466 if (flag && !isFullscreen()) { 1466 if (flag && !isFullscreen()) {
1467 1467
1468 if (isShaded())
1469 shade();
1470
1471 m_old_layernum = layerNum(); 1468 m_old_layernum = layerNum();
1472 fullscreen = true; 1469 fullscreen = true;
1473 frame().setFullscreen(true); 1470 frame().setFullscreen(true);
@@ -1535,9 +1532,6 @@ void FluxboxWindow::setMaximizedState(int type) {
1535 return; 1532 return;
1536 } 1533 }
1537 1534
1538 if (isShaded())
1539 shade();
1540
1541 if (isResizing()) 1535 if (isResizing())
1542 stopResizing(); 1536 stopResizing();
1543 1537
@@ -1605,7 +1599,7 @@ void FluxboxWindow::shade() {
1605 frame().shade(); 1599 frame().shade();
1606 1600
1607 shaded = !shaded; 1601 shaded = !shaded;
1608 1602 stateSig().notify();
1609 // TODO: this should set IconicState, but then we can't focus the window 1603 // TODO: this should set IconicState, but then we can't focus the window
1610} 1604}
1611 1605