]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
onlt send configurenotify if the client actually moved, to work around emacs, hopeful...
[chaz/openbox] / openbox / client.c
index f17d1bafa10ced0d955804a3c45ff102df7b7c45..4d1ba85a6d01f93f4614878616467aa2924849b3 100644 (file)
@@ -1610,13 +1610,24 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
     /* set the size and position if fullscreen */
     if (self->fullscreen) {
 #ifdef VIDMODE
-        XF86VidModeGetViewPort(ob_display, ob_screen, &x, &y);
+        int dot;
+        XF86VidModeModeLine mode;
+
+        if (XF86VidModeGetModeLine(ob_display, ob_screen, &dot, &mode)) {
+            w = mode.hdisplay;
+            h = mode.vdisplay;
+            if (mode.privsize) XFree(mode.private);
+        } else {
 #else
-       x = 0;
-       y = 0;
+            w = screen_physical_size.width;
+            h = screen_physical_size.height;
 #endif
-       w = screen_physical_size.width;
-       h = screen_physical_size.height;
+#ifdef VIDMODE
+        }
+        if (!XF86VidModeGetViewPort(ob_display, ob_screen, &x, &y)) {
+            x = y = 0;
+#endif
+        }
         user = FALSE; /* ignore that increment etc shit when in fullscreen */
     } else {
         /* set the size and position if maximized */
@@ -1647,8 +1658,27 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
     }
 
     if (!(w == self->area.width && h == self->area.height)) {
-        w -= self->base_size.width;
-        h -= self->base_size.height;
+        int basew, baseh, minw, minh;
+
+        /* base size is substituted with min size if not specified */
+        if (self->base_size.width || self->base_size.height) {
+            basew = self->base_size.width;
+            baseh = self->base_size.height;
+        } else {
+            basew = self->min_size.width;
+            baseh = self->min_size.height;
+        }
+        /* min size is substituted with base size if not specified */
+        if (self->min_size.width || self->min_size.height) {
+            minw = self->min_size.width;
+            minh = self->min_size.height;
+        } else {
+            minw = self->base_size.width;
+            minh = self->base_size.height;
+        }
+
+        w -= basew;
+        h -= baseh;
 
         if (user) {
             /* for interactive resizing. have to move half an increment in each
@@ -1669,19 +1699,13 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
             h += ah;
     
             /* if this is a user-requested resize, then check against min/max
-               sizes and aspect ratios */
+               sizes */
 
             /* smaller than min size or bigger than max size? */
             if (w > self->max_size.width) w = self->max_size.width;
-            if (w < self->min_size.width) w = self->min_size.width;
+            if (w < minw) w = minw;
             if (h > self->max_size.height) h = self->max_size.height;
-            if (h < self->min_size.height) h = self->min_size.height;
-
-            /* adjust the height ot match the width for the aspect ratios */
-            if (self->min_ratio)
-                if (h * self->min_ratio > w) h = (int)(w / self->min_ratio);
-            if (self->max_ratio)
-                if (h * self->max_ratio < w) h = (int)(w / self->max_ratio);
+            if (h < minh) h = minh;
         }
 
         /* keep to the increments */
@@ -1698,8 +1722,23 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
         w *= self->size_inc.width;
         h *= self->size_inc.height;
 
-        w += self->base_size.width;
-        h += self->base_size.height;
+        w += basew;
+        h += baseh;
+
+        if (user) {
+            /* adjust the height to match the width for the aspect ratios.
+             for this, min size is not substituted for base size ever. */
+            w -= self->base_size.width;
+            h -= self->base_size.height;
+
+            if (self->min_ratio)
+                if (h * self->min_ratio > w) h = (int)(w / self->min_ratio);
+            if (self->max_ratio)
+                if (h * self->max_ratio < w) h = (int)(w / self->max_ratio);
+
+            w += self->base_size.width;
+            h += self->base_size.height;
+        }
     }
 
     switch (anchor) {
@@ -1722,7 +1761,7 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
 
     RECT_SET(self->area, x, y, w, h);
 
-    if (resized)
+    if (final || (resized && config_opaque_resize))
        XResizeWindow(ob_display, self->window, w, h);
 
     /* move/resize the frame to match the request */
@@ -1730,7 +1769,11 @@ void client_configure(Client *self, Corner anchor, int x, int y, int w, int h,
         if (moved || resized)
             frame_adjust_area(self->frame, moved, resized);
 
-        if (!user || final) {
+        /* If you send this and the client hasn't moved you end up with buggy
+           clients (emacs) freaking out, cuz they send back a configure every
+           time they receive this event, which resends them this event... etc.
+        */
+        if (moved && (!user || final)) {
             XEvent event;
             event.type = ConfigureNotify;
             event.xconfigure.display = ob_display;
This page took 0.025172 seconds and 4 git commands to generate.