]> Dogcows Code - chaz/openbox/commitdiff
a) put transient windows on the same desktop as their parent
authorDana Jansens <danakj@orodu.net>
Thu, 17 Apr 2003 18:21:19 +0000 (18:21 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 17 Apr 2003 18:21:19 +0000 (18:21 +0000)
b) if a window is attempted to be focused but it is not on the current desktop,
   then move it to the top of the focus order on its desktop

openbox/client.c

index 17172dd99f37fb40b4597f24dad32ac4cbd9f0b2..4d3010dc23d6a8ab9cf218c30cd4eb1a58266e75 100644 (file)
@@ -492,11 +492,12 @@ static void client_get_all(Client *self)
     self->nicons = 0;
 
     client_get_area(self);
+    client_update_transient_for(self);
+    client_update_wmhints(self);
     client_get_desktop(self);
     client_get_state(self);
     client_get_shaped(self);
 
-    client_update_transient_for(self);
     client_get_mwm_hints(self);
     client_get_type(self);/* this can change the mwmhints for special cases */
 
@@ -510,7 +511,6 @@ static void client_get_all(Client *self)
        (min/max sizes), so we're ready to set up the decorations/functions */
     client_setup_decor_and_functions(self);
   
-    client_update_wmhints(self);
     client_update_title(self);
     client_update_icon_title(self);
     client_update_class(self);
@@ -541,9 +541,28 @@ static void client_get_desktop(Client *self)
        if (d >= screen_num_desktops && d != DESKTOP_ALL)
            d = screen_num_desktops - 1;
        self->desktop = d;
-    } else {
-       /* defaults to the current desktop */
-       self->desktop = screen_desktop;
+    } else { 
+        gboolean trdesk = FALSE;
+
+       if (self->transient_for) {
+           if (self->transient_for != TRAN_GROUP) {
+                self->desktop = self->transient_for->desktop;
+                trdesk = TRUE;
+            } else {
+                GSList *it;
+
+                for (it = self->group->members; it; it = it->next)
+                    if (it->data != self &&
+                        ((Client*)it->data)->transient_for != TRAN_GROUP) {
+                        self->desktop = ((Client*)it->data)->desktop;
+                        trdesk = TRUE;
+                        break;
+                    }
+            }
+       }
+       if (!trdesk)
+           /* defaults to the current desktop */
+           self->desktop = screen_desktop;
 
         /* set the desktop hint, to make sure that it always exists */
         PROP_SET32(self->window, net_wm_desktop, cardinal, self->desktop);
@@ -2086,10 +2105,26 @@ gboolean client_focusable(Client *self)
 gboolean client_focus(Client *self)
 {
     XEvent ev;
+    guint i;
 
     /* choose the correct target */
     self = client_focus_target(self);
 
+    if (self->desktop != DESKTOP_ALL && self->desktop != screen_desktop) {
+        /* update the focus lists */
+        if (self->desktop == DESKTOP_ALL) {
+            for (i = 0; i < screen_num_desktops; ++i) {
+                focus_order[i] = g_list_remove(focus_order[i], self);
+                focus_order[i] = g_list_prepend(focus_order[i], self);
+            }
+        } else {
+            i = self->desktop;
+            focus_order[i] = g_list_remove(focus_order[i], self);
+            focus_order[i] = g_list_prepend(focus_order[i], self);
+        }
+        return FALSE;
+    }
+
     if (!client_focusable(self))
        return FALSE;
 
This page took 0.029376 seconds and 4 git commands to generate.