]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
add a -single argument which only runs on a single screen
[chaz/openbox] / src / client.cc
index 9234a18817060ebc524b6d0d28a3be5fdcf0ba4d..3b2a14387df3c88fee792e1674e21689d0ad2b45 100644 (file)
@@ -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;
 
@@ -1269,8 +1277,8 @@ void OBClient::reparentHandler(const XReparentEvent &e)
     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);
This page took 0.023002 seconds and 4 git commands to generate.