]> Dogcows Code - chaz/openbox/blobdiff - openbox/frame.c
only end the interactive action if it's the action you just ran
[chaz/openbox] / openbox / frame.c
index d88074c6aaf8dca3a7189529a093333c1841f495..c53d51d9a76576ff3ff1f762a623792660beff81 100644 (file)
@@ -51,6 +51,7 @@ static void layout_title(ObFrame *self);
 static void set_theme_statics(ObFrame *self);
 static void free_theme_statics(ObFrame *self);
 static gboolean frame_animate_iconify(gpointer self);
+static void frame_adjust_shape(ObFrame *self);
 static void frame_adjust_cursors(ObFrame *self);
 static void frame_get_offscreen_buffer(ObFrame *self);
 static void frame_free_offscreen_buffer(ObFrame *self);
@@ -312,11 +313,6 @@ void frame_adjust_shape(ObFrame *self)
                                 ShapeBounding, 0, 0, xrect, num,
                                 ShapeUnion, Unsorted);
     }
-
-    if (self->pixmap)
-        XShapeCombineShape(ob_display, self->pixmap, ShapeBounding,
-                           0, 0, self->window, ShapeBounding, ShapeSet);
-
 #endif
 }
 
@@ -368,7 +364,8 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                   self->cbwidth_l + (!self->max_horz ? self->bwidth : 0),
                   self->cbwidth_t + self->bwidth,
                   self->cbwidth_r + (!self->max_horz ? self->bwidth : 0),
-                  self->cbwidth_b + (!self->max_horz || !self->max_vert ? self->bwidth : 0));
+                  self->cbwidth_b + (!self->max_horz || !self->max_vert ?
+                                     self->bwidth : 0));
 
         if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
             self->size.top += ob_rr_theme->title_height + self->bwidth;
@@ -758,9 +755,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
            frame_client_gravity. */
         self->area.x = self->client->area.x;
         self->area.y = self->client->area.y;
-        frame_client_gravity(self, &self->area.x, &self->area.y,
-                             self->client->area.width,
-                             self->client->area.height);
+        frame_client_gravity(self, &self->area.x, &self->area.y);
     }
 
     if (!fake) {
@@ -789,9 +784,8 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
             framerender_frame(self);
             frame_adjust_shape(self);
 
-            /* the offscreen buffer is invalid when the window is resized */
-            if (self->visible)
-                frame_get_offscreen_buffer(self);
+            /* the offscreen buffer's shape needs to match */
+            frame_get_offscreen_buffer(self);
         }
 
         if (!STRUT_EQUAL(self->size, oldsize)) {
@@ -922,6 +916,9 @@ void frame_grab_client(ObFrame *self)
     /* reparent the client to the frame */
     XReparentWindow(ob_display, self->client->window, self->window, 0, 0);
 
+    /* enable the offscreen composite buffer for the client window */
+    composite_enable_for_window(self->client->window);
+
     /*
       When reparenting the client window, it is usually not mapped yet, since
       this occurs from a MapRequest. However, in the case where Openbox is
@@ -1405,7 +1402,7 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y)
     return OB_FRAME_CONTEXT_NONE;
 }
 
-void frame_client_gravity(ObFrame *self, gint *x, gint *y, gint w, gint h)
+void frame_client_gravity(ObFrame *self, gint *x, gint *y)
 {
     /* horizontal */
     switch (self->client->gravity) {
@@ -1468,7 +1465,7 @@ void frame_client_gravity(ObFrame *self, gint *x, gint *y, gint w, gint h)
     }
 }
 
-void frame_frame_gravity(ObFrame *self, gint *x, gint *y, gint w, gint h)
+void frame_frame_gravity(ObFrame *self, gint *x, gint *y)
 {
     /* horizontal */
     switch (self->client->gravity) {
@@ -1529,7 +1526,7 @@ void frame_rect_to_frame(ObFrame *self, Rect *r)
 {
     r->width += self->size.left + self->size.right;
     r->height += self->size.top + self->size.bottom;
-    frame_client_gravity(self, &r->x, &r->y, r->width, r->height);
+    frame_client_gravity(self, &r->x, &r->y);
 }
 
 static void flash_done(gpointer data)
@@ -1678,7 +1675,10 @@ void frame_end_iconify_animation(ObFrame *self)
         XUnmapWindow(ob_display, self->window);
     else {
         /* Send a ConfigureNotify when the animation is done, this fixes
-           KDE's pager showing the window in the wrong place. */
+           KDE's pager showing the window in the wrong place.  since the
+           window is mapped at a different location and is then moved, we
+           need to send the synthetic configurenotify, since apps may have
+           read the position when the client mapped, apparently. */
         client_reconfigure(self->client, TRUE);
 
         /* the offscreen buffer is invalid when the window is resized */
@@ -1753,7 +1753,15 @@ static void frame_get_offscreen_buffer(ObFrame *self)
     frame_free_offscreen_buffer(self);
 
     if (self->visible || frame_iconify_animating(self)) {
-        self->pixmap = composite_get_window_pixmap(self->window);
+        self->pixmap = composite_get_window_pixmap(self->client->window);
+
+#ifdef SHAPE
+        /* shape the offscreen buffer to match the window */
+        XShapeCombineShape(ob_display, self->pixmap, ShapeBounding,
+                           0, 0, self->client->window,
+                           ShapeBounding, ShapeSet);
+#endif
+
         /*
           self->picture = composite_create_picture(self->window,
           wattrib.visual,
This page took 0.025938 seconds and 4 git commands to generate.