[gtk/cherry-pick-b63c4d67] wayland: Don't call _gdk_surface_update_size() all the time




commit 3b3b5edf4b254e73b890bad343c3b2af6da0f3c7
Author: Benjamin Otte <otte redhat com>
Date:   Tue Mar 9 18:50:56 2021 +0000

    wayland: Don't call _gdk_surface_update_size() all the time
    
    We were calling _gdk_surface_update_size() every frame, even if the
    window size didn't change. This would cause us to discard all cached
    buffers and redraw the whole screen.
    
    This was BAD.
    
    
    (cherry picked from commit b63c4d67229107ef54367fbabc8e3559dff10bdf)

 gdk/wayland/gdksurface-wayland.c | 31 +++++++++----------------------
 1 file changed, 9 insertions(+), 22 deletions(-)
---
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index d31e4ae6ee..ad6e6ee0bc 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -284,11 +284,6 @@ static void gdk_wayland_surface_maybe_resize (GdkSurface *surface,
                                               int         height,
                                               int         scale);
 
-static void gdk_wayland_surface_resize (GdkSurface *surface,
-                                        int         width,
-                                        int         height,
-                                        int         scale);
-
 static void gdk_wayland_surface_configure (GdkSurface *surface);
 
 static void maybe_set_gtk_surface_dbus_properties (GdkWaylandSurface *impl);
@@ -415,6 +410,8 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
     g_object_notify (G_OBJECT (surface), "height");
   if (scale_changed)
     g_object_notify (G_OBJECT (surface), "scale-factor");
+
+  _gdk_surface_update_size (surface);
 }
 
 static const char *
@@ -643,10 +640,10 @@ configure_drag_surface_geometry (GdkSurface *surface)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
 
-  gdk_wayland_surface_resize (surface,
-                              impl->next_layout.configured_width,
-                              impl->next_layout.configured_height,
-                              impl->scale);
+  gdk_wayland_surface_update_size (surface,
+                                   impl->next_layout.configured_width,
+                                   impl->next_layout.configured_height,
+                                   impl->scale);
 }
 
 static gboolean
@@ -1003,16 +1000,6 @@ is_realized_popup (GdkWaylandSurface *impl)
           impl->display_server.zxdg_popup_v6);
 }
 
-static void
-gdk_wayland_surface_resize (GdkSurface *surface,
-                            int         width,
-                            int         height,
-                            int         scale)
-{
-  gdk_wayland_surface_update_size (surface, width, height, scale);
-  _gdk_surface_update_size (surface);
-}
-
 static void gdk_wayland_surface_show (GdkSurface *surface,
                                       gboolean    already_mapped);
 static void gdk_wayland_surface_hide (GdkSurface *surface);
@@ -1044,7 +1031,7 @@ gdk_wayland_surface_maybe_resize (GdkSurface *surface,
   if (is_xdg_popup && is_visible && !impl->initial_configure_received)
     gdk_wayland_surface_hide (surface);
 
-  gdk_wayland_surface_resize (surface, width, height, scale);
+  gdk_wayland_surface_update_size (surface, width, height, scale);
 
   if (is_xdg_popup && is_visible && !impl->initial_configure_received)
     gdk_wayland_surface_show (surface, FALSE);
@@ -1409,7 +1396,7 @@ configure_toplevel_geometry (GdkSurface *surface)
                                       width, height,
                                       &width, &height);
         }
-      gdk_wayland_surface_resize (surface, width, height, impl->scale);
+      gdk_wayland_surface_update_size (surface, width, height, impl->scale);
 
       if (!impl->next_layout.toplevel.size_is_fixed)
         {
@@ -1427,7 +1414,7 @@ configure_toplevel_geometry (GdkSurface *surface)
       gdk_surface_constrain_size (&geometry, mask,
                                   width, height,
                                   &width, &height);
-      gdk_wayland_surface_resize (surface, width, height, impl->scale);
+      gdk_wayland_surface_update_size (surface, width, height, impl->scale);
     }
 }
 


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