]> Dogcows Code - chaz/openbox/blobdiff - openbox/frame.c
no pointless using of the comma operator
[chaz/openbox] / openbox / frame.c
index 51de9321c550f98f234c4747424e1385f76df5a3..124ffc051f85d60444b5802fa80e34d1471cd874 100644 (file)
@@ -31,9 +31,9 @@
 #include "screen.h"
 #include "render/theme.h"
 
-#define PLATE_EVENTMASK (SubstructureRedirectMask | FocusChangeMask)
 #define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \
-                         ButtonPressMask | ButtonReleaseMask)
+                         ButtonPressMask | ButtonReleaseMask | \
+                         SubstructureRedirectMask | FocusChangeMask)
 #define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \
                            ButtonMotionMask | PointerMotionMask | \
                            EnterWindowMask | LeaveWindowMask)
@@ -95,7 +95,7 @@ ObFrame *frame_new(ObClient *client)
 
     /* create the non-visible decor windows */
 
-    mask = CWEventMask;
+    mask = 0;
     if (visual) {
         /* client has a 32-bit visual */
         mask |= CWColormap | CWBackPixel | CWBorderPixel;
@@ -107,21 +107,22 @@ ObFrame *frame_new(ObClient *client)
         attrib.background_pixel = BlackPixel(ob_display, ob_screen);
         attrib.border_pixel = BlackPixel(ob_display, ob_screen);
     }
-    attrib.event_mask = FRAME_EVENTMASK;
     self->window = createWindow(RootWindow(ob_display, ob_screen), visual,
                                 mask, &attrib);
 
-    mask &= ~CWEventMask;
-    self->plate = createWindow(self->window, visual, mask, &attrib);
-
     /* create the visible decor windows */
 
-    mask = CWEventMask;
+    mask = 0;
     if (visual) {
         /* client has a 32-bit visual */
         mask |= CWColormap | CWBackPixel | CWBorderPixel;
         attrib.colormap = RrColormap(ob_rr_inst);
     }
+
+    self->backback = createWindow(self->window, NULL, mask, &attrib);
+    self->backfront = createWindow(self->backback, NULL, mask, &attrib);
+
+    mask |= CWEventMask;
     attrib.event_mask = ELEMENT_EVENTMASK;
     self->title = createWindow(self->window, NULL, mask, &attrib);
     self->titleleft = createWindow(self->window, NULL, mask, &attrib);
@@ -172,8 +173,9 @@ ObFrame *frame_new(ObClient *client)
     self->focused = FALSE;
 
     /* the other stuff is shown based on decor settings */
-    XMapWindow(ob_display, self->plate);
     XMapWindow(ob_display, self->label);
+    XMapWindow(ob_display, self->backback);
+    XMapWindow(ob_display, self->backfront);
 
     self->max_press = self->close_press = self->desk_press = 
         self->iconify_press = self->shade_press = FALSE;
@@ -710,14 +712,14 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
             } else
                 XUnmapWindow(ob_display, self->right);
 
-            /* move the plate */
-            XMoveWindow(ob_display, self->plate,
-                        self->size.left, self->size.top);
+            XMoveResizeWindow(ob_display, self->backback,
+                              self->size.left, self->size.top,
+                              self->client->area.width,
+                              self->client->area.height);
 
             /* when the client has StaticGravity, it likes to move around. */
             XMoveWindow(ob_display, self->client->window,
-                        -self->client->border_width,
-                        -self->client->border_width);
+                        self->size.left, self->size.top);
         }
     }
 
@@ -838,9 +840,10 @@ static void frame_adjust_cursors(ObFrame *self)
 
 void frame_adjust_client_area(ObFrame *self)
 {
-    /* resize the plate */
-    XResizeWindow(ob_display, self->plate,
-                  self->client->area.width, self->client->area.height);
+    /* adjust the window which is there to prevent flashing on unmap */
+    XMoveResizeWindow(ob_display, self->backfront, 0, 0,
+                      self->client->area.width,
+                      self->client->area.height);
 }
 
 void frame_adjust_state(ObFrame *self)
@@ -873,8 +876,7 @@ void frame_grab_client(ObFrame *self)
     */
 
     /* reparent the client to the frame */
-    XReparentWindow(ob_display, self->client->window, self->plate,
-                    -self->client->border_width, -self->client->border_width);
+    XReparentWindow(ob_display, self->client->window, self->window, 0, 0);
 
     /*
       When reparenting the client window, it is usually not mapped yet, since
@@ -887,11 +889,12 @@ void frame_grab_client(ObFrame *self)
 
     /* select the event mask on the client's parent (to receive config/map
        req's) the ButtonPress is to catch clicks on the client border */
-    XSelectInput(ob_display, self->plate, PLATE_EVENTMASK);
+    XSelectInput(ob_display, self->window, FRAME_EVENTMASK);
 
     /* set all the windows for the frame in the window_map */
     g_hash_table_insert(window_map, &self->window, self->client);
-    g_hash_table_insert(window_map, &self->plate, self->client);
+    g_hash_table_insert(window_map, &self->backback, self->client);
+    g_hash_table_insert(window_map, &self->backfront, self->client);
     g_hash_table_insert(window_map, &self->innerleft, self->client);
     g_hash_table_insert(window_map, &self->innertop, self->client);
     g_hash_table_insert(window_map, &self->innerright, self->client);
@@ -952,7 +955,7 @@ void frame_release_client(ObFrame *self)
            Reparent events that are generated by us are just discarded here.
            They are of no consequence to us anyhow.
         */
-        if (ev.xreparent.parent != self->plate) {
+        if (ev.xreparent.parent != self->window) {
             reparent = FALSE;
             XPutBackEvent(ob_display, &ev);
             break;
@@ -970,7 +973,8 @@ void frame_release_client(ObFrame *self)
 
     /* remove all the windows for the frame from the window_map */
     g_hash_table_remove(window_map, &self->window);
-    g_hash_table_remove(window_map, &self->plate);
+    g_hash_table_remove(window_map, &self->backback);
+    g_hash_table_remove(window_map, &self->backfront);
     g_hash_table_remove(window_map, &self->innerleft);
     g_hash_table_remove(window_map, &self->innertop);
     g_hash_table_remove(window_map, &self->innerright);
@@ -1250,13 +1254,6 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y)
     }
 
     self = client->frame;
-    if (win == self->plate) {
-        /* conceptually, this is the desktop, as far as users are
-           concerned */
-        if (client->type == OB_CLIENT_TYPE_DESKTOP)
-            return OB_FRAME_CONTEXT_DESKTOP;
-        return OB_FRAME_CONTEXT_CLIENT;
-    }
 
     /* when the user clicks in the corners of the titlebar and the client
        is fully maximized, then treat it like they clicked in the
This page took 0.02769 seconds and 4 git commands to generate.