]> Dogcows Code - chaz/openbox/commitdiff
have the clientpadding color show during resize, and no flashing on unmap. we win !
authorDana Jansens <danakj@orodu.net>
Mon, 28 May 2007 22:46:28 +0000 (22:46 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 28 May 2007 22:46:28 +0000 (22:46 +0000)
openbox/client.c
openbox/frame.c
openbox/frame.h
openbox/framerender.c

index 84cd01c02273c9be0f16a1d9f2314265da240426..48f5d2a9c86bf69ff5a866a45604ce6aad4b3e3c 100644 (file)
@@ -361,6 +361,7 @@ void client_manage(Window window)
     /* adjust the frame to the client's size before showing or placing
        the window */
     frame_adjust_area(self->frame, FALSE, TRUE, FALSE);
+    frame_adjust_client_area(self->frame);
 
     /* where the frame was placed is where the window was originally */
     placex = self->area.x;
@@ -2864,6 +2865,8 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gint b,
         XConfigureWindow(ob_display, self->window,
                          CWX|CWY|CWWidth|CWHeight|CWBorderWidth,
                          &changes);
+
+        frame_adjust_client_area(self->frame);
     }
 
     /* find the frame's dimensions and move/resize it */
@@ -2915,17 +2918,18 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gint b,
 
     /* if the client is shrinking, then resize the frame before the client */
     if (send_resize_client && (w <= oldw && h <= oldh)) {
-        if (send_resize_client) {
-            XWindowChanges changes;
-            changes.x = self->frame->size.left - self->border_width;
-            changes.y = self->frame->size.top -self->border_width;
-            changes.width = w;
-            changes.height = h;
-            changes.border_width = self->border_width;
-            XConfigureWindow(ob_display, self->window,
-                             CWX|CWY|CWWidth|CWHeight|CWBorderWidth,
-                             &changes);
-        }
+        XWindowChanges changes;
+
+        frame_adjust_client_area(self->frame);
+
+        changes.x = self->frame->size.left - self->border_width;
+        changes.y = self->frame->size.top -self->border_width;
+        changes.width = w;
+        changes.height = h;
+        changes.border_width = self->border_width;
+        XConfigureWindow(ob_display, self->window,
+                         CWX|CWY|CWWidth|CWHeight|CWBorderWidth,
+                         &changes);
     }
 
     XFlush(ob_display);
index 687ecbbe78ba8672d26c64b09403b35ca5338e97..38511108e10218bcf50bf37a3ba7ad4fc710aff3 100644 (file)
@@ -112,12 +112,17 @@ ObFrame *frame_new(ObClient *client)
 
     /* 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);
@@ -169,6 +174,8 @@ ObFrame *frame_new(ObClient *client)
 
     /* the other stuff is shown based on decor settings */
     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;
@@ -705,6 +712,11 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
             } else
                 XUnmapWindow(ob_display, self->right);
 
+            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->size.left - self->client->border_width,
@@ -827,6 +839,14 @@ static void frame_adjust_cursors(ObFrame *self)
     }
 }
 
+void frame_adjust_client_area(ObFrame *self)
+{
+    /* 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)
 {
     framerender_frame(self);
@@ -874,6 +894,8 @@ void frame_grab_client(ObFrame *self)
 
     /* 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->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,6 +974,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->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);
index 97a9e3ffa378e602b2a1c6abe0044b1b8a02dc7c..af0da97582da0a5f8a80eca1e59250d5c14c9658 100644 (file)
@@ -120,6 +120,9 @@ struct _ObFrame
     Window    innertop;     /*!< For drawing the inner client border */
     Window    innerright;   /*!< For drawing the inner client border */
     Window    innerbottom;  /*!< For drawing the inner client border */
+    Window    backback;     /*!< A colored window shown while resizing */
+    Window    backfront;    /*!< An undrawn-in window, to prevent flashing on
+                                 unmap */
 
     /* These are resize handles inside the titlebar */
     Window    topresize;
@@ -202,6 +205,7 @@ void frame_adjust_theme(ObFrame *self);
 void frame_adjust_shape(ObFrame *self);
 void frame_adjust_area(ObFrame *self, gboolean moved,
                        gboolean resized, gboolean fake);
+void frame_adjust_client_area(ObFrame *self);
 void frame_adjust_state(ObFrame *self);
 void frame_adjust_focus(ObFrame *self, gboolean hilite);
 void frame_adjust_title(ObFrame *self);
index 3a5267a779e1c2adff17f17e7e30a207987b3fc5..b86f469227a6fe332d6621c2bc7cfd1ec3a04aec 100644 (file)
@@ -41,6 +41,8 @@ void framerender_frame(ObFrame *self)
               RrColorPixel(ob_rr_theme->cb_focused_color) :
               RrColorPixel(ob_rr_theme->cb_unfocused_color));
 
+        XSetWindowBackground(ob_display, self->backback, px);
+        XClearWindow(ob_display, self->backback);
         XSetWindowBackground(ob_display, self->innerleft, px);
         XClearWindow(ob_display, self->innerleft);
         XSetWindowBackground(ob_display, self->innertop, px);
This page took 0.031061 seconds and 4 git commands to generate.