} 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 ==
#ifdef DEBUG
printf("net_active_window for 0x%lx\n", _window);
#endif
+ if (_shaded)
+ shade(false);
+ // XXX: deiconify
focus();
Openbox::instance->screen(_screen)->restack(true, this); // raise
}
ce.xclient.data.l[2] = 0l;
ce.xclient.data.l[3] = 0l;
ce.xclient.data.l[4] = 0l;
- XSendEvent(otk::OBDisplay::display, _window, False, NoEventMask, &ce);
+ XSendEvent(otk::OBDisplay::display, _window, false, NoEventMask, &ce);
}
}
-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)
}
-void OBClient::unfocus()
+void OBClient::unfocus() const
{
if (!_focused) return;
to an already unmapped window.
*/
- // put another copy of this event on the stack (for the frame reparent
- // process)
+ // 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);