]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
set the desktop hint when the window already has a hint but its out of range
[chaz/openbox] / openbox / client.c
index 35e0e58ad7481d30f0e6a10108992315c4b1332b..08c22a75082c4da5209986f5b4062b96b39e0cf4 100644 (file)
@@ -290,11 +290,11 @@ void client_manage(Window window)
 
     screen_update_struts();
 
+    dispatch_client(Event_Client_New, self, 0, 0);
+
     /* make sure the window is visible */
     client_move_onscreen(self);
 
-    dispatch_client(Event_Client_New, self, 0, 0);
-
     client_showhide(self);
 
     if (activate) client_activate(self);
@@ -587,12 +587,13 @@ static void client_get_area(Client *self)
 
 static void client_get_desktop(Client *self)
 {
-    guint32 d;
+    guint32 d = screen_num_desktops; /* an always-invalid value */
 
     if (PROP_GET32(self->window, net_wm_desktop, cardinal, &d)) {
        if (d >= screen_num_desktops && d != DESKTOP_ALL)
-           d = screen_num_desktops - 1;
-       self->desktop = d;
+           self->desktop = screen_num_desktops - 1;
+        else
+            self->desktop = d;
     } else { 
         gboolean trdesk = FALSE;
 
@@ -616,6 +617,8 @@ static void client_get_desktop(Client *self)
            /* defaults to the current desktop */
            self->desktop = screen_desktop;
 
+    }
+    if (self->desktop != d) {
         /* set the desktop hint, to make sure that it always exists */
         PROP_SET32(self->window, net_wm_desktop, cardinal, self->desktop);
     }
@@ -1027,10 +1030,7 @@ void client_setup_decor_and_functions(Client *self)
         if (self->type == Type_Desktop && self->desktop != DESKTOP_ALL)
             client_set_desktop(self, DESKTOP_ALL, FALSE);
 
-       /* change the decors on the frame, and with more/less decorations,
-           we may also need to be repositioned */
-       frame_adjust_area(self->frame, TRUE, TRUE);
-       /* with new decor, the window's maximized size may change */
+       /* adjust the client's decorations, etc. */
        client_reconfigure(self);
     } else {
         /* this makes sure that these windows appear on all desktops */
@@ -1091,8 +1091,11 @@ static void client_change_allowed_actions(Client *self)
 
 void client_reconfigure(Client *self)
 {
+    /* by making this pass FALSE for user, we avoid the emacs event storm where
+       every configurenotify causes an update in its normal hints, i think this
+       is generally what we want anyways... */
     client_configure(self, Corner_TopLeft, self->area.x, self->area.y,
-                     self->area.width, self->area.height, TRUE, TRUE);
+                     self->area.width, self->area.height, FALSE, TRUE);
 }
 
 void client_update_wmhints(Client *self)
@@ -1504,8 +1507,11 @@ static void calc_recursive(Client *self, Client *orig, StackLayer l,
         calc_recursive(it->data, orig, l, raised ? raised : l != old);
 
     if (!raised && l != old)
-       if (orig->frame) /* only restack if the original window is managed */
-           stacking_raise(CLIENT_AS_WINDOW(self));
+       if (orig->frame) { /* only restack if the original window is managed */
+            /* XXX add_non_intrusive ever? */
+            stacking_remove(CLIENT_AS_WINDOW(self));
+            stacking_add(CLIENT_AS_WINDOW(self));
+        }
 }
 
 void client_calc_layer(Client *self)
@@ -1772,6 +1778,9 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
 
     /* move/resize the frame to match the request */
     if (self->frame) {
+        if (self->decorations != self->frame->decorations)
+            moved = resized = TRUE;
+
         if (moved || resized)
             frame_adjust_area(self->frame, moved, resized);
 
@@ -1797,7 +1806,6 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
             event.xconfigure.override_redirect = FALSE;
             XSendEvent(event.xconfigure.display, event.xconfigure.window,
                        FALSE, StructureNotifyMask, &event);
-            g_message ("SENT CONFIG");
        }
     }
 }
This page took 0.022745 seconds and 4 git commands to generate.