[mutter] window: Only update the unconstrained rect when we actually moved/resized



commit c2abe43ee7ab77a7160f4872753f5df2a5138c17
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Jul 7 14:08:07 2014 -0400

    window: Only update the unconstrained rect when we actually moved/resized
    
    Since Wayland configures are more of a hint to the client than anything,
    we don't want to save the unconstrained rect when we're just hinting to
    the client that it should resize, since it could ignore us. This would
    get us stuck in a loop, since meta_window_move_resize_now would use the
    unconstrained_rect to resize, and we don't remove the resize from the
    queue if we have an outstanding request like that.
    
    This fixes a bunch of traffic / CPU usage when trying to resize
    weston-terminal.

 src/core/window.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 3ecfdcd..36aa9e4 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3690,10 +3690,6 @@ meta_window_move_resize_internal (MetaWindow          *window,
       unconstrained_rect.height = window->rect.height;
     }
 
-  /* Save the unconstrained rectangle to the position we should be at
-   * before constraints kick in. */
-  window->unconstrained_rect = unconstrained_rect;
-
   constrained_rect = unconstrained_rect;
   if (flags & (META_IS_MOVE_ACTION | META_IS_RESIZE_ACTION))
     {
@@ -3713,8 +3709,8 @@ meta_window_move_resize_internal (MetaWindow          *window,
    */
   if (did_placement)
     {
-      window->unconstrained_rect.x = constrained_rect.x;
-      window->unconstrained_rect.y = constrained_rect.y;
+      unconstrained_rect.x = constrained_rect.x;
+      unconstrained_rect.y = constrained_rect.y;
     }
 
   /* Do the protocol-specific move/resize logic */
@@ -3728,6 +3724,8 @@ meta_window_move_resize_internal (MetaWindow          *window,
 
   if ((result & (META_MOVE_RESIZE_RESULT_MOVED | META_MOVE_RESIZE_RESULT_RESIZED)) != 0 || did_placement)
     {
+      window->unconstrained_rect = unconstrained_rect;
+
       if (window->known_to_compositor)
         meta_compositor_sync_window_geometry (window->display->compositor,
                                               window,


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