diff options
author | markt <markt> | 2007-11-05 17:05:58 (GMT) |
---|---|---|
committer | markt <markt> | 2007-11-05 17:05:58 (GMT) |
commit | 97f7c3e1b59b9a94e36a78d97c141f6a05f43e20 (patch) | |
tree | 982ba8f35083fb54e5058f564ec8e301d8a229dc /src/Window.cc | |
parent | 2c4e1f9a024433396f17ea5f3ef3fda46e0d8edd (diff) | |
download | fluxbox_pavel-97f7c3e1b59b9a94e36a78d97c141f6a05f43e20.zip fluxbox_pavel-97f7c3e1b59b9a94e36a78d97c141f6a05f43e20.tar.bz2 |
various refactoring and minor changes
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 116 |
1 files changed, 82 insertions, 34 deletions
diff --git a/src/Window.cc b/src/Window.cc index 5d9404d..898111d 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -453,6 +453,8 @@ void FluxboxWindow::init() { | |||
453 | wattrib.width, wattrib.height, | 453 | wattrib.width, wattrib.height, |
454 | m_client->gravity(), m_client->old_bw); | 454 | m_client->gravity(), m_client->old_bw); |
455 | 455 | ||
456 | setWindowType(m_client->getWindowType()); | ||
457 | |||
456 | if (fluxbox.isStartup()) | 458 | if (fluxbox.isStartup()) |
457 | m_placed = true; | 459 | m_placed = true; |
458 | else if (m_client->isTransient() || | 460 | else if (m_client->isTransient() || |
@@ -1021,7 +1023,6 @@ void FluxboxWindow::associateClientWindow(bool use_attrs, | |||
1021 | unsigned int width, unsigned int height, | 1023 | unsigned int width, unsigned int height, |
1022 | int gravity, unsigned int client_bw) { | 1024 | int gravity, unsigned int client_bw) { |
1023 | m_client->updateTitle(); | 1025 | m_client->updateTitle(); |
1024 | m_client->updateIconTitle(); | ||
1025 | 1026 | ||
1026 | frame().setShapingClient(m_client, false); | 1027 | frame().setShapingClient(m_client, false); |
1027 | 1028 | ||
@@ -1353,26 +1354,7 @@ bool FluxboxWindow::focus() { | |||
1353 | if (m_client->isModal()) | 1354 | if (m_client->isModal()) |
1354 | return false; | 1355 | return false; |
1355 | 1356 | ||
1356 | bool ret = false; | 1357 | return m_client->sendFocus(); |
1357 | |||
1358 | if (m_client->acceptsFocus()) { | ||
1359 | |||
1360 | m_client->setInputFocus(RevertToParent, CurrentTime); | ||
1361 | |||
1362 | FbTk::App *app = FbTk::App::instance(); | ||
1363 | |||
1364 | XFlush(app->display()); | ||
1365 | |||
1366 | m_client->sendFocus(); | ||
1367 | |||
1368 | app->sync(false); | ||
1369 | |||
1370 | ret = true; | ||
1371 | } else { | ||
1372 | ret = m_client->sendFocus(); | ||
1373 | } | ||
1374 | |||
1375 | return ret; | ||
1376 | } | 1358 | } |
1377 | 1359 | ||
1378 | // don't hide the frame directly, use this function | 1360 | // don't hide the frame directly, use this function |
@@ -2129,14 +2111,6 @@ void FluxboxWindow::restoreAttributes() { | |||
2129 | m_layernum = m_blackbox_attrib.stack; | 2111 | m_layernum = m_blackbox_attrib.stack; |
2130 | } | 2112 | } |
2131 | 2113 | ||
2132 | if ((m_blackbox_attrib.flags & ATTRIB_MAXHORIZ) || | ||
2133 | (m_blackbox_attrib.flags & ATTRIB_MAXVERT)) { | ||
2134 | m_blackbox_attrib.premax_x = m_blackbox_attrib.premax_x; | ||
2135 | m_blackbox_attrib.premax_y = m_blackbox_attrib.premax_y; | ||
2136 | m_blackbox_attrib.premax_w = m_blackbox_attrib.premax_w; | ||
2137 | m_blackbox_attrib.premax_h = m_blackbox_attrib.premax_h; | ||
2138 | } | ||
2139 | |||
2140 | } | 2114 | } |
2141 | 2115 | ||
2142 | /** | 2116 | /** |
@@ -2369,8 +2343,9 @@ void FluxboxWindow::propertyNotifyEvent(WinClient &client, Atom atom) { | |||
2369 | break; | 2343 | break; |
2370 | 2344 | ||
2371 | case XA_WM_ICON_NAME: | 2345 | case XA_WM_ICON_NAME: |
2372 | // update icon title and then do normal XA_WM_NAME stuff | 2346 | // we don't use icon title, since many apps don't update it, |
2373 | client.updateIconTitle(); | 2347 | // and we don't show icons anyway |
2348 | break; | ||
2374 | case XA_WM_NAME: | 2349 | case XA_WM_NAME: |
2375 | client.updateTitle(); | 2350 | client.updateTitle(); |
2376 | break; | 2351 | break; |
@@ -2610,7 +2585,7 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { | |||
2610 | frame().buttonPressEvent(be); | 2585 | frame().buttonPressEvent(be); |
2611 | 2586 | ||
2612 | if (be.button == 1) { | 2587 | if (be.button == 1) { |
2613 | if (!m_focused) //check focus | 2588 | if (!m_focused && acceptsFocus()) //check focus |
2614 | focus(); | 2589 | focus(); |
2615 | 2590 | ||
2616 | if (frame().window().window() == be.window || frame().tabcontainer().window() == be.window) { | 2591 | if (frame().window().window() == be.window || frame().tabcontainer().window() == be.window) { |
@@ -2968,7 +2943,8 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) { | |||
2968 | ev.window == m_client->window() || | 2943 | ev.window == m_client->window() || |
2969 | client) { | 2944 | client) { |
2970 | 2945 | ||
2971 | if (screen().focusControl().isMouseFocus() && !isFocused()) { | 2946 | if (screen().focusControl().isMouseFocus() && !isFocused() && |
2947 | acceptsFocus() && getWindowType() != Focusable::TYPE_DESKTOP) { | ||
2972 | 2948 | ||
2973 | // check that there aren't any subsequent leave notify events in the | 2949 | // check that there aren't any subsequent leave notify events in the |
2974 | // X event queue | 2950 | // X event queue |
@@ -3138,7 +3114,6 @@ void FluxboxWindow::startMoving(int x, int y) { | |||
3138 | m_button_grab_y = y - frame().y() - frame().window().borderWidth(); | 3114 | m_button_grab_y = y - frame().y() - frame().window().borderWidth(); |
3139 | 3115 | ||
3140 | moving = true; | 3116 | moving = true; |
3141 | maximized = MAX_NONE; | ||
3142 | 3117 | ||
3143 | Fluxbox *fluxbox = Fluxbox::instance(); | 3118 | Fluxbox *fluxbox = Fluxbox::instance(); |
3144 | // grabbing (and masking) on the root window allows us to | 3119 | // grabbing (and masking) on the root window allows us to |
@@ -3674,6 +3649,10 @@ std::string FluxboxWindow::getWMRole() const { | |||
3674 | return (m_client ? m_client->getWMRole() : "FluxboxWindow"); | 3649 | return (m_client ? m_client->getWMRole() : "FluxboxWindow"); |
3675 | } | 3650 | } |
3676 | 3651 | ||
3652 | Focusable::WindowType FluxboxWindow::getWindowType() const { | ||
3653 | return (m_client ? m_client->getWindowType() : Focusable::TYPE_NORMAL); | ||
3654 | } | ||
3655 | |||
3677 | bool FluxboxWindow::isTransient() const { | 3656 | bool FluxboxWindow::isTransient() const { |
3678 | return (m_client && m_client->isTransient()); | 3657 | return (m_client && m_client->isTransient()); |
3679 | } | 3658 | } |
@@ -4139,3 +4118,72 @@ void FluxboxWindow::placeWindow(int head) { | |||
4139 | screen().placementStrategy().placeWindow(*this, head, place_x, place_y); | 4118 | screen().placementStrategy().placeWindow(*this, head, place_x, place_y); |
4140 | move(place_x, place_y); | 4119 | move(place_x, place_y); |
4141 | } | 4120 | } |
4121 | |||
4122 | void FluxboxWindow::setWindowType(Focusable::WindowType type) { | ||
4123 | switch (type) { | ||
4124 | case Focusable::TYPE_DOCK: | ||
4125 | /* From Extended Window Manager Hints, draft 1.3: | ||
4126 | * | ||
4127 | * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature. | ||
4128 | * Typically a Window Manager would keep such windows on top | ||
4129 | * of all other windows. | ||
4130 | * | ||
4131 | */ | ||
4132 | setFocusHidden(true); | ||
4133 | setIconHidden(true); | ||
4134 | setDecorationMask(DECOR_NONE); | ||
4135 | moveToLayer(::Layer::DOCK); | ||
4136 | break; | ||
4137 | case Focusable::TYPE_DESKTOP: | ||
4138 | /* | ||
4139 | * _NET_WM_WINDOW_TYPE_DESKTOP indicates a "false desktop" window | ||
4140 | * We let it be the size it wants, but it gets no decoration, | ||
4141 | * is hidden in the toolbar and window cycling list, plus | ||
4142 | * windows don't tab with it and is right on the bottom. | ||
4143 | */ | ||
4144 | setFocusHidden(true); | ||
4145 | setIconHidden(true); | ||
4146 | moveToLayer(::Layer::DESKTOP); | ||
4147 | setDecorationMask(DECOR_NONE); | ||
4148 | setTabable(false); | ||
4149 | setMovable(false); | ||
4150 | setResizable(false); | ||
4151 | stick(); | ||
4152 | break; | ||
4153 | case Focusable::TYPE_SPLASH: | ||
4154 | /* | ||
4155 | * _NET_WM_WINDOW_TYPE_SPLASH indicates that the | ||
4156 | * window is a splash screen displayed as an application | ||
4157 | * is starting up. | ||
4158 | */ | ||
4159 | setDecorationMask(DECOR_NONE); | ||
4160 | setFocusHidden(true); | ||
4161 | setIconHidden(true); | ||
4162 | setMovable(false); | ||
4163 | break; | ||
4164 | case Focusable::TYPE_DIALOG: | ||
4165 | setTabable(false); | ||
4166 | break; | ||
4167 | case Focusable::TYPE_MENU: | ||
4168 | case Focusable::TYPE_TOOLBAR: | ||
4169 | /* | ||
4170 | * _NET_WM_WINDOW_TYPE_TOOLBAR and _NET_WM_WINDOW_TYPE_MENU | ||
4171 | * indicate toolbar and pinnable menu windows, respectively | ||
4172 | * (i.e. toolbars and menus "torn off" from the main | ||
4173 | * application). Windows of this type may set the | ||
4174 | * WM_TRANSIENT_FOR hint indicating the main application window. | ||
4175 | */ | ||
4176 | setDecorationMask(DECOR_TOOL); | ||
4177 | setIconHidden(true); | ||
4178 | moveToLayer(::Layer::ABOVE_DOCK); | ||
4179 | break; | ||
4180 | case Focusable::TYPE_NORMAL: | ||
4181 | default: | ||
4182 | break; | ||
4183 | } | ||
4184 | |||
4185 | /* | ||
4186 | * NOT YET IMPLEMENTED: | ||
4187 | * _NET_WM_WINDOW_TYPE_UTILITY | ||
4188 | */ | ||
4189 | } | ||