[mutter] window: Clean up old_rect handling a tiny bit
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window: Clean up old_rect handling a tiny bit
- Date: Thu, 1 May 2014 23:51:23 +0000 (UTC)
commit f3a2bb7779cad254bca1ea7995c781792078c11c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu May 1 19:20:26 2014 -0400
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.
src/core/window.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 0b699c0..edf32ff 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]