]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
code cleanup
[chaz/openbox] / openbox / client.c
index b061b8f6eee493517fa8f1502876765c6205c10f..17172dd99f37fb40b4597f24dad32ac4cbd9f0b2 100644 (file)
@@ -518,14 +518,6 @@ static void client_get_all(Client *self)
     client_update_icons(self);
     client_update_kwm_icon(self);
 
-    /* this makes sure that these windows appear on all desktops */
-    if (self->type == Type_Desktop)
-       self->desktop = DESKTOP_ALL;
-
-    /* set the desktop hint, to make sure that it always exists, and to
-       reflect any changes we've made here */
-    PROP_SET32(self->window, net_wm_desktop, cardinal, self->desktop);
-
     client_change_state(self);
 }
 
@@ -552,6 +544,9 @@ static void client_get_desktop(Client *self)
     } else {
        /* 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);
     }
 }
 
@@ -735,6 +730,10 @@ void client_get_type(Client *self)
        else
            self->type = Type_Normal;
     }
+
+    /* this makes sure that these windows appear on all desktops */
+    if (self->type == Type_Desktop)
+       self->desktop = DESKTOP_ALL;
 }
 
 void client_update_protocols(Client *self)
@@ -1015,6 +1014,7 @@ void client_update_wmhints(Client *self)
 {
     XWMHints *hints;
     gboolean ur = FALSE;
+    GSList *it;
 
     /* assume a window takes input if it doesnt specify */
     self->can_focus = TRUE;
@@ -1033,35 +1033,57 @@ void client_update_wmhints(Client *self)
            ur = TRUE;
 
        if (!(hints->flags & WindowGroupHint))
-            hints->window_group = None; /* no group */
+            hints->window_group = None;
+
         /* did the group state change? */
-        if (hints->window_group != (self->group ? self->group->leader : None)){
+        if (hints->window_group !=
+            (self->group ? self->group->leader : None)) {
             /* remove from the old group if there was one */
-            if (self->group != NULL)
+            if (self->group != NULL) {
+                /* remove transients of the group */
+                for (it = self->group->members; it; it = it->next)
+                    if (it->data != self &&
+                        ((Client*)it->data)->transient_for == TRAN_GROUP) {
+                        self->transients = g_slist_remove(self->transients,
+                                                          it->data);
+                    }
                 group_remove(self->group, self);
-            if (hints->window_group != None)
+                self->group = NULL;
+            }
+            if (hints->window_group != None) {
                 self->group = group_add(hints->window_group, self);
 
+                /* add other transients of the group that are already
+                   set up */
+                for (it = self->group->members; it; it = it->next)
+                    if (it->data != self &&
+                        ((Client*)it->data)->transient_for == TRAN_GROUP)
+                        self->transients = g_slist_append(self->transients,
+                                                          it->data);
+            }
+
             /* because the self->transient flag wont change from this call,
                we don't need to update the window's type and such, only its
-               transient_for, and the transients lists of other windows in the
-               group may be affected */
+               transient_for, and the transients lists of other windows in
+               the group may be affected */
             client_update_transient_for(self);
         }
 
-       if (hints->flags & IconPixmapHint) {
-           client_update_kwm_icon(self);
-           /* try get the kwm icon first, this is a fallback only */
-           if (self->pixmap_icon == None) {
-               self->pixmap_icon = hints->icon_pixmap;
-               if (hints->flags & IconMaskHint)
-                   self->pixmap_icon_mask = hints->icon_mask;
-               else
-                   self->pixmap_icon_mask = None;
-
-               if (self->frame)
-                   frame_adjust_icon(self->frame);
-           }
+        client_update_kwm_icon(self);
+        /* try get the kwm icon first, this is a fallback only */
+        if (self->pixmap_icon == None) {
+            if (hints->flags & IconPixmapHint) {
+                if (self->pixmap_icon == None) {
+                    self->pixmap_icon = hints->icon_pixmap;
+                    if (hints->flags & IconMaskHint)
+                        self->pixmap_icon_mask = hints->icon_mask;
+                    else
+                        self->pixmap_icon_mask = None;
+
+                    if (self->frame)
+                        frame_adjust_icon(self->frame);
+                }
+            }
        }
 
        XFree(hints);
@@ -1134,10 +1156,9 @@ void client_update_class(Client *self)
             if (data[1])
                 self->class = g_strdup(data[1]);
         }
+        g_strfreev(data);     
     }
 
-    g_strfreev(data);     
-
     if (PROP_GETS(self->window, wm_window_role, locale, &s))
        self->role = g_strdup(s);
 
@@ -1314,7 +1335,7 @@ void client_calc_layer(Client *self)
             for (it = self->group->members; it; it = it->next)
                 if (it->data != self &&
                     ((Client*)it->data)->transient_for != TRAN_GROUP) {
-                    self = self->transient_for;
+                    self = it->data;
                     break;
                 }
         }
@@ -1587,7 +1608,7 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea)
         x = y = w = h = 0;
     } else {
         guint num;
-       guint32 *dimensions;
+       gint32 *dimensions;
 
         /* pick some fallbacks... */
         x = screen_area(self->desktop)->x +
@@ -1598,7 +1619,7 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea)
         h = screen_area(self->desktop)->height / 2;
 
        if (PROP_GETA32(self->window, openbox_premax, cardinal,
-                        &dimensions, &num)) {
+                        (guint32**)&dimensions, &num)) {
             if (num == 4) {
                 x = dimensions[0];
                 y = dimensions[1];
This page took 0.023952 seconds and 4 git commands to generate.