[gtk/matthiasc/surface-state-rework: 72/80] x11/surface: Avoid resizing if computed size didn't change




commit 9e3b46c80afbde78d5bc91933917142822ebf48d
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sat Dec 5 11:40:47 2020 +0100

    x11/surface: Avoid resizing if computed size didn't change
    
    This fixes an issue where we'd resize to the previous window size during
    interactive resize.

 gdk/x11/gdksurface-x11.c | 6 +++++-
 gdk/x11/gdksurface-x11.h | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 7f5983bcd8..3788ee70b6 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -303,11 +303,15 @@ compute_toplevel_size (GdkSurface *surface,
       gdk_surface_constrain_size (&geometry, mask,
                                   size.width, size.height,
                                   &size.width, &size.height);
-      if ((impl->next_layout.configured_width != size.width ||
+      if ((impl->last_computed_width != size.width ||
+           impl->last_computed_height != size.height) &&
+          (impl->next_layout.configured_width != size.width ||
            impl->next_layout.configured_height != size.height))
         {
           *width = size.width;
           *height = size.height;
+          impl->last_computed_width = size.width;
+          impl->last_computed_height = size.height;
 
           return TRUE;
         }
diff --git a/gdk/x11/gdksurface-x11.h b/gdk/x11/gdksurface-x11.h
index 134ebdf617..0830407dd0 100644
--- a/gdk/x11/gdksurface-x11.h
+++ b/gdk/x11/gdksurface-x11.h
@@ -72,6 +72,9 @@ struct _GdkX11Surface
   int unscaled_width;
   int unscaled_height;
 
+  int last_computed_width;
+  int last_computed_height;
+
   GdkToplevelLayout *toplevel_layout;
 
   struct {


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