aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-15 11:46:06 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-15 11:46:06 (GMT)
commit215939d6edcbd88aeb00745ec14f526f037ddb20 (patch)
treec45771d10bcedca3882d354414fe631eb8b3c44c
parent0689a0a4a8252d46a72048269faf00dba52a73c3 (diff)
downloadfluxbox-215939d6edcbd88aeb00745ec14f526f037ddb20.zip
fluxbox-215939d6edcbd88aeb00745ec14f526f037ddb20.tar.bz2
let FbWinFrame handle decorations in fullscreen state
-rw-r--r--src/FbWinFrame.cc36
-rw-r--r--src/FbWinFrame.hh8
-rw-r--r--src/Window.cc17
3 files changed, 39 insertions, 22 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index becbe36..b9f3302 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -489,6 +489,14 @@ void FbWinFrame::setFocus(bool newvalue) {
489 clearAll(); 489 clearAll();
490} 490}
491 491
492void FbWinFrame::setFullscreen(bool newvalue) {
493 if (newvalue == m_state.fullscreen)
494 return;
495
496 m_state.fullscreen = newvalue;
497 applyDecorations();
498}
499
492void FbWinFrame::setAlpha(bool focused, unsigned char alpha) { 500void FbWinFrame::setAlpha(bool focused, unsigned char alpha) {
493 if (focused) 501 if (focused)
494 m_focused_alpha = alpha; 502 m_focused_alpha = alpha;
@@ -842,7 +850,7 @@ void FbWinFrame::reconfigure() {
842 m_bevel = theme()->bevelWidth(); 850 m_bevel = theme()->bevelWidth();
843 setBorderWidth(); 851 setBorderWidth();
844 852
845 if (m_state.deco_mask & DECORM_HANDLE && theme()->handleWidth() != 0) 853 if (useHandle() && theme()->handleWidth() != 0)
846 showHandle(); 854 showHandle();
847 else 855 else
848 hideHandle(); 856 hideHandle();
@@ -1427,6 +1435,22 @@ int FbWinFrame::getDecoMaskFromString(const string &str_label) {
1427 return mask; 1435 return mask;
1428} 1436}
1429 1437
1438bool FbWinFrame::useBorder() const {
1439 return !m_state.fullscreen && m_state.deco_mask & DECORM_BORDER;
1440}
1441
1442bool FbWinFrame::useTabs() const {
1443 return !m_state.fullscreen && m_state.deco_mask & DECORM_TAB;
1444}
1445
1446bool FbWinFrame::useTitlebar() const {
1447 return !m_state.fullscreen && m_state.deco_mask & DECORM_TITLEBAR;
1448}
1449
1450bool FbWinFrame::useHandle() const {
1451 return !m_state.fullscreen && m_state.deco_mask & DECORM_HANDLE;
1452}
1453
1430void FbWinFrame::applyDecorations() { 1454void FbWinFrame::applyDecorations() {
1431 int grav_x=0, grav_y=0; 1455 int grav_x=0, grav_y=0;
1432 // negate gravity 1456 // negate gravity
@@ -1438,13 +1462,13 @@ void FbWinFrame::applyDecorations() {
1438 // tab deocration only affects if we're external 1462 // tab deocration only affects if we're external
1439 // must do before the setTabMode in case it goes 1463 // must do before the setTabMode in case it goes
1440 // to external and is meant to be hidden 1464 // to external and is meant to be hidden
1441 if (m_state.deco_mask & DECORM_TAB) 1465 if (useTabs())
1442 client_move |= showTabs(); 1466 client_move |= showTabs();
1443 else 1467 else
1444 client_move |= hideTabs(); 1468 client_move |= hideTabs();
1445 1469
1446 // we rely on frame not doing anything if it is already shown/hidden 1470 // we rely on frame not doing anything if it is already shown/hidden
1447 if (m_state.deco_mask & DECORM_TITLEBAR) { 1471 if (useTitlebar()) {
1448 client_move |= showTitlebar(); 1472 client_move |= showTitlebar();
1449 if (m_screen.getDefaultInternalTabs()) 1473 if (m_screen.getDefaultInternalTabs())
1450 client_move |= setTabMode(INTERNAL); 1474 client_move |= setTabMode(INTERNAL);
@@ -1452,11 +1476,11 @@ void FbWinFrame::applyDecorations() {
1452 client_move |= setTabMode(EXTERNAL); 1476 client_move |= setTabMode(EXTERNAL);
1453 } else { 1477 } else {
1454 client_move |= hideTitlebar(); 1478 client_move |= hideTitlebar();
1455 if (m_state.deco_mask & DECORM_TAB) 1479 if (useTabs())
1456 client_move |= setTabMode(EXTERNAL); 1480 client_move |= setTabMode(EXTERNAL);
1457 } 1481 }
1458 1482
1459 if (m_state.deco_mask & DECORM_HANDLE) 1483 if (useHandle())
1460 client_move |= showHandle(); 1484 client_move |= showHandle();
1461 else 1485 else
1462 client_move |= hideHandle(); 1486 client_move |= hideHandle();
@@ -1478,7 +1502,7 @@ void FbWinFrame::applyDecorations() {
1478 1502
1479bool FbWinFrame::setBorderWidth(bool do_move) { 1503bool FbWinFrame::setBorderWidth(bool do_move) {
1480 unsigned int border_width = theme()->border().width(); 1504 unsigned int border_width = theme()->border().width();
1481 unsigned int win_bw = m_state.deco_mask & DECORM_BORDER ? border_width : 0; 1505 unsigned int win_bw = useBorder() ? border_width : 0;
1482 1506
1483 if (border_width && 1507 if (border_width &&
1484 theme()->border().color().pixel() != window().borderColor()) { 1508 theme()->border().color().pixel() != window().borderColor()) {
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index c9e15d0..5c93727 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -175,7 +175,7 @@ public:
175 175
176 /// set focus/unfocus style 176 /// set focus/unfocus style
177 void setFocus(bool newvalue); 177 void setFocus(bool newvalue);
178 void setFullscreen(bool value) { m_state.fullscreen = value; } 178 void setFullscreen(bool value);
179 void setMaximized(int value) { m_state.maximized = value; } 179 void setMaximized(int value) { m_state.maximized = value; }
180 180
181 void setFocusTitle(const std::string &str) { m_label.setText(str); } 181 void setFocusTitle(const std::string &str) { m_label.setText(str); }
@@ -232,6 +232,12 @@ public:
232 void setDecorationMask(unsigned int mask) { m_state.deco_mask = mask; } 232 void setDecorationMask(unsigned int mask) { m_state.deco_mask = mask; }
233 void applyDecorations(); 233 void applyDecorations();
234 234
235 /// determine if the given decoration should be shown in current state
236 bool useBorder() const;
237 bool useTabs() const;
238 bool useTitlebar() const;
239 bool useHandle() const;
240
235 // this function translates its arguments according to win_gravity 241 // this function translates its arguments according to win_gravity
236 // if win_gravity is negative, it does an inverse translation 242 // if win_gravity is negative, it does an inverse translation
237 void gravityTranslate(int &x, int &y, int win_gravity, unsigned int client_bw, bool move_frame = false); 243 void gravityTranslate(int &x, int &y, int win_gravity, unsigned int client_bw, bool move_frame = false);
diff --git a/src/Window.cc b/src/Window.cc
index 9628598..cf9fa81 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1494,9 +1494,6 @@ void FluxboxWindow::setFullscreen(bool flag) {
1494 1494
1495 frame().setUseShape(false); 1495 frame().setUseShape(false);
1496 1496
1497 if (!m_toggled_decos)
1498 m_old_decoration_mask = decorationMask();
1499
1500 m_old_layernum = layerNum(); 1497 m_old_layernum = layerNum();
1501 if (!maximized) { 1498 if (!maximized) {
1502 m_old_pos_x = frame().x(); 1499 m_old_pos_x = frame().x();
@@ -1505,8 +1502,8 @@ void FluxboxWindow::setFullscreen(bool flag) {
1505 m_old_height = frame().height(); 1502 m_old_height = frame().height();
1506 } 1503 }
1507 1504
1508 // clear decorations 1505 fullscreen = true;
1509 setDecorationMask(0); 1506 frame().setFullscreen(true);
1510 1507
1511 // dont call Window::moveResize here, it might ignore the 1508 // dont call Window::moveResize here, it might ignore the
1512 // resize if win state is not resizable; 1509 // resize if win state is not resizable;
@@ -1518,9 +1515,6 @@ void FluxboxWindow::setFullscreen(bool flag) {
1518 screen().getHeadWidth(head), screen().getHeadHeight(head)); 1515 screen().getHeadWidth(head), screen().getHeadHeight(head));
1519 sendConfigureNotify(); 1516 sendConfigureNotify();
1520 1517
1521 fullscreen = true;
1522 frame().setFullscreen(true);
1523
1524 setFullscreenLayer(); 1518 setFullscreenLayer();
1525 if (!isFocused()) 1519 if (!isFocused())
1526 screen().focusedWindowSig().attach(this); 1520 screen().focusedWindowSig().attach(this);
@@ -1531,13 +1525,6 @@ void FluxboxWindow::setFullscreen(bool flag) {
1531 frame().setFullscreen(false); 1525 frame().setFullscreen(false);
1532 1526
1533 frame().setUseShape(true); 1527 frame().setUseShape(true);
1534 if (m_toggled_decos) {
1535 if (m_old_decoration_mask & (FbWinFrame::DECORM_TITLEBAR | FbWinFrame::DECORM_TAB))
1536 setDecorationMask(FbWinFrame::DECOR_NONE);
1537 else
1538 setDecorationMask(FbWinFrame::DECOR_NORMAL);
1539 } else
1540 setDecorationMask(m_old_decoration_mask);
1541 1528
1542 // ensure we apply the sizehints here, otherwise some 1529 // ensure we apply the sizehints here, otherwise some
1543 // apps (eg xterm) end up a little bit .. crappy (visually) 1530 // apps (eg xterm) end up a little bit .. crappy (visually)