[mutter] wayland: Don't emit SIZE_CHANGED on every commit



commit a3c55c2692215bf7999864878d5367d93b7afbe4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jul 17 17:26:22 2014 -0400

    wayland: Don't emit SIZE_CHANGED on every commit
    
    Save a little bit of effort here.

 src/wayland/window-wayland.c |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index 5abbc54..6aa2d32 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -174,19 +174,28 @@ meta_window_wayland_move_resize_internal (MetaWindow                *window,
 
   if (flags & META_IS_WAYLAND_RESIZE)
     {
-      CoglTexture *texture;
-
       /* This is a call to wl_surface_commit(), ignore the constrained_rect and
        * update the real client size to match the buffer size.
        */
 
-      *result |= META_MOVE_RESIZE_RESULT_RESIZED;
-      window->rect.width = unconstrained_rect.width;
-      window->rect.height = unconstrained_rect.height;
+      if (window->rect.width != unconstrained_rect.width ||
+          window->rect.height != unconstrained_rect.height)
+        {
+          *result |= META_MOVE_RESIZE_RESULT_RESIZED;
+          window->rect.width = unconstrained_rect.width;
+          window->rect.height = unconstrained_rect.height;
+        }
 
-      texture = window->surface->buffer->texture;
-      window->buffer_rect.width = cogl_texture_get_width (texture);
-      window->buffer_rect.height = cogl_texture_get_height (texture);
+      CoglTexture *texture = window->surface->buffer->texture;
+      int new_buffer_width = cogl_texture_get_width (texture);
+      int new_buffer_height = cogl_texture_get_height (texture);
+      if (window->buffer_rect.width != new_buffer_width ||
+          window->buffer_rect.height != new_buffer_height)
+        {
+          *result |= META_MOVE_RESIZE_RESULT_RESIZED;
+          window->buffer_rect.width = new_buffer_width;
+          window->buffer_rect.height = new_buffer_height;
+        }
 
       /* This is a commit of an attach. We should move the window to match the
        * new position the client wants. */


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