[compiz] Ignoring increment hint when maximized horz/vert

David Reveman davidr at novell.com
Fri Apr 6 04:58:44 PDT 2007


On Thu, 2007-04-05 at 14:54 -0600, Mike Cook wrote:
> 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 */


Yes, this is more correct. I've made some changes that should give this
behavior. I think the aspect hint should be ignore when any window
dimension is maximized. If that's bad for some reason, let me know.

> 
> 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,

Yeah, I've noticed this before. It's now fixed. :)

Thanks,

- David



More information about the compiz mailing list