Eh! nice patch :-)

I cannot check more deeply now, but, some comments:

El 04/05/2012 18:48, Iain Patterson escribió:

> +void handleMaximize(WWindow *wwin, int directions)
> +{
> +     int current = wwin->flags.maximized;
> +     int requested = directions & (MAX_HORIZONTAL | MAX_VERTICAL | 
> MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
> +     int effective = requested ^ current;
> +     int flags = directions & ~requested;
> +
> +     if (!effective) {
> +             /* allow wMaximizeWindow to restore the Maximusized size */
> +             if ((wwin->flags.old_maximized & MAX_MAXIMUS) &&
> +                 !(requested & MAX_MAXIMUS))
> +                     wMaximizeWindow(wwin, flags);
> +             else
> +                     wUnmaximizeWindow(wwin);
> +     }
> +     else {
> +             /* MAX_MAXIMUS takes precedence */

Probably is better:

+       } else {
+               /* MAX_MAXIMUS takes precedence */

> +             effective &= ~MAX_MAXIMUS;
> +             if (requested & MAX_MAXIMUS) {
> +                     /* window was previously Maximusized then maximized */
> +                     if ((wwin->flags.old_maximized & MAX_MAXIMUS) && 
> !current) {
> +                             wUnmaximizeWindow(wwin);
> +                             return;
> +                     }
> +                     else
> +                             effective = MAX_MAXIMUS;
> +             }
> +             else if (requested == (MAX_HORIZONTAL | MAX_VERTICAL))
> +                     effective = requested;
> +             else {

And here:

+                       } else {
+                               effective = MAX_MAXIMUS;
+                       }
+               } else if (requested == (MAX_HORIZONTAL | MAX_VERTICAL)) {
+                       effective = requested;
+               } else {

> +                     /* handle MAX_HORIZONTAL -> MAX_(LEFT|RIGHT)HALF */
> +                     if (IS_MAX_HORIZONTALLY(current)) {
> +                             if (IS_MAX_HORIZONTALLY(requested)) {
> +                                     effective &= ~(MAX_HORIZONTAL | 
> MAX_LEFTHALF | MAX_RIGHTHALF);
> +                                     effective |= (requested & 
> (MAX_HORIZONTAL | MAX_LEFTHALF | MAX_RIGHTHALF));
> +                                     if (requested & MAX_HORIZONTAL) {
> +                                             /* restore to half maximization 
> */
> +                                             if (wwin->flags.old_maximized & 
> MAX_LEFTHALF)
> +                                                     effective |= 
> MAX_LEFTHALF;
> +                                             else if 
> (wwin->flags.old_maximized & MAX_RIGHTHALF)
> +                                                     effective |= 
> MAX_RIGHTHALF;
> +                                     }
> +                                     /* MAX_VERTICAL is implicit with 
> MAX_(LEFT|RIGHT)HALF */
> +                                     else
> +                                             effective |= MAX_VERTICAL;

The same idea } else { (above this line) ^

> +                             } else {
> +                                     /* toggling MAX_VERTICAL */
> +                                     if ((requested & MAX_VERTICAL) &&
> +                                         (current & MAX_VERTICAL)) {
> +                                             effective &= ~(MAX_LEFTHALF | 
> MAX_RIGHTHALF | MAX_VERTICAL);
> +                                     }

Curly brackets not needed (above)

> +                             }
> +                     }
> +                     /* handle MAX_VERTICAL -> MAX_(LEFT|RIGHT)HALF */
> +                     if (current & MAX_VERTICAL) {
> +                             if ((requested & MAX_LEFTHALF) ||
> +                                 (requested & MAX_RIGHTHALF)) {
> +                                     effective |= MAX_VERTICAL;
> +                             }

No curly brackets above ^

> +                     }
> +                     /* toggling MAX_HORIZONTAL */
> +                     if ((requested & MAX_HORIZONTAL) &&
> +                         (current & MAX_HORIZONTAL))
> +                             effective &= ~MAX_HORIZONTAL;
> +             }
> +             wMaximizeWindow(wwin, effective | flags);
> +     }
> +     return;
>  }
>  
>  /* the window boundary coordinates */
> @@ -434,7 +569,14 @@ static void find_Maximus_geometry(WWindow *wwin, WArea 
> usableArea, int *new_x, i
>       win_coords obs, orig, new;
>  
>       /* set the original coordinate positions of the window to be 
> Maximumized */
> -     set_window_coords(wwin, &orig);
> +     if (wwin->flags.maximized) {
> +             /* window is already maximized; consider original geometry */
> +             remember_geometry(wwin, &orig.left, &orig.top, &orig.width, 
> &orig.height);
> +             orig.bottom = orig.top + orig.height;
> +             orig.right = orig.left + orig.width;
> +     }
> +     else
> +             set_window_coords(wwin, &orig);

} else {
        set_window_coords(wwin, &orig);
}

>       /* Try to fully maximize first, then readjust later */
>       new.left    = usableArea.x1;

Cheers!

kix


--
To unsubscribe, send mail to [email protected].

Reply via email to