all repos — fluxbox @ 1b48b749b9a376c883ff4cc2ca3e807ac85cf21f

custom fork of the fluxbox windowmanager

make FbWinFrame aware of the decoration state
Mark Tiefenbruck mark@fluxbox.org
commit

1b48b749b9a376c883ff4cc2ca3e807ac85cf21f

parent

0676161673d4347197c9d20fe3d613527633e597

5 files changed, 82 insertions(+), 78 deletions(-)

jump to
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -81,6 +81,7 @@ ButtonPressMask | ButtonReleaseMask |

ButtonMotionMask | ExposureMask | EnterWindowMask | LeaveWindowMask), m_bevel(1), + m_decoration_mask(DECOR_NORMAL), m_use_titlebar(true), m_use_tabs(true), m_use_handle(true),
M src/FbWinFrame.hhsrc/FbWinFrame.hh

@@ -72,6 +72,34 @@ LEFTBOTTOM, LEFTTOP,

RIGHTBOTTOM, RIGHTTOP }; + /** + This enumeration represents individual decoration + attributes, they can be OR-d together to get a mask. + Useful for saving. + */ + enum DecorationMask { + DECORM_TITLEBAR = (1<<0), + DECORM_HANDLE = (1<<1), + DECORM_BORDER = (1<<2), + DECORM_ICONIFY = (1<<3), + DECORM_MAXIMIZE = (1<<4), + DECORM_CLOSE = (1<<5), + DECORM_MENU = (1<<6), + DECORM_STICKY = (1<<7), + DECORM_SHADE = (1<<8), + DECORM_TAB = (1<<9), + DECORM_ENABLED = (1<<10), + DECORM_LAST = (1<<11) // useful for getting "All" + }; + + enum Decoration { + DECOR_NONE = 0, + DECOR_NORMAL = DECORM_LAST - 1, + DECOR_TINY = DECORM_TITLEBAR|DECORM_ICONIFY|DECORM_MENU|DECORM_TAB, + DECOR_TOOL = DECORM_TITLEBAR|DECORM_MENU, + DECOR_BORDER = DECORM_BORDER|DECORM_MENU, + DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB + }; /// create a top level window FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,

@@ -161,6 +189,7 @@ void setEventHandler(FbTk::EventHandler &evh);

/// remove any handler for the windows void removeEventHandler(); + void setDecorationMask(unsigned int mask) { m_decoration_mask = mask; } // these return true/false for if something changed bool hideTitlebar(); bool showTitlebar();

@@ -314,6 +343,7 @@ m_buttons_right; ///< buttons to the right

typedef std::list<FbTk::TextButton *> LabelList; IconButton *m_current_label; ///< which client button is focused at the moment int m_bevel; ///< bevel between titlebar items and titlebar + unsigned int m_decoration_mask; ///< bitmask of applied decorations bool m_use_titlebar; ///< if we should use titlebar bool m_use_tabs; ///< if we should use tabs (turns them off in external mode only) bool m_use_handle; ///< if we should use handle
M src/Remember.ccsrc/Remember.cc

@@ -814,25 +814,25 @@ case (0) :

apps_file << " [Deco]\t{NONE}" << endl; break; case (0xffffffff): - case (FluxboxWindow::DECORM_LAST - 1): + case (FbWinFrame::DECORM_LAST - 1): apps_file << " [Deco]\t{NORMAL}" << endl; break; - case (FluxboxWindow::DECORM_TITLEBAR - | FluxboxWindow::DECORM_ICONIFY - | FluxboxWindow::DECORM_MENU): + case (FbWinFrame::DECORM_TITLEBAR + | FbWinFrame::DECORM_ICONIFY + | FbWinFrame::DECORM_MENU): apps_file << " [Deco]\t{TOOL}" << endl; break; - case (FluxboxWindow::DECORM_TITLEBAR - | FluxboxWindow::DECORM_MENU): + case (FbWinFrame::DECORM_TITLEBAR + | FbWinFrame::DECORM_MENU): apps_file << " [Deco]\t{TINY}" << endl; break; - case (FluxboxWindow::DECORM_BORDER - | FluxboxWindow::DECORM_MENU): + case (FbWinFrame::DECORM_BORDER + | FbWinFrame::DECORM_MENU): apps_file << " [Deco]\t{BORDER}" << endl; break; - case (FluxboxWindow::DECORM_BORDER - | FluxboxWindow::DECORM_MENU - | FluxboxWindow::DECORM_TAB): + case (FbWinFrame::DECORM_BORDER + | FbWinFrame::DECORM_MENU + | FbWinFrame::DECORM_TAB): apps_file << " [Deco]\t{TAB}" << endl; break; default:
M src/Window.ccsrc/Window.cc

@@ -1516,10 +1516,10 @@ fullscreen = false;

frame().setUseShape(true); if (m_toggled_decos) { - if (m_old_decoration_mask & (DECORM_TITLEBAR | DECORM_TAB)) - setDecorationMask(DECOR_NONE); + if (m_old_decoration_mask & (FbWinFrame::DECORM_TITLEBAR | FbWinFrame::DECORM_TAB)) + setDecorationMask(FbWinFrame::DECOR_NONE); else - setDecorationMask(DECOR_NORMAL); + setDecorationMask(FbWinFrame::DECOR_NORMAL); } else setDecorationMask(m_old_decoration_mask);

@@ -3032,6 +3032,7 @@ move(grav_x + frame().x(), grav_y + frame().y());

client_move = true; } + frame().setDecorationMask(decorationMask()); frame().reconfigure(); if (client_move) Fluxbox::instance()->updateFrameExtents(*this);

