]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
don't set the above member in synthetic configurenotify events
[chaz/openbox] / openbox / client.c
index 39cd27dca466f420d2cd101306622f055d0a72fb..1683c6082d1bfff657322164df45dd68af9955ba 100644 (file)
@@ -400,15 +400,17 @@ void client_manage(Window window)
             a.height -= self->frame->size.top + self->frame->size.bottom;
 
             /* fit the window inside the area */
-            self->area.width = MIN(self->area.width, a.width);
-            self->area.height = MIN(self->area.height, a.height);
+            if (self->area.width > a.width || self->area.height > a.height) {
+                self->area.width = MIN(self->area.width, a.width);
+                self->area.height = MIN(self->area.height, a.height);
 
-            ob_debug("setting window size to %dx%d\n",
-                     self->area.width, self->area.height);
+                ob_debug("setting window size to %dx%d\n",
+                         self->area.width, self->area.height);
 
-            /* adjust the frame to the client's new size */
-            frame_adjust_area(self->frame, FALSE, TRUE, FALSE);
-            frame_adjust_client_area(self->frame);
+                /* adjust the frame to the client's new size */
+                frame_adjust_area(self->frame, FALSE, TRUE, FALSE);
+                frame_adjust_client_area(self->frame);
+            }
         }
 
         /* make sure the window is visible. */
@@ -1800,9 +1802,6 @@ static void client_change_allowed_actions(ObClient *self)
 
 void client_reconfigure(ObClient *self)
 {
-    /* by making this pass FALSE for user, we avoid the emacs event storm where
-       every configurenotify causes an update in its normal hints, i think this
-       is generally what we want anyways... */
     client_configure(self, self->area.x, self->area.y,
                      self->area.width, self->area.height,
                      self->border_width, FALSE, TRUE);
@@ -2819,9 +2818,15 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gint b,
 
     /* if the client is enlarging, then resize the client before the frame */
     if (send_resize_client && (w > oldw || h > oldh)) {
-        XMoveResizeWindow(ob_display, self->window,
-                          -self->border_width, -self->border_width,
-                          MAX(w, oldw), MAX(h, oldh));
+        XWindowChanges changes;
+        changes.x = -self->border_width;
+        changes.y = -self->border_width;
+        changes.width = MAX(w, oldw);
+        changes.height = MAX(h, oldh);
+        changes.border_width = self->border_width;
+        XConfigureWindow(ob_display, self->window,
+                         CWX|CWY|CWWidth|CWHeight|CWBorderWidth,
+                         &changes);
         /* resize the plate to show the client padding color underneath */
         frame_adjust_client_area(self->frame);
     }
@@ -2867,21 +2872,28 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gint b,
         event.xconfigure.width = w;
         event.xconfigure.height = h;
         event.xconfigure.border_width = self->border_width;
-        event.xconfigure.above = self->frame->plate;
+        event.xconfigure.above = None;
         event.xconfigure.override_redirect = FALSE;
         XSendEvent(event.xconfigure.display, event.xconfigure.window,
                    FALSE, StructureNotifyMask, &event);
     }
 
     /* if the client is shrinking, then resize the frame before the client */
-    if (send_resize_client && (w <= oldw || h <= oldh)) {
+    if (send_resize_client && (w <= oldw && h <= oldh)) {
         /* resize the plate to show the client padding color underneath */
         frame_adjust_client_area(self->frame);
 
-        if (send_resize_client)
-            XMoveResizeWindow(ob_display, self->window,
-                              -self->border_width, -self->border_width,
-                              w, h);
+        if (send_resize_client) {
+            XWindowChanges changes;
+            changes.x = -self->border_width;
+            changes.y = -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);
This page took 0.027245 seconds and 4 git commands to generate.