]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
use frame->visible, not the desktop number, other states exist too, like show_desktop
[chaz/openbox] / openbox / client.c
index 75a3bc251c729b214c4021df5ad9e6770d3e81ef..c7739fdd19b129ca56f9813df86562faa6ade6fd 100644 (file)
@@ -14,6 +14,7 @@
 #include "openbox.h"
 #include "group.h"
 #include "config.h"
+#include "menu.h"
 #include "render/render.h"
 
 #include <glib.h>
@@ -311,6 +312,13 @@ void client_unmanage_all()
        client_unmanage(client_list->data);
 }
 
+/* called by client_unmanage() to close any menus referencing this client */
+void client_close_menus(gpointer key, gpointer value, gpointer self)
+{
+    if (((Menu *)value)->client == (Client *)self)
+        menu_hide((Menu *)value);
+}
+
 void client_unmanage(Client *self)
 {
     int j;
@@ -364,6 +372,10 @@ void client_unmanage(Client *self)
     if (moveresize_client == self)
         moveresize_end(TRUE);
 
+    /* close any windows that are attached to this window */
+    g_hash_table_foreach(menu_hash, client_close_menus, self);
+
+    
     if (focus_client == self) {
         XEvent e;
 
@@ -2013,7 +2025,7 @@ void client_set_desktop(Client *self, guint target, gboolean donthide)
 
     if (target == self->desktop) return;
   
-    g_message("Setting desktop %u", target);
+    g_message("Setting desktop %u", target+1);
 
     g_assert(target < screen_num_desktops || target == DESKTOP_ALL);
 
@@ -2205,7 +2217,7 @@ void client_set_state(Client *self, Atom action, long data1, long data2)
     if (shaded != self->shaded)
        client_shade(self, shaded);
     client_calc_layer(self);
-    client_change_state(self); /* change the hint to relect these changes */
+    client_change_state(self); /* change the hint to reflect these changes */
 }
 
 Client *client_focus_target(Client *self)
@@ -2225,7 +2237,7 @@ gboolean client_focus(Client *self)
     /* choose the correct target */
     self = client_focus_target(self);
 
-    if (self->desktop != DESKTOP_ALL && self->desktop != screen_desktop) {
+    if (!self->frame->visible) {
         /* update the focus lists */
         focus_order_to_top(self);
         return FALSE;
@@ -2439,3 +2451,18 @@ Client *client_find_directional(Client *c, Direction dir)
 
     return best_client;
 }
+
+void client_set_layer(Client *self, int layer)
+{
+    if (layer < 0) {
+        self->below = TRUE;
+        self->above = FALSE;
+    } else if (layer == 0) {
+        self->below = self->above = FALSE;
+    } else {
+        self->below = FALSE;
+        self->above = TRUE;
+    }
+    client_calc_layer(self);
+    client_change_state(self); /* reflect this in the state hints */
+}
This page took 0.021543 seconds and 4 git commands to generate.