mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
constraints: Fix up aspect ratio math for frame rect conversion
This commit is contained in:
parent
e72c6916aa
commit
cb66ab5a87
@ -1017,6 +1017,7 @@ constrain_aspect_ratio (MetaWindow *window,
|
||||
double best_width, best_height;
|
||||
double alt_width, alt_height;
|
||||
MetaRectangle *start_rect;
|
||||
MetaRectangle client_rect;
|
||||
|
||||
if (priority > PRIORITY_ASPECT_RATIO)
|
||||
return TRUE;
|
||||
@ -1068,15 +1069,18 @@ constrain_aspect_ratio (MetaWindow *window,
|
||||
fudge = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
meta_window_frame_rect_to_client_rect (window, &info->current, &client_rect);
|
||||
|
||||
constraint_already_satisfied =
|
||||
info->current.width - (info->current.height * minr ) > -minr*fudge &&
|
||||
info->current.width - (info->current.height * maxr ) < maxr*fudge;
|
||||
client_rect.width - (client_rect.height * minr ) > -minr*fudge &&
|
||||
client_rect.width - (client_rect.height * maxr ) < maxr*fudge;
|
||||
if (check_only || constraint_already_satisfied)
|
||||
return constraint_already_satisfied;
|
||||
|
||||
/*** Enforce constraint ***/
|
||||
new_width = info->current.width;
|
||||
new_height = info->current.height;
|
||||
new_width = client_rect.width;
|
||||
new_height = client_rect.height;
|
||||
|
||||
switch (info->resize_gravity)
|
||||
{
|
||||
@ -1123,6 +1127,14 @@ constrain_aspect_ratio (MetaWindow *window,
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
client_rect.width = new_width;
|
||||
client_rect.height = new_height;
|
||||
meta_window_client_rect_to_frame_rect (window, &client_rect, &client_rect);
|
||||
new_width = client_rect.width;
|
||||
new_height = client_rect.height;
|
||||
}
|
||||
|
||||
/* Figure out what original rect to pass to meta_rectangle_resize_with_gravity
|
||||
* See bug 448183
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user