@@ -3051,9 +3052,9 @@

if (m_toggled_decos) { m_old_decoration_mask = decorationMask(); if (decorations.titlebar | decorations.tab) - setDecorationMask(DECOR_NONE); + setDecorationMask(FbWinFrame::DECOR_NONE); else - setDecorationMask(DECOR_NORMAL); + setDecorationMask(FbWinFrame::DECOR_NORMAL); } else //revert back to old decoration setDecorationMask(m_old_decoration_mask);

@@ -3062,42 +3063,42 @@

unsigned int FluxboxWindow::decorationMask() const { unsigned int ret = 0; if (decorations.titlebar) - ret |= DECORM_TITLEBAR; + ret |= FbWinFrame::DECORM_TITLEBAR; if (decorations.handle) - ret |= DECORM_HANDLE; + ret |= FbWinFrame::DECORM_HANDLE; if (decorations.border) - ret |= DECORM_BORDER; + ret |= FbWinFrame::DECORM_BORDER; if (decorations.iconify) - ret |= DECORM_ICONIFY; + ret |= FbWinFrame::DECORM_ICONIFY; if (decorations.maximize) - ret |= DECORM_MAXIMIZE; + ret |= FbWinFrame::DECORM_MAXIMIZE; if (decorations.close) - ret |= DECORM_CLOSE; + ret |= FbWinFrame::DECORM_CLOSE; if (decorations.menu) - ret |= DECORM_MENU; + ret |= FbWinFrame::DECORM_MENU; if (decorations.sticky) - ret |= DECORM_STICKY; + ret |= FbWinFrame::DECORM_STICKY; if (decorations.shade) - ret |= DECORM_SHADE; + ret |= FbWinFrame::DECORM_SHADE; if (decorations.tab) - ret |= DECORM_TAB; + ret |= FbWinFrame::DECORM_TAB; if (decorations.enabled) - ret |= DECORM_ENABLED; + ret |= FbWinFrame::DECORM_ENABLED; return ret; } void FluxboxWindow::setDecorationMask(unsigned int mask, bool apply) { - decorations.titlebar = mask & DECORM_TITLEBAR; - decorations.handle = mask & DECORM_HANDLE; - decorations.border = mask & DECORM_BORDER; - decorations.iconify = mask & DECORM_ICONIFY; - decorations.maximize = mask & DECORM_MAXIMIZE; - decorations.close = mask & DECORM_CLOSE; - decorations.menu = mask & DECORM_MENU; - decorations.sticky = mask & DECORM_STICKY; - decorations.shade = mask & DECORM_SHADE; - decorations.tab = mask & DECORM_TAB; - decorations.enabled = mask & DECORM_ENABLED; + decorations.titlebar = mask & FbWinFrame::DECORM_TITLEBAR; + decorations.handle = mask & FbWinFrame::DECORM_HANDLE; + decorations.border = mask & FbWinFrame::DECORM_BORDER; + decorations.iconify = mask & FbWinFrame::DECORM_ICONIFY; + decorations.maximize = mask & FbWinFrame::DECORM_MAXIMIZE; + decorations.close = mask & FbWinFrame::DECORM_CLOSE; + decorations.menu = mask & FbWinFrame::DECORM_MENU; + decorations.sticky = mask & FbWinFrame::DECORM_STICKY; + decorations.shade = mask & FbWinFrame::DECORM_SHADE; + decorations.tab = mask & FbWinFrame::DECORM_TAB; + decorations.enabled = mask & FbWinFrame::DECORM_ENABLED; // we don't want to do this during initialization if (apply) applyDecorations();

@@ -3268,7 +3269,7 @@

// we only care about the left/top etc that includes borders int borderW = 0; - if (decorationMask() & (DECORM_BORDER|DECORM_HANDLE)) + if (decorationMask() & (FbWinFrame::DECORM_BORDER|FbWinFrame::DECORM_HANDLE)) borderW = frame().window().borderWidth(); int top = orig_top; // orig include the borders

@@ -3340,7 +3341,7 @@ for (; it != it_end; it++) {

if ((*it) == this) continue; // skip myself - bw = (*it)->decorationMask() & (DECORM_BORDER|DECORM_HANDLE) ? + bw = (*it)->decorationMask() & (FbWinFrame::DECORM_BORDER|FbWinFrame::DECORM_HANDLE) ? (*it)->frame().window().borderWidth() : 0; snapToWindow(dx, dy, left, right, top, bottom,

@@ -4106,17 +4107,17 @@ }

int FluxboxWindow::getDecoMaskFromString(const string &str_label) { if (strcasecmp(str_label.c_str(), "NONE") == 0) - return DECOR_NONE; + return FbWinFrame::DECOR_NONE; if (strcasecmp(str_label.c_str(), "NORMAL") == 0) - return DECOR_NORMAL; + return FbWinFrame::DECOR_NORMAL; if (strcasecmp(str_label.c_str(), "TINY") == 0) - return DECOR_TINY; + return FbWinFrame::DECOR_TINY; if (strcasecmp(str_label.c_str(), "TOOL") == 0) - return DECOR_TOOL; + return FbWinFrame::DECOR_TOOL; if (strcasecmp(str_label.c_str(), "BORDER") == 0) - return DECOR_BORDER; + return FbWinFrame::DECOR_BORDER; if (strcasecmp(str_label.c_str(), "TAB") == 0) - return DECOR_TAB; + return FbWinFrame::DECOR_TAB; int mask = -1; if (str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x' || str_label.size() > 0 && isdigit(str_label[0]))

@@ -4158,7 +4159,7 @@ *

*/ setFocusHidden(true); setIconHidden(true); - setDecorationMask(DECOR_NONE); + setDecorationMask(FbWinFrame::DECOR_NONE); moveToLayer(::Layer::DOCK); break; case Focusable::TYPE_DESKTOP:

@@ -4171,7 +4172,7 @@ */

setFocusHidden(true); setIconHidden(true); moveToLayer(::Layer::DESKTOP); - setDecorationMask(DECOR_NONE); + setDecorationMask(FbWinFrame::DECOR_NONE); setTabable(false); setMovable(false); setResizable(false);

@@ -4183,7 +4184,7 @@ * _NET_WM_WINDOW_TYPE_SPLASH indicates that the

* window is a splash screen displayed as an application * is starting up. */ - setDecorationMask(DECOR_NONE); + setDecorationMask(FbWinFrame::DECOR_NONE); setFocusHidden(true); setIconHidden(true); setMovable(false);

@@ -4200,7 +4201,7 @@ * (i.e. toolbars and menus "torn off" from the main

* application). Windows of this type may set the * WM_TRANSIENT_FOR hint indicating the main application window. */ - setDecorationMask(DECOR_TOOL); + setDecorationMask(FbWinFrame::DECOR_TOOL); setIconHidden(true); moveToLayer(::Layer::ABOVE_DOCK); break;
M src/Window.hhsrc/Window.hh

@@ -110,34 +110,6 @@ MAX_HORZ = 1, ///< maximize horizontal

MAX_VERT = 2, ///< maximize vertical MAX_FULL = 3 ///< maximize full }; - /** - This enumeration represents individual decoration - attributes, they can be OR-d together to get a mask. - Useful for saving. - */ - enum DecorationMask { - DECORM_TITLEBAR = (1<<0), - DECORM_HANDLE = (1<<1), - DECORM_BORDER = (1<<2), - DECORM_ICONIFY = (1<<3), - DECORM_MAXIMIZE = (1<<4), - DECORM_CLOSE = (1<<5), - DECORM_MENU = (1<<6), - DECORM_STICKY = (1<<7), - DECORM_SHADE = (1<<8), - DECORM_TAB = (1<<9), - DECORM_ENABLED = (1<<10), - DECORM_LAST = (1<<11) // useful for getting "All" - }; - - enum Decoration { - DECOR_NONE = 0, - DECOR_NORMAL = DECORM_LAST - 1, - DECOR_TINY = DECORM_TITLEBAR|DECORM_ICONIFY|DECORM_MENU|DECORM_TAB, - DECOR_TOOL = DECORM_TITLEBAR|DECORM_MENU, - DECOR_BORDER = DECORM_BORDER|DECORM_MENU, - DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB - }; /// Different resize modes when resizing a window enum ResizeModel {