From 215939d6edcbd88aeb00745ec14f526f037ddb20 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Fri, 15 Aug 2008 04:46:06 -0700 Subject: let FbWinFrame handle decorations in fullscreen state --- src/FbWinFrame.cc | 36 ++++++++++++++++++++++++++++++------ src/FbWinFrame.hh | 8 +++++++- src/Window.cc | 17 ++--------------- 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) { clearAll(); } +void FbWinFrame::setFullscreen(bool newvalue) { + if (newvalue == m_state.fullscreen) + return; + + m_state.fullscreen = newvalue; + applyDecorations(); +} + void FbWinFrame::setAlpha(bool focused, unsigned char alpha) { if (focused) m_focused_alpha = alpha; @@ -842,7 +850,7 @@ void FbWinFrame::reconfigure() { m_bevel = theme()->bevelWidth(); setBorderWidth(); - if (m_state.deco_mask & DECORM_HANDLE && theme()->handleWidth() != 0) + if (useHandle() && theme()->handleWidth() != 0) showHandle(); else hideHandle(); @@ -1427,6 +1435,22 @@ int FbWinFrame::getDecoMaskFromString(const string &str_label) { return mask; } +bool FbWinFrame::useBorder() const { + return !m_state.fullscreen && m_state.deco_mask & DECORM_BORDER; +} + +bool FbWinFrame::useTabs() const { + return !m_state.fullscreen && m_state.deco_mask & DECORM_TAB; +} + +bool FbWinFrame::useTitlebar() const { + return !m_state.fullscreen && m_state.deco_mask & DECORM_TITLEBAR; +} + +bool FbWinFrame::useHandle() const { + return !m_state.fullscreen && m_state.deco_mask & DECORM_HANDLE; +} + void FbWinFrame::applyDecorations() { int grav_x=0, grav_y=0; // negate gravity @@ -1438,13 +1462,13 @@ void FbWinFrame::applyDecorations() { // tab deocration only affects if we're external // must do before the setTabMode in case it goes // to external and is meant to be hidden - if (m_state.deco_mask & DECORM_TAB) + if (useTabs()) client_move |= showTabs(); else client_move |= hideTabs(); // we rely on frame not doing anything if it is already shown/hidden - if (m_state.deco_mask & DECORM_TITLEBAR) { + if (useTitlebar()) { client_move |= showTitlebar(); if (m_screen.getDefaultInternalTabs()) client_move |= setTabMode(INTERNAL); @@ -1452,11 +1476,11 @@ void FbWinFrame::applyDecorations() { client_move |= setTabMode(EXTERNAL); } else { client_move |= hideTitlebar(); - if (m_state.deco_mask & DECORM_TAB) + if (useTabs()) client_move |= setTabMode(EXTERNAL); } - if (m_state.deco_mask & DECORM_HANDLE) + if (useHandle()) client_move |= showHandle(); else client_move |= hideHandle(); @@ -1478,7 +1502,7 @@ void FbWinFrame::applyDecorations() { bool FbWinFrame::setBorderWidth(bool do_move) { unsigned int border_width = theme()->border().width(); - unsigned int win_bw = m_state.deco_mask & DECORM_BORDER ? border_width : 0; + unsigned int win_bw = useBorder() ? border_width : 0; if (border_width && 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: /// set focus/unfocus style void setFocus(bool newvalue); - void setFullscreen(bool value) { m_state.fullscreen = value; } + void setFullscreen(bool value); void setMaximized(int value) { m_state.maximized = value; } void setFocusTitle(const std::string &str) { m_label.setText(str); } @@ -232,6 +232,12 @@ public: void setDecorationMask(unsigned int mask) { m_state.deco_mask = mask; } void applyDecorations(); + /// determine if the given decoration should be shown in current state + bool useBorder() const; + bool useTabs() const; + bool useTitlebar() const; + bool useHandle() const; + // this function translates its arguments according to win_gravity // if win_gravity is negative, it does an inverse translation 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) { frame().setUseShape(false); - if (!m_toggled_decos) - m_old_decoration_mask = decorationMask(); - m_old_layernum = layerNum(); if (!maximized) { m_old_pos_x = frame().x(); @@ -1505,8 +1502,8 @@ void FluxboxWindow::setFullscreen(bool flag) { m_old_height = frame().height(); } - // clear decorations - setDecorationMask(0); + fullscreen = true; + frame().setFullscreen(true); // dont call Window::moveResize here, it might ignore the // resize if win state is not resizable; @@ -1518,9 +1515,6 @@ void FluxboxWindow::setFullscreen(bool flag) { screen().getHeadWidth(head), screen().getHeadHeight(head)); sendConfigureNotify(); - fullscreen = true; - frame().setFullscreen(true); - setFullscreenLayer(); if (!isFocused()) screen().focusedWindowSig().attach(this); @@ -1531,13 +1525,6 @@ void FluxboxWindow::setFullscreen(bool flag) { frame().setFullscreen(false); frame().setUseShape(true); - if (m_toggled_decos) { - if (m_old_decoration_mask & (FbWinFrame::DECORM_TITLEBAR | FbWinFrame::DECORM_TAB)) - setDecorationMask(FbWinFrame::DECOR_NONE); - else - setDecorationMask(FbWinFrame::DECOR_NORMAL); - } else - setDecorationMask(m_old_decoration_mask); // ensure we apply the sizehints here, otherwise some // apps (eg xterm) end up a little bit .. crappy (visually) -- cgit v0.11.2