[compiz] Ignoring increment hint when maximized horz/vert

Mike Cook mcook at novell.com
Thu Apr 5 13:54:40 PDT 2007


Here's a quick patch to have either horz or vert (instead of both) maximized windows honor the "ignore" option:
--- src/window.c
+++ src/window.c
@@ -4012,7 +4012,7 @@ constrainNewWindowSize (CompWindow *w,

     if (d->opt[COMP_DISPLAY_OPTION_IGNORE_HINTS_WHEN_MAXIMIZED].value.b)
     {
-       if ((w->state & MAXIMIZE_STATE) == MAXIMIZE_STATE)
+       if (w->state & MAXIMIZE_STATE)
            flags &= ~(PResizeInc | PAspect);
     }

After playing with that, however, I wonder if something like the following would be more correct, as it still enforces increment in the axis that isn't maximized (but it wouldn't allow resize at all if aspect is constrained-- should we?).  What do you folks think?
--- src/window.c
+++ src/window.c
@@ -4059,8 +4059,13 @@ constrainNewWindowSize (CompWindow *w,

     if (flags & PResizeInc)
     {
-       xinc = MAX (xinc, hints->width_inc);
-       yinc = MAX (yinc, hints->height_inc);
+       if (!d->opt[COMP_DISPLAY_OPTION_IGNORE_HINTS_WHEN_MAXIMIZED].value.b ||
+           !(w->state & CompWindowStateMaximizedHorzMask))
+           xinc = MAX (xinc, hints->width_inc);
+
+       if (!d->opt[COMP_DISPLAY_OPTION_IGNORE_HINTS_WHEN_MAXIMIZED].value.b ||
+           !(w->state & CompWindowStateMaximizedVertMask))
+           yinc = MAX (yinc, hints->height_inc);
     }

     /* clamp width and height to min and max values */

Oh, also a tiny whitespace issue I noticed:
--- src/window.c
+++ src/window.c
@@ -3314,7 +3314,7 @@ addWindowSizeChanges (CompWindow     *w,
     x = (vx - w->screen->x) * w->screen->width;
     y = (vy - w->screen->y) * w->screen->height;

-   output = outputDeviceForGeometry (w->screen,
+    output = outputDeviceForGeometry (w->screen,
                                      oldX,
                                      oldY,
                                      oldWidth,

...MC


More information about the compiz mailing list