diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Ewmh.cc | 6 | ||||
-rw-r--r-- | src/Window.cc | 118 | ||||
-rw-r--r-- | src/Window.hh | 20 | ||||
-rw-r--r-- | src/main.cc | 6 |
4 files changed, 47 insertions, 103 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc index be4e81a..9764998 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc | |||
@@ -276,7 +276,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) { | |||
276 | win.setFocusHidden(true); | 276 | win.setFocusHidden(true); |
277 | win.setIconHidden(true); | 277 | win.setIconHidden(true); |
278 | win.moveToLayer(Layer::DESKTOP); | 278 | win.moveToLayer(Layer::DESKTOP); |
279 | win.setDecorationMask(0); | 279 | win.setDecorationMask(FluxboxWindow::DECOR_NONE); |
280 | win.setTabable(false); | 280 | win.setTabable(false); |
281 | win.setMovable(false); | 281 | win.setMovable(false); |
282 | win.setResizable(false); | 282 | win.setResizable(false); |
@@ -288,7 +288,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) { | |||
288 | * window is a splash screen displayed as an application | 288 | * window is a splash screen displayed as an application |
289 | * is starting up. | 289 | * is starting up. |
290 | */ | 290 | */ |
291 | win.setDecoration(FluxboxWindow::DECOR_NONE); | 291 | win.setDecorationMask(FluxboxWindow::DECOR_NONE); |
292 | win.setFocusHidden(true); | 292 | win.setFocusHidden(true); |
293 | win.setIconHidden(true); | 293 | win.setIconHidden(true); |
294 | win.setMovable(false); | 294 | win.setMovable(false); |
@@ -306,7 +306,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) { | |||
306 | * application). Windows of this type may set the | 306 | * application). Windows of this type may set the |
307 | * WM_TRANSIENT_FOR hint indicating the main application window. | 307 | * WM_TRANSIENT_FOR hint indicating the main application window. |
308 | */ | 308 | */ |
309 | win.setDecoration(FluxboxWindow::DECOR_NONE); | 309 | win.setDecorationMask(FluxboxWindow::DECOR_NONE); |
310 | win.setIconHidden(true); | 310 | win.setIconHidden(true); |
311 | win.moveToLayer(Layer::ABOVE_DOCK); | 311 | win.moveToLayer(Layer::ABOVE_DOCK); |
312 | } | 312 | } |
diff --git a/src/Window.cc b/src/Window.cc index b4c0463..4c701a4 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -254,7 +254,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, | |||
254 | m_last_resize_h(1), m_last_resize_w(1), | 254 | m_last_resize_h(1), m_last_resize_w(1), |
255 | m_workspace_number(0), | 255 | m_workspace_number(0), |
256 | m_current_state(0), | 256 | m_current_state(0), |
257 | m_old_decoration(DECOR_NORMAL), | ||
258 | m_old_decoration_mask(0), | 257 | m_old_decoration_mask(0), |
259 | m_client(&client), | 258 | m_client(&client), |
260 | m_toggled_decos(false), | 259 | m_toggled_decos(false), |
@@ -1558,8 +1557,10 @@ void FluxboxWindow::setFullscreen(bool flag) { | |||
1558 | 1557 | ||
1559 | frame().setUseShape(false); | 1558 | frame().setUseShape(false); |
1560 | 1559 | ||
1561 | m_old_decoration_mask = decorationMask(); | 1560 | if (!m_toggled_decos) |
1562 | m_old_layernum =layerNum(); | 1561 | m_old_decoration_mask = decorationMask(); |
1562 | |||
1563 | m_old_layernum = layerNum(); | ||
1563 | m_old_pos_x = frame().x(); | 1564 | m_old_pos_x = frame().x(); |
1564 | m_old_pos_y = frame().y(); | 1565 | m_old_pos_y = frame().y(); |
1565 | m_old_width = frame().width(); | 1566 | m_old_width = frame().width(); |
@@ -1590,8 +1591,14 @@ void FluxboxWindow::setFullscreen(bool flag) { | |||
1590 | 1591 | ||
1591 | fullscreen = false; | 1592 | fullscreen = false; |
1592 | 1593 | ||
1593 | setDecorationMask(m_old_decoration_mask); | ||
1594 | frame().setUseShape(!m_shaped); | 1594 | frame().setUseShape(!m_shaped); |
1595 | if (m_toggled_decos) { | ||
1596 | if (m_old_decoration_mask & DECORM_TITLEBAR) | ||
1597 | setDecorationMask(DECOR_NONE); | ||
1598 | else | ||
1599 | setDecorationMask(DECOR_NORMAL); | ||
1600 | } else | ||
1601 | setDecorationMask(m_old_decoration_mask); | ||
1595 | 1602 | ||
1596 | // ensure we apply the sizehints here, otherwise some | 1603 | // ensure we apply the sizehints here, otherwise some |
1597 | // apps (eg xterm) end up a little bit .. crappy (visually) | 1604 | // apps (eg xterm) end up a little bit .. crappy (visually) |
@@ -1605,7 +1612,6 @@ void FluxboxWindow::setFullscreen(bool flag) { | |||
1605 | moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h); | 1612 | moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h); |
1606 | moveToLayer(m_old_layernum); | 1613 | moveToLayer(m_old_layernum); |
1607 | 1614 | ||
1608 | m_old_decoration_mask = 0; | ||
1609 | m_old_layernum = ::Layer::NORMAL; | 1615 | m_old_layernum = ::Layer::NORMAL; |
1610 | 1616 | ||
1611 | stateSig().notify(); | 1617 | stateSig().notify(); |
@@ -3013,61 +3019,6 @@ void FluxboxWindow::leaveNotifyEvent(XCrossingEvent &ev) { | |||
3013 | //installColormap(false); | 3019 | //installColormap(false); |
3014 | } | 3020 | } |
3015 | 3021 | ||
3016 | // TODO: functions should not be affected by decoration | ||
3017 | void FluxboxWindow::setDecoration(Decoration decoration, bool apply) { | ||
3018 | switch (decoration) { | ||
3019 | case DECOR_NONE: | ||
3020 | decorations.titlebar = decorations.border = decorations.handle = | ||
3021 | decorations.iconify = decorations.maximize = | ||
3022 | decorations.tab = false; //tab is also a decor | ||
3023 | decorations.menu = true; // menu is present | ||
3024 | // functions.iconify = functions.maximize = true; | ||
3025 | // functions.move = true; // We need to move even without decor | ||
3026 | // functions.resize = true; // We need to resize even without decor | ||
3027 | break; | ||
3028 | |||
3029 | default: | ||
3030 | case DECOR_NORMAL: | ||
3031 | decorations.titlebar = decorations.border = decorations.handle = | ||
3032 | decorations.iconify = decorations.maximize = | ||
3033 | decorations.menu = decorations.tab = true; | ||
3034 | functions.resize = functions.move = functions.iconify = | ||
3035 | functions.maximize = true; | ||
3036 | break; | ||
3037 | |||
3038 | case DECOR_TAB: | ||
3039 | decorations.border = decorations.iconify = decorations.maximize = | ||
3040 | decorations.menu = decorations.tab = true; | ||
3041 | decorations.titlebar = decorations.handle = false; | ||
3042 | functions.resize = functions.move = functions.iconify = | ||
3043 | functions.maximize = true; | ||
3044 | break; | ||
3045 | |||
3046 | case DECOR_TINY: | ||
3047 | decorations.titlebar = decorations.iconify = decorations.menu = | ||
3048 | functions.move = functions.iconify = decorations.tab = true; | ||
3049 | decorations.border = decorations.handle = decorations.maximize = | ||
3050 | functions.resize = functions.maximize = false; | ||
3051 | break; | ||
3052 | |||
3053 | case DECOR_TOOL: | ||
3054 | decorations.titlebar = decorations.tab = decorations.menu = functions.move = true; | ||
3055 | decorations.iconify = decorations.border = decorations.handle = | ||
3056 | decorations.maximize = functions.resize = functions.maximize = | ||
3057 | functions.iconify = false; | ||
3058 | break; | ||
3059 | } | ||
3060 | |||
3061 | // we might want to wait with apply decorations | ||
3062 | if (apply) | ||
3063 | applyDecorations(); | ||
3064 | |||
3065 | //!! TODO: make sure this is correct | ||
3066 | // is this reconfigure necessary??? | ||
3067 | // reconfigure(); | ||
3068 | |||
3069 | } | ||
3070 | |||
3071 | // commit current decoration values to actual displayed things | 3022 | // commit current decoration values to actual displayed things |
3072 | void FluxboxWindow::applyDecorations(bool initial) { | 3023 | void FluxboxWindow::applyDecorations(bool initial) { |
3073 | frame().clientArea().setBorderWidth(0); // client area bordered by other things | 3024 | frame().clientArea().setBorderWidth(0); // client area bordered by other things |
@@ -3135,22 +3086,20 @@ void FluxboxWindow::applyDecorations(bool initial) { | |||
3135 | 3086 | ||
3136 | void FluxboxWindow::toggleDecoration() { | 3087 | void FluxboxWindow::toggleDecoration() { |
3137 | //don't toggle decor if the window is shaded | 3088 | //don't toggle decor if the window is shaded |
3138 | if (isShaded()) | 3089 | if (isShaded() || isFullscreen()) |
3139 | return; | 3090 | return; |
3140 | 3091 | ||
3141 | m_toggled_decos= true; | 3092 | m_toggled_decos = !m_toggled_decos; |
3093 | |||
3094 | if (m_toggled_decos) { | ||
3095 | m_old_decoration_mask = decorationMask(); | ||
3096 | if (decorations.titlebar) | ||
3097 | setDecorationMask(DECOR_NONE); | ||
3098 | else | ||
3099 | setDecorationMask(DECOR_NORMAL); | ||
3100 | } else //revert back to old decoration | ||
3101 | setDecorationMask(m_old_decoration_mask); | ||
3142 | 3102 | ||
3143 | if (decorations.enabled) { //remove decorations | ||
3144 | decorations.enabled = false; | ||
3145 | setDecoration(DECOR_NONE); | ||
3146 | } else { //revert back to old decoration | ||
3147 | decorations.enabled = true; | ||
3148 | if (m_old_decoration == DECOR_NONE) { // make sure something happens | ||
3149 | setDecoration(DECOR_NORMAL); | ||
3150 | } else { | ||
3151 | setDecoration(m_old_decoration); | ||
3152 | } | ||
3153 | } | ||
3154 | } | 3103 | } |
3155 | 3104 | ||
3156 | unsigned int FluxboxWindow::decorationMask() const { | 3105 | unsigned int FluxboxWindow::decorationMask() const { |
@@ -3354,7 +3303,7 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { | |||
3354 | // we only care about the left/top etc that includes borders | 3303 | // we only care about the left/top etc that includes borders |
3355 | int borderW = 0; | 3304 | int borderW = 0; |
3356 | 3305 | ||
3357 | if (decorationMask() & (DECORM_ENABLED|DECORM_BORDER|DECORM_HANDLE)) | 3306 | if (decorationMask() & (DECORM_BORDER|DECORM_HANDLE)) |
3358 | borderW = frame().window().borderWidth(); | 3307 | borderW = frame().window().borderWidth(); |
3359 | 3308 | ||
3360 | int top = orig_top; // orig include the borders | 3309 | int top = orig_top; // orig include the borders |
@@ -3426,7 +3375,7 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { | |||
3426 | if ((*it) == this) | 3375 | if ((*it) == this) |
3427 | continue; // skip myself | 3376 | continue; // skip myself |
3428 | 3377 | ||
3429 | bw = (*it)->decorationMask() & (DECORM_ENABLED|DECORM_BORDER|DECORM_HANDLE) ? | 3378 | bw = (*it)->decorationMask() & (DECORM_BORDER|DECORM_HANDLE) ? |
3430 | (*it)->frame().window().borderWidth() : 0; | 3379 | (*it)->frame().window().borderWidth() : 0; |
3431 | 3380 | ||
3432 | snapToWindow(dx, dy, left, right, top, bottom, | 3381 | snapToWindow(dx, dy, left, right, top, bottom, |
@@ -4135,24 +4084,17 @@ void FluxboxWindow::associateClient(WinClient &client) { | |||
4135 | 4084 | ||
4136 | int FluxboxWindow::getDecoMaskFromString(const string &str_label) { | 4085 | int FluxboxWindow::getDecoMaskFromString(const string &str_label) { |
4137 | if (strcasecmp(str_label.c_str(), "NONE") == 0) | 4086 | if (strcasecmp(str_label.c_str(), "NONE") == 0) |
4138 | return 0; | 4087 | return DECOR_NONE; |
4139 | if (strcasecmp(str_label.c_str(), "NORMAL") == 0) | 4088 | if (strcasecmp(str_label.c_str(), "NORMAL") == 0) |
4140 | return FluxboxWindow::DECORM_LAST - 1; | 4089 | return DECOR_NORMAL; |
4141 | if (strcasecmp(str_label.c_str(), "TINY") == 0) | 4090 | if (strcasecmp(str_label.c_str(), "TINY") == 0) |
4142 | return FluxboxWindow::DECORM_TITLEBAR | 4091 | return DECOR_TINY; |
4143 | | FluxboxWindow::DECORM_ICONIFY | ||
4144 | | FluxboxWindow::DECORM_MENU | ||
4145 | | FluxboxWindow::DECORM_TAB; | ||
4146 | if (strcasecmp(str_label.c_str(), "TOOL") == 0) | 4092 | if (strcasecmp(str_label.c_str(), "TOOL") == 0) |
4147 | return FluxboxWindow::DECORM_TITLEBAR | 4093 | return DECOR_TOOL; |
4148 | | FluxboxWindow::DECORM_MENU; | ||
4149 | if (strcasecmp(str_label.c_str(), "BORDER") == 0) | 4094 | if (strcasecmp(str_label.c_str(), "BORDER") == 0) |
4150 | return FluxboxWindow::DECORM_BORDER | 4095 | return DECOR_BORDER; |
4151 | | FluxboxWindow::DECORM_MENU; | ||
4152 | if (strcasecmp(str_label.c_str(), "TAB") == 0) | 4096 | if (strcasecmp(str_label.c_str(), "TAB") == 0) |
4153 | return FluxboxWindow::DECORM_BORDER | 4097 | return DECOR_TAB; |
4154 | | FluxboxWindow::DECORM_MENU | ||
4155 | | FluxboxWindow::DECORM_TAB; | ||
4156 | unsigned int mask = atoi(str_label.c_str()); | 4098 | unsigned int mask = atoi(str_label.c_str()); |
4157 | if (mask) | 4099 | if (mask) |
4158 | return mask; | 4100 | return mask; |
diff --git a/src/Window.hh b/src/Window.hh index 29d6054..d72c3fa 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -60,15 +60,6 @@ class Menu; | |||
60 | /// Creates the window frame and handles any window event for it | 60 | /// Creates the window frame and handles any window event for it |
61 | class FluxboxWindow: public Focusable, public FbTk::EventHandler { | 61 | class FluxboxWindow: public Focusable, public FbTk::EventHandler { |
62 | public: | 62 | public: |
63 | /// Represents certain "preset" sets of decorations. | ||
64 | enum Decoration { | ||
65 | DECOR_NONE=0, ///< no decor at all | ||
66 | DECOR_NORMAL, ///< normal normal | ||
67 | DECOR_TINY, ///< tiny decoration | ||
68 | DECOR_TOOL, ///< decor tool | ||
69 | DECOR_TAB ///< decor tab (border + tab) | ||
70 | }; | ||
71 | |||
72 | /// Motif wm Hints | 63 | /// Motif wm Hints |
73 | enum { | 64 | enum { |
74 | MwmHintsFunctions = (1l << 0), ///< use motif wm functions | 65 | MwmHintsFunctions = (1l << 0), ///< use motif wm functions |
@@ -137,6 +128,15 @@ public: | |||
137 | DECORM_LAST = (1<<11) // useful for getting "All" | 128 | DECORM_LAST = (1<<11) // useful for getting "All" |
138 | }; | 129 | }; |
139 | 130 | ||
131 | enum Decoration { | ||
132 | DECOR_NONE = 0, | ||
133 | DECOR_NORMAL = DECORM_LAST - 1, | ||
134 | DECOR_TINY = DECORM_TITLEBAR|DECORM_ICONIFY|DECORM_MENU|DECORM_TAB, | ||
135 | DECOR_TOOL = DECORM_TITLEBAR|DECORM_MENU, | ||
136 | DECOR_BORDER = DECORM_BORDER|DECORM_MENU, | ||
137 | DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB | ||
138 | }; | ||
139 | |||
140 | /** | 140 | /** |
141 | * Resize direction while resizing | 141 | * Resize direction while resizing |
142 | */ | 142 | */ |
@@ -346,7 +346,6 @@ public: | |||
346 | void leaveNotifyEvent(XCrossingEvent &ev); | 346 | void leaveNotifyEvent(XCrossingEvent &ev); |
347 | //@} | 347 | //@} |
348 | 348 | ||
349 | void setDecoration(Decoration decoration, bool apply = true); | ||
350 | void applyDecorations(bool initial = false); | 349 | void applyDecorations(bool initial = false); |
351 | void toggleDecoration(); | 350 | void toggleDecoration(); |
352 | 351 | ||
@@ -581,7 +580,6 @@ private: | |||
581 | unsigned int m_workspace_number; | 580 | unsigned int m_workspace_number; |
582 | unsigned long m_current_state; // NormalState | IconicState | Withdrawn | 581 | unsigned long m_current_state; // NormalState | IconicState | Withdrawn |
583 | 582 | ||
584 | Decoration m_old_decoration; | ||
585 | unsigned int m_old_decoration_mask; | 583 | unsigned int m_old_decoration_mask; |
586 | 584 | ||
587 | ClientList m_clientlist; | 585 | ClientList m_clientlist; |
diff --git a/src/main.cc b/src/main.cc index 643c6a4..2d1ff0d 100644 --- a/src/main.cc +++ b/src/main.cc | |||
@@ -321,9 +321,13 @@ int main(int argc, char **argv) { | |||
321 | FbTk::FbStringUtil::shutdown(); | 321 | FbTk::FbStringUtil::shutdown(); |
322 | 322 | ||
323 | if (restarting) { | 323 | if (restarting) { |
324 | const char *shell = getenv("SHELL"); | ||
325 | if (!shell) | ||
326 | shell = "/bin/sh"; | ||
327 | |||
324 | const char *arg = restart_argument.c_str(); | 328 | const char *arg = restart_argument.c_str(); |
325 | if (arg) { | 329 | if (arg) { |
326 | execlp(arg, arg, (char *) NULL); | 330 | execlp(shell, shell, "-c", arg, (char *) NULL); |
327 | perror(arg); | 331 | perror(arg); |
328 | } | 332 | } |
329 | 333 | ||