X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fclient.cc;h=cdcbfbcc14bb1d8d7f5416d276c20c3ae811a60b;hb=3814c4fbebb1f3e5e489225a0280d6a1958d1543;hp=d38ca79b0e39a613618b83e8215d17eedc5fdf38;hpb=6062fe404ce5f2505494132d5454370d696625ca;p=chaz%2Fopenbox diff --git a/src/client.cc b/src/client.cc index d38ca79b..cdcbfbcc 100644 --- a/src/client.cc +++ b/src/client.cc @@ -897,7 +897,10 @@ 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("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 +1085,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 +1118,7 @@ bool OBClient::focus() } -void OBClient::unfocus() +void OBClient::unfocus() const { if (!_focused) return; @@ -1269,6 +1275,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); }