]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
less wasted updates of wm_state
[chaz/openbox] / openbox / client.c
index 569718c333287925aaf6dccf0637de378bc5e082..3abbb7b5f18793fa0e86b04bfe8a3d94553cbe6d 100644 (file)
@@ -268,7 +268,7 @@ void client_manage(Window window)
 
     /* non-zero defaults */
     self->title_count = 1;
-    self->wmstate = NormalState;
+    self->wmstate = WithdrawnState; /* make sure it gets updated first time */
     self->layer = -1;
     self->desktop = screen_num_desktops; /* always an invalid value */
     self->user_time = ~0; /* maximum value, always newer than the real time */
@@ -639,7 +639,7 @@ static ObAppSettings *client_get_settings_state(ObClient *self)
     GSList *it;
 
     for (it = config_per_app_settings; it; it = g_slist_next(it)) {
-        ObAppSettings *app;
+        ObAppSettings *app = it->data;
         
         if ((app->name && !app->class && !strcmp(app->name, self->name))
             || (app->class && !app->name && !strcmp(app->class, self->class))
@@ -1956,8 +1956,6 @@ static void client_change_state(ObClient *self)
     gulong netstate[11];
     guint num;
 
-    client_change_wm_state(self);
-
     num = 0;
     if (self->modal)
         netstate[num++] = prop_atoms.net_wm_state_modal;
@@ -2121,9 +2119,14 @@ void client_showhide(ObClient *self)
         if (!self->frame->visible)
             frame_show(self->frame);
     }
-    else if (self->frame->visible)
+    else if (self->frame->visible) {
         frame_hide(self->frame);
 
+        /* Fall back focus since we're disappearing */
+        if (focus_client == self)
+            client_unfocus(self);
+    }
+
     /* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it
        needs to be in IconicState. This includes when it is on another
        desktop!
@@ -2505,10 +2508,6 @@ static void client_iconify_recursive(ObClient *self,
                    bottom'. */
                 focus_order_to_top(self);
 
-                /* Fall back focus since we're disappearing */
-                if (focus_client == self)
-                    client_unfocus(self);
-
                 changed = TRUE;
             }
         } else {
@@ -2632,6 +2631,7 @@ void client_shade(ObClient *self, gboolean shade)
 
     self->shaded = shade;
     client_change_state(self);
+    client_change_wm_state(self); /* the window is being hidden/shown */
     /* resize the frame to just the titlebar */
     frame_adjust_area(self->frame, FALSE, FALSE, FALSE);
 }
This page took 0.023024 seconds and 4 git commands to generate.