X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fclient.cc;h=3b2a14387df3c88fee792e1674e21689d0ad2b45;hb=368d981208c7f7d7865faac129160f277eb8d4e7;hp=320fe4d76810524e15cfbc0e9ba95f6fd6b05298;hpb=13f1f39f013b00425310859aa7fbe0f779c0f168;p=chaz%2Fopenbox diff --git a/src/client.cc b/src/client.cc index 320fe4d7..3b2a1438 100644 --- a/src/client.cc +++ b/src/client.cc @@ -754,6 +754,7 @@ void OBClient::setState(StateAction action, long data1, long data2) _above = true; } else if (state == property->atom(otk::OBProperty::net_wm_state_below)) { + printf("Setting below\n"); if (_below) continue; _below = true; } @@ -897,7 +898,11 @@ void OBClient::clientMessageHandler(const XClientMessageEvent &e) } else if (e.message_type == property->atom(otk::OBProperty::net_wm_state)) { // can't compress these #ifdef DEBUG - printf("net_wm_state for 0x%lx\n", _window); + printf("below=%ld above=%ld\n", property->atom(otk::OBProperty::net_wm_state_below), property->atom(otk::OBProperty::net_wm_state_above)); + printf("net_wm_state %s %ld %ld for 0x%lx\n", + (e.data.l[0] == 0 ? "Remove" : e.data.l[0] == 1 ? "Add" : + e.data.l[0] == 2 ? "Toggle" : "INVALID"), + e.data.l[1], e.data.l[2], _window); #endif setState((StateAction)e.data.l[0], e.data.l[1], e.data.l[2]); } else if (e.message_type == @@ -1082,9 +1087,12 @@ void OBClient::shade(bool shade) } -bool OBClient::focus() +bool OBClient::focus() const { - if (!(_can_focus || _focus_notify)) return false; + // won't try focus if the client doesn't want it, or if the window isn't + // visible on the screen + if (!(frame->isVisible() && (_can_focus || _focus_notify))) return false; + if (_focused) return true; if (_can_focus) @@ -1112,7 +1120,7 @@ bool OBClient::focus() } -void OBClient::unfocus() +void OBClient::unfocus() const { if (!_focused) return; @@ -1219,15 +1227,18 @@ void OBClient::configureRequestHandler(const XConfigureRequestEvent &e) void OBClient::unmapHandler(const XUnmapEvent &e) { + if (ignore_unmaps) { #ifdef DEBUG - printf("UnmapNotify for 0x%lx\n", e.window); + printf("Ignored UnmapNotify for 0x%lx (event 0x%lx)\n", e.window, e.event); #endif // DEBUG - - if (ignore_unmaps) { ignore_unmaps--; return; } +#ifdef DEBUG + printf("UnmapNotify for 0x%lx\n", e.window); +#endif // DEBUG + OtkEventHandler::unmapHandler(e); // this deletes us etc @@ -1266,6 +1277,12 @@ void OBClient::reparentHandler(const XReparentEvent &e) to an already unmapped window. */ + // we don't want the reparent event, put it back on the stack for the X + // server to deal with after we unmanage the window + XEvent ev; + ev.xreparent = e; + XPutBackEvent(otk::OBDisplay::display, &ev); + // this deletes us etc Openbox::instance->screen(_screen)->unmanageWindow(this); }