]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
simple cleanups for the client_iconify function.
[chaz/openbox] / openbox / client.c
index 7b7872b37d7a0f8ea5b51093565f92ee6be18901..4b65b0d02a439b78f52fe509d43588c592823c04 100644 (file)
@@ -238,7 +238,7 @@ void client_manage(Window window)
     dispatch_client(Event_Client_Mapped, self, 0, 0);
 
     /* focus the new window? */
-    if (ob_state != State_Starting) {
+    if (ob_state != State_Starting && client_normal(self)) {
         if (config_focus_new)
             client_focus(self);
         else if (self->transient_for) {
@@ -927,6 +927,12 @@ void client_setup_decor_and_functions(Client *self)
     if (!(self->decorations & Decor_Titlebar))
        self->functions &= ~Func_Shade;
 
+    /* now we need to check against rules for the client's current state */
+    if (self->fullscreen) {
+       self->functions &= (Func_Close | Func_Fullscreen | Func_Iconify);
+       self->decorations = 0;
+    }
+
     client_change_allowed_actions(self);
 
     if (self->frame) {
@@ -1297,27 +1303,10 @@ static Client *search_focus_tree(Client *node, Client *skip)
 void client_calc_layer(Client *self)
 {
     StackLayer l;
-    gboolean fs;
-    Client *c;
-
-    /* are we fullscreen, or do we have a fullscreen transient parent? */
-    c = self;
-    fs = FALSE;
-    while (c && c != TRAN_GROUP) { /* XXX do smthng with the TRAN_GROUP case?*/
-       if (c->fullscreen) {
-           fs = TRUE;
-           break;
-       }
-       c = c->transient_for;
-    }
-    if (!fs && self->fullscreen) {
-       /* is one of our transients focused? */
-       c = search_focus_tree(self, self);
-       if (c != NULL) fs = TRUE;
-    }
-  
+
     if (self->iconic) l = Layer_Icon;
-    else if (fs) l = Layer_Fullscreen;
+    /* fullscreen windows are only in the fullscreen layer while focused */
+    else if (self->fullscreen && focus_client == self) l = Layer_Fullscreen;
     else if (self->type == Type_Desktop) l = Layer_Desktop;
     else if (self->type == Type_Dock) {
        if (!self->below) l = Layer_Top;
@@ -1413,6 +1402,7 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
        y = 0;
        w = screen_physical_size.width;
        h = screen_physical_size.height;
+        user = FALSE; /* ignore that increment etc shit when in fullscreen */
     } else {
         /* set the size and position if maximized */
         if (self->max_horz) {
@@ -1560,13 +1550,6 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea)
     client_change_state(self); /* change the state hints on the client */
 
     if (fs) {
-       /* save the functions and remove them */
-       self->pre_fs_func = self->functions;
-       self->functions &= (Func_Close | Func_Fullscreen |
-                           Func_Iconify);
-       /* save the decorations and remove them */
-       self->pre_fs_decor = self->decorations;
-       self->decorations = 0;
        if (savearea) {
            long dimensions[4];
            dimensions[0] = self->area.x;
@@ -1584,9 +1567,6 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea)
     } else {
        long *dimensions;
 
-       self->functions = self->pre_fs_func;
-       self->decorations = self->pre_fs_decor;
-         
        if (PROP_GET32A(self->window, openbox_premax, cardinal,
                        dimensions, 4)) {
            x = dimensions[0];
@@ -1605,11 +1585,9 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea)
        }
     }
 
-    client_change_allowed_actions(self); /* based on the new _functions */
+    client_setup_decor_and_functions(self);
 
-    /* when fullscreening, don't obey things like increments, fill the
-       screen */
-    client_configure(self, Corner_TopLeft, x, y, w, h, !fs, TRUE);
+    client_configure(self, Corner_TopLeft, x, y, w, h, TRUE, TRUE);
 
     /* raise (back) into our stacking layer */
     stacking_raise(self);
@@ -1620,6 +1598,8 @@ void client_fullscreen(Client *self, gboolean fs, gboolean savearea)
 
 void client_iconify(Client *self, gboolean iconic, gboolean curdesk)
 {
+    GSList *it;
+
     /* move up the transient chain as far as possible first if deiconifying */
     if (!iconic)
         while (self->transient_for) {
@@ -1637,8 +1617,7 @@ void client_iconify(Client *self, gboolean iconic, gboolean curdesk)
                     Client *c = it->data;
 
                     if (c != self && c->transient_for->iconic != iconic &&
-                        (c->transient_for != TRAN_GROUP ||
-                         c->group != self->group)) {
+                        c->transient_for != TRAN_GROUP) {
                         self = it->data;
                         break;
                     }
@@ -1674,12 +1653,8 @@ void client_iconify(Client *self, gboolean iconic, gboolean curdesk)
                     self, 0, 0);
 
     /* iconify all transients */
-    if (self->transients) {
-        GSList *it;
-
-        for (it = self->transients; it != NULL; it = it->next)
-            if (it->data != self) client_iconify(it->data, iconic, curdesk);
-    }
+    for (it = self->transients; it != NULL; it = it->next)
+        if (it->data != self) client_iconify(it->data, iconic, curdesk);
 }
 
 void client_maximize(Client *self, gboolean max, int dir, gboolean savearea)
This page took 0.025153 seconds and 4 git commands to generate.