diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 118 |
1 files changed, 30 insertions, 88 deletions
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; |