]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
can tell when a window that was "closed" has stopped responding now
[chaz/openbox] / openbox / client.c
index 1e2040fd077b1cd13cb17f0b0e615cee64ddc06e..0f592ebe72df9595c79d22840252039f124cf171 100644 (file)
@@ -450,6 +450,8 @@ void client_manage(Window window)
     g_free(monitor);
     monitor = NULL;
 
+    ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s\n",
+                  activate ? "yes" : "no");
     if (activate) {
         gboolean raise = FALSE;
 
@@ -760,6 +762,11 @@ void client_unmanage(ObClient *self)
         XMapWindow(ob_display, self->window);
     }
 
+    /* these should not be left on the window ever.  other window managers
+       don't necessarily use them and it will mess them up (like compiz) */
+    PROP_ERASE(self->window, net_wm_visible_name);
+    PROP_ERASE(self->window, net_wm_visible_icon_name);
+
     /* update the list hints */
     client_set_list();
 
@@ -1500,6 +1507,10 @@ void client_update_protocols(ObClient *self)
                 /* if this protocol is requested, then the window will be
                    notified whenever we want it to receive focus */
                 self->focus_notify = TRUE;
+            else if (proto[i] == prop_atoms.net_wm_ping)
+                /* if this protocol is requested, then the window will allow
+                   pings to determine if it is still alive */
+                self->ping = TRUE;
 #ifdef SYNC
             else if (proto[i] == prop_atoms.net_wm_sync_request)
                 /* if this protocol is requested, then resizing the
@@ -3155,10 +3166,16 @@ void client_shade(ObClient *self, gboolean shade)
     frame_adjust_area(self->frame, FALSE, TRUE, FALSE);
 }
 
-void client_close(ObClient *self)
+static void client_ping_event(ObClient *self, gboolean dead)
 {
-    XEvent ce;
+    if (dead)
+        ob_debug("client 0x%x window 0x%x is not responding !!\n");
+    else
+        ob_debug("client 0x%x window 0x%x started responding again..\n");
+}
 
+void client_close(ObClient *self)
+{
     if (!(self->functions & OB_CLIENT_FUNC_CLOSE)) return;
 
     /* in the case that the client provides no means to requesting that it
@@ -3174,17 +3191,11 @@ void client_close(ObClient *self)
       explicitly killed.
     */
 
-    ce.xclient.type = ClientMessage;
-    ce.xclient.message_type =  prop_atoms.wm_protocols;
-    ce.xclient.display = ob_display;
-    ce.xclient.window = self->window;
-    ce.xclient.format = 32;
-    ce.xclient.data.l[0] = prop_atoms.wm_delete_window;
-    ce.xclient.data.l[1] = event_curtime;
-    ce.xclient.data.l[2] = 0l;
-    ce.xclient.data.l[3] = 0l;
-    ce.xclient.data.l[4] = 0l;
-    XSendEvent(ob_display, self->window, FALSE, NoEventMask, &ce);
+    PROP_MSG_TO(self->window, self->window, wm_protocols,
+                prop_atoms.wm_delete_window, event_curtime, 0, 0, 0,
+                NoEventMask);
+
+    ping_start(self, client_ping_event);
 }
 
 void client_kill(ObClient *self)
This page took 0.022616 seconds and 4 git commands to generate.