window: Clean up old_rect handling a tiny bit

We need the old rect for two purposes: to find the x/y in a resize-only
action, and to pass into the constraints code for nefarious purposes.

The constraints code takes a frame rectangle, so we convert the original
client rect into a frame rect, but never convert it back since it's
unused for the rest of the function.

Instead of playing games with the variables, just have two,
separately-scoped variables. One is the client rect, the other is the
frame rect.
This commit is contained in:
Jasper St. Pierre 2014-05-01 19:20:26 -04:00
parent 73e2d7049a
commit f3a2bb7779

View File

@ -3779,7 +3779,6 @@ meta_window_move_resize_internal (MetaWindow *window,
* destination due to StaticGravity etc.
*/
MetaRectangle new_rect;
MetaRectangle old_rect;
MetaRectangle requested_rect;
MetaMoveResizeResultFlags result = 0;
@ -3796,13 +3795,14 @@ meta_window_move_resize_internal (MetaWindow *window,
/* We don't need it in the idle queue anymore. */
meta_window_unqueue (window, META_QUEUE_MOVE_RESIZE);
meta_window_get_client_root_coords (window, &old_rect);
/* If this is only a resize, then ignore the position given in
* the parameters and instead calculate the new position from
* resizing the old rectangle with the given gravity. */
if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) == META_IS_RESIZE_ACTION)
{
MetaRectangle old_rect;
meta_window_get_client_root_coords (window, &old_rect);
meta_rectangle_resize_with_gravity (&old_rect,
&requested_rect,
gravity,
@ -3818,7 +3818,9 @@ meta_window_move_resize_internal (MetaWindow *window,
if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION))
{
meta_window_client_rect_to_frame_rect (window, &old_rect, &old_rect);
MetaRectangle old_rect;
meta_window_get_frame_rect (window, &old_rect);
meta_window_client_rect_to_frame_rect (window, &new_rect, &new_rect);
meta_window_constrain (window,