[mutter] window: Rename the requested_rect to the unconstrained_rect



commit cbffbb0be064b7e75dc5da87432071627b870111
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed May 21 13:59:13 2014 -0400

    window: Rename the requested_rect to the unconstrained_rect
    
    The requested_rect is a strange name for it, because it's not actually
    the rect that the user or client requested all the time: in the case of
    a simple move or a simple resize, we calculate some of the fields
    ourselves.
    
    To the MetaWindow subclass implementations, it just means "the rect
    before we constrained it", so just use the name unconstrained_rect.
    This also makes it match the name of the MetaWindow field.

 src/core/window-private.h    |    2 +-
 src/core/window.c            |   25 ++++++++++++-------------
 src/wayland/window-wayland.c |    6 +++---
 src/x11/window-x11.c         |    2 +-
 4 files changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 18d5f72..7d7343f 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -478,7 +478,7 @@ struct _MetaWindowClass
   void (*current_workspace_changed) (MetaWindow *window);
   void (*move_resize_internal)   (MetaWindow                *window,
                                   int                        gravity,
-                                  MetaRectangle              requested_rect,
+                                  MetaRectangle              unconstrained_rect,
                                   MetaRectangle              constrained_rect,
                                   MetaMoveResizeFlags        flags,
                                   MetaMoveResizeResultFlags *result);
diff --git a/src/core/window.c b/src/core/window.c
index 449277b..47442a1 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3651,8 +3651,8 @@ meta_window_move_resize_internal (MetaWindow          *window,
    * windows, this is the root position of the client area of the window.
    */
   gboolean did_placement;
-  MetaRectangle new_rect;
-  MetaRectangle requested_rect;
+  MetaRectangle unconstrained_rect;
+  MetaRectangle constrained_rect;
   MetaMoveResizeResultFlags result = 0;
 
   g_return_if_fail (!window->override_redirect);
@@ -3676,48 +3676,47 @@ meta_window_move_resize_internal (MetaWindow          *window,
 
       meta_window_get_client_root_coords (window, &old_rect);
       meta_rectangle_resize_with_gravity (&old_rect,
-                                          &requested_rect,
+                                          &unconstrained_rect,
                                           gravity,
                                           client_rect.width,
                                           client_rect.height);
     }
   else
     {
-      requested_rect = client_rect;
+      unconstrained_rect = client_rect;
     }
 
   /* If this is only a move, then ignore the passed in size and
    * just use the existing size of the window. */
   if ((flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION)) == META_IS_MOVE_ACTION)
     {
-      requested_rect.width = window->rect.width;
-      requested_rect.height = window->rect.height;
+      unconstrained_rect.width = window->rect.width;
+      unconstrained_rect.height = window->rect.height;
     }
 
-  new_rect = requested_rect;
-
   /* Save the unconstrained rectangle to the position we should be at
    * before constraints kick in. */
-  window->unconstrained_rect = new_rect;
+  window->unconstrained_rect = unconstrained_rect;
 
+  constrained_rect = unconstrained_rect;
   if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION))
     {
       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_client_rect_to_frame_rect (window, &constrained_rect, &constrained_rect);
 
       meta_window_constrain (window,
                              flags,
                              gravity,
                              &old_rect,
-                             &new_rect);
+                             &constrained_rect);
 
-      meta_window_frame_rect_to_client_rect (window, &new_rect, &new_rect);
+      meta_window_frame_rect_to_client_rect (window, &constrained_rect, &constrained_rect);
     }
 
   /* Do the protocol-specific move/resize logic */
-  META_WINDOW_GET_CLASS (window)->move_resize_internal (window, gravity, requested_rect, new_rect, flags, 
&result);
+  META_WINDOW_GET_CLASS (window)->move_resize_internal (window, gravity, unconstrained_rect, 
constrained_rect, flags, &result);
 
   if (result & META_MOVE_RESIZE_RESULT_MOVED)
     g_signal_emit (window, window_signals[POSITION_CHANGED], 0);
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index 132addb..d1bda38 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -150,7 +150,7 @@ meta_window_wayland_grab_op_ended (MetaWindow *window,
 static void
 meta_window_wayland_move_resize_internal (MetaWindow                *window,
                                           int                        gravity,
-                                          MetaRectangle              requested_rect,
+                                          MetaRectangle              unconstrained_rect,
                                           MetaRectangle              constrained_rect,
                                           MetaMoveResizeFlags        flags,
                                           MetaMoveResizeResultFlags *result)
@@ -177,8 +177,8 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
        */
 
       *result |= META_MOVE_RESIZE_RESULT_RESIZED;
-      window->rect.width = requested_rect.width;
-      window->rect.height = requested_rect.height;
+      window->rect.width = unconstrained_rect.width;
+      window->rect.height = unconstrained_rect.height;
 
       /* This is a commit of an attach. We should move the window to match the
        * new position the client wants. */
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index c1ee595..7c42adb 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -995,7 +995,7 @@ meta_window_x11_current_workspace_changed (MetaWindow *window)
 static void
 meta_window_x11_move_resize_internal (MetaWindow                *window,
                                       int                        gravity,
-                                      MetaRectangle              requested_rect,
+                                      MetaRectangle              unconstrained_rect,
                                       MetaRectangle              constrained_rect,
                                       MetaMoveResizeFlags        flags,
                                       MetaMoveResizeResultFlags *result)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]