]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
change what re-maprequest events do, just convert them to net_active_window messages...
[chaz/openbox] / src / client.cc
index 320fe4d76810524e15cfbc0e9ba95f6fd6b05298..07bf6f0b7c4bef5b89cc2e1309efb7ac0ca9ad8c 100644 (file)
@@ -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 ==
@@ -911,6 +914,9 @@ void OBClient::clientMessageHandler(const XClientMessageEvent &e)
 #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
   }
@@ -1025,7 +1031,7 @@ void OBClient::close()
   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);
 }
 
 
@@ -1082,9 +1088,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 +1121,7 @@ bool OBClient::focus()
 }
 
 
-void OBClient::unfocus()
+void OBClient::unfocus() const
 {
   if (!_focused) return;
 
@@ -1219,15 +1228,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 +1278,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);
 }
This page took 0.022271 seconds and 4 git commands to generate.