]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
unmap and map the client window when the frame is hidden/shown
[chaz/openbox] / openbox / client.c
index fab5328d2b712a40fd85354974d5f40db920c5e8..78af988fcefb15ffc12d7d36f47cbc40f2b8c2e8 100644 (file)
@@ -493,10 +493,9 @@ void client_unmanage(ObClient *self)
         PROP_ERASE(self->window, net_wm_state);
         PROP_ERASE(self->window, wm_state);
     } else {
-        /* if we're left in an iconic state, the client wont be mapped. this is
-           bad, since we will no longer be managing the window on restart */
-        if (self->iconic)
-            XMapWindow(ob_display, self->window);
+        /* if we're left in an unmapped state, the client wont be mapped. this
+           is bad, since we will no longer be managing the window on restart */
+        XMapWindow(ob_display, self->window);
     }
 
 
@@ -849,6 +848,37 @@ static void client_get_state(ObClient *self)
 
         g_free(state);
     }
+
+    if (!(self->above || self->below)) {
+        if (self->group) {
+            /* apply stuff from the group */
+            GSList *it;
+            gint layer = -2;
+
+            for (it = self->group->members; it; it = g_slist_next(it)) {
+                ObClient *c = it->data;
+                if (c != self && !client_search_transient(self, c))
+                {
+                    layer = MAX(layer,
+                                (c->above ? 1 : (c->below ? -1 : 0)));
+                }
+            }
+            switch (layer) {
+            case -1:
+                self->below = TRUE;
+                break;
+            case -2:
+            case 0:
+                break;
+            case 1:
+                self->above = TRUE;
+                break;
+            default:
+                g_assert_not_reached();
+                break;
+            }
+        }
+    }
 }
 
 static void client_get_shaped(ObClient *self)
@@ -1065,6 +1095,9 @@ void client_update_normal_hints(ObClient *self)
 
     /* get the hints from the window */
     if (XGetWMNormalHints(ob_display, self->window, &size, &ret)) {
+        /* normal windows can't request placement! har har
+        if (!client_normal(self))
+        */
         self->positioned = !!(size.flags & (PPosition|USPosition));
 
         if (size.flags & PWinGravity) {
@@ -1507,10 +1540,19 @@ void client_update_strut(ObClient *self)
     if (!got &&
         PROP_GETA32(self->window, net_wm_strut, cardinal, &data, &num)) {
         if (num == 4) {
+            const Rect *a;
+
             got = TRUE;
+
+            /* use the screen's width/height */
+            a = screen_physical_area();
+
             STRUT_PARTIAL_SET(strut,
                               data[0], data[2], data[1], data[3],
-                              0, 0, 0, 0, 0, 0, 0, 0);
+                              a->y, a->y + a->height - 1,
+                              a->x, a->x + a->width - 1,
+                              a->y, a->y + a->height - 1,
+                              a->x, a->x + a->width - 1);
         }
         g_free(data);
     }
@@ -1765,12 +1807,31 @@ void client_calc_layer(ObClient *self)
 
 gboolean client_should_show(ObClient *self)
 {
-    if (self->iconic) return FALSE;
-    else if (!(self->desktop == screen_desktop ||
-               self->desktop == DESKTOP_ALL)) return FALSE;
-    else if (client_normal(self) && screen_showing_desktop) return FALSE;
+    if (self->iconic)
+        return FALSE;
+    if (client_normal(self) && screen_showing_desktop)
+        return FALSE;
+    /*
+    if (self->transient_for) {
+        if (self->transient_for != OB_TRAN_GROUP)
+            return client_should_show(self->transient_for);
+        else {
+            GSList *it;
+
+            for (it = self->group->members; it; it = g_slist_next(it)) {
+                ObClient *c = it->data;
+                if (c != self && !c->transient_for) {
+                    if (client_should_show(c))
+                        return TRUE;
+                }
+            }
+        }
+    }
+    */
+    if (self->desktop == screen_desktop || self->desktop == DESKTOP_ALL)
+        return TRUE;
     
-    return TRUE;
+    return FALSE;
 }
 
 static void client_showhide(ObClient *self)
@@ -2141,11 +2202,6 @@ static void client_iconify_recursive(ObClient *self,
                     PROP_MSG(self->window, kde_wm_change_state,
                              self->wmstate, 1, 0, 0);
 
-                self->ignore_unmaps++;
-                /* we unmap the client itself so that we can get MapRequest
-                   events, and because the ICCCM tells us to! */
-                XUnmapWindow(ob_display, self->window);
-
                 /* update the focus lists.. iconic windows go to the bottom of
                    the list, put the new iconic window at the 'top of the
                    bottom'. */
@@ -2165,8 +2221,6 @@ static void client_iconify_recursive(ObClient *self,
                 PROP_MSG(self->window, kde_wm_change_state,
                          self->wmstate, 1, 0, 0);
 
-            XMapWindow(ob_display, self->window);
-
             /* this puts it after the current focused window */
             focus_order_remove(self);
             focus_order_add_new(self);
This page took 0.023094 seconds and 4 git commands to generate.