[mutter] window-x11: Don't bother calculating the actual deltas for the frame



commit d8c2933c5863876cd15983d068c97fc9e0ba5079
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed May 21 12:24:03 2014 -0400

    window-x11: Don't bother calculating the actual deltas for the frame
    
    It's not necessary. All we care about is whether the size / position
    has changed.

 src/x11/window-x11.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index b5af98a..01eae65 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -1040,7 +1040,6 @@ meta_window_x11_move_resize_internal (MetaWindow                *window,
 
   if (window->frame)
     {
-      int frame_size_dx, frame_size_dy;
       int new_w, new_h;
 
       new_w = window->rect.width + borders.total.left + borders.total.right;
@@ -1049,13 +1048,13 @@ meta_window_x11_move_resize_internal (MetaWindow                *window,
       if (!window->shaded)
         new_h += window->rect.height;
 
-      frame_size_dx = new_w - window->frame->rect.width;
-      frame_size_dy = new_h - window->frame->rect.height;
-
-      need_resize_frame = (frame_size_dx != 0 || frame_size_dy != 0);
-
-      window->frame->rect.width = new_w;
-      window->frame->rect.height = new_h;
+      if (new_w != window->frame->rect.width ||
+          new_h != window->frame->rect.height)
+        {
+          need_resize_frame = TRUE;
+          window->frame->rect.width = new_w;
+          window->frame->rect.height = new_h;
+        }
 
       meta_topic (META_DEBUG_GEOMETRY,
                   "Calculated frame size %dx%d\n",
@@ -1081,19 +1080,18 @@ meta_window_x11_move_resize_internal (MetaWindow                *window,
   if (window->frame)
     {
       int new_x, new_y;
-      int frame_pos_dx, frame_pos_dy;
 
       /* Compute new frame coords */
       new_x = root_x_nw - borders.total.left;
       new_y = root_y_nw - borders.total.top;
 
-      frame_pos_dx = new_x - window->frame->rect.x;
-      frame_pos_dy = new_y - window->frame->rect.y;
-
-      need_move_frame = (frame_pos_dx != 0 || frame_pos_dy != 0);
-
-      window->frame->rect.x = new_x;
-      window->frame->rect.y = new_y;
+      if (new_x != window->frame->rect.x ||
+          new_y != window->frame->rect.y)
+        {
+          need_move_frame = TRUE;
+          window->frame->rect.x = new_x;
+          window->frame->rect.y = new_y;
+        }
 
       /* If frame will both move and resize, then StaticGravity
        * on the child window will kick in and implicitly move


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