constraints: Size increments need to be applied to the client rect

Not the frame rect.
This commit is contained in:
Jasper St. Pierre 2014-05-05 13:09:41 -04:00
parent 6c7a51378f
commit f4ef4b79f9

View File

@ -905,6 +905,7 @@ constrain_size_increments (MetaWindow *window,
int new_width, new_height; int new_width, new_height;
gboolean constraint_already_satisfied; gboolean constraint_already_satisfied;
MetaRectangle *start_rect; MetaRectangle *start_rect;
MetaRectangle client_rect;
if (priority > PRIORITY_SIZE_HINTS_INCREMENTS) if (priority > PRIORITY_SIZE_HINTS_INCREMENTS)
return TRUE; return TRUE;
@ -915,13 +916,15 @@ constrain_size_increments (MetaWindow *window,
info->action_type == ACTION_MOVE) info->action_type == ACTION_MOVE)
return TRUE; return TRUE;
meta_window_frame_rect_to_client_rect (window, &info->current, &client_rect);
/* Determine whether constraint is already satisfied; exit if it is */ /* Determine whether constraint is already satisfied; exit if it is */
bh = window->size_hints.base_height; bh = window->size_hints.base_height;
hi = window->size_hints.height_inc; hi = window->size_hints.height_inc;
bw = window->size_hints.base_width; bw = window->size_hints.base_width;
wi = window->size_hints.width_inc; wi = window->size_hints.width_inc;
extra_height = (info->current.height - bh) % hi; extra_height = (client_rect.height - bh) % hi;
extra_width = (info->current.width - bw) % wi; extra_width = (client_rect.width - bw) % wi;
/* ignore size increments for maximized windows */ /* ignore size increments for maximized windows */
if (window->maximized_horizontally) if (window->maximized_horizontally)
extra_width *= 0; extra_width *= 0;
@ -935,8 +938,8 @@ constrain_size_increments (MetaWindow *window,
return constraint_already_satisfied; return constraint_already_satisfied;
/*** Enforce constraint ***/ /*** Enforce constraint ***/
new_width = info->current.width - extra_width; new_width = client_rect.width - extra_width;
new_height = info->current.height - extra_height; new_height = client_rect.height - extra_height;
/* Adjusting down instead of up (as done in the above two lines) may /* Adjusting down instead of up (as done in the above two lines) may
* violate minimum size constraints; fix the adjustment if this * violate minimum size constraints; fix the adjustment if this