mirror of
https://github.com/brl/mutter.git
synced 2025-04-13 05:39:38 +00:00
window: Make the x/y position in the requested_rect more accurate
For gravity-based resizing, we need to make sure that the requested rectangle has the proper x/y position given by the gravity resize, rather than the bogus root_x_nw / root_y_nw parameter. Make the test for this more explicit.
This commit is contained in:
parent
acb3dc6754
commit
4b5593c67f
@ -3812,30 +3812,24 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
is_user_action ? " (user move/resize)" : "",
|
is_user_action ? " (user move/resize)" : "",
|
||||||
old_rect.x, old_rect.y, old_rect.width, old_rect.height);
|
old_rect.x, old_rect.y, old_rect.width, old_rect.height);
|
||||||
|
|
||||||
requested_rect.x = root_x_nw;
|
/* If this is only a resize, then ignore the position given in
|
||||||
requested_rect.y = root_y_nw;
|
* the parameters and instead calculate the new position from
|
||||||
requested_rect.width = w;
|
* resizing the old rectangle with the given gravity. */
|
||||||
requested_rect.height = h;
|
if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) == META_IS_RESIZE_ACTION)
|
||||||
|
|
||||||
new_rect = requested_rect;
|
|
||||||
|
|
||||||
/* If this is a resize only, the position should be ignored and
|
|
||||||
* instead obtained by resizing the old rectangle according to the
|
|
||||||
* relevant gravity.
|
|
||||||
*/
|
|
||||||
if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) ==
|
|
||||||
META_IS_RESIZE_ACTION)
|
|
||||||
{
|
{
|
||||||
meta_rectangle_resize_with_gravity (&old_rect,
|
meta_rectangle_resize_with_gravity (&old_rect,
|
||||||
&new_rect,
|
&requested_rect,
|
||||||
gravity,
|
gravity, w, h);
|
||||||
new_rect.width,
|
|
||||||
new_rect.height);
|
|
||||||
|
|
||||||
meta_topic (META_DEBUG_GEOMETRY,
|
|
||||||
"Compensated for gravity in resize action; new pos %d,%d\n",
|
|
||||||
new_rect.x, new_rect.y);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
requested_rect.x = root_x_nw;
|
||||||
|
requested_rect.y = root_y_nw;
|
||||||
|
requested_rect.width = w;
|
||||||
|
requested_rect.height = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
new_rect = requested_rect;
|
||||||
|
|
||||||
did_placement = !window->placed && window->calc_placement;
|
did_placement = !window->placed && window->calc_placement;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user