[gtk: 21/88] wayland/surface: Compute size on layout




commit 13931463bd9696036786e251d01910faa3234be5
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Nov 24 23:16:48 2020 +0100

    wayland/surface: Compute size on layout
    
    Stop using the 'compute-size' phase of the frame clock, use the layout
    phase instead, now that GTK isn't using the layout phase anymore.

 gdk/gdksurface.c                 |  5 +++++
 gdk/gdksurfaceprivate.h          |  1 +
 gdk/wayland/gdksurface-wayland.c | 10 ++++------
 3 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 226a7c7e53..ae3dc94b66 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -1375,6 +1375,7 @@ gdk_surface_layout_on_clock (GdkFrameClock *clock,
                              void          *data)
 {
   GdkSurface *surface = GDK_SURFACE (data);
+  GdkSurfaceClass *class;
 
   g_return_if_fail (GDK_IS_SURFACE (surface));
 
@@ -1387,6 +1388,10 @@ gdk_surface_layout_on_clock (GdkFrameClock *clock,
   if (surface->update_freeze_count)
     return;
 
+  class = GDK_SURFACE_GET_CLASS (surface);
+  if (class->compute_size)
+    class->compute_size (surface);
+
   g_signal_emit (surface, signals[LAYOUT], 0, surface->width, surface->height);
 }
 
diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h
index 196e2b9aeb..cc4e1a1a35 100644
--- a/gdk/gdksurfaceprivate.h
+++ b/gdk/gdksurfaceprivate.h
@@ -170,6 +170,7 @@ struct _GdkSurfaceClass
                                            gboolean        attached,
                                            GdkGLContext   *share,
                                            GError        **error);
+  void         (* compute_size)           (GdkSurface     *surface);
 };
 
 #define GDK_SURFACE_DESTROYED(d) (((GdkSurface *)(d))->destroyed)
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 6a4ae89dad..c387dd2736 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -603,8 +603,7 @@ on_frame_clock_before_paint (GdkFrameClock *clock,
 }
 
 static void
-on_frame_clock_compute_size (GdkFrameClock *clock,
-                             GdkSurface    *surface)
+gdk_wayland_surface_compute_size (GdkSurface *surface)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
 
@@ -794,7 +793,6 @@ _gdk_wayland_display_create_surface (GdkDisplay     *display,
   gdk_wayland_surface_create_surface (surface);
 
   g_signal_connect (frame_clock, "before-paint", G_CALLBACK (on_frame_clock_before_paint), surface);
-  g_signal_connect (frame_clock, "compute-size", G_CALLBACK (on_frame_clock_compute_size), surface);
   g_signal_connect (frame_clock, "after-paint", G_CALLBACK (on_frame_clock_after_paint), surface);
 
   g_object_unref (frame_clock);
@@ -1448,7 +1446,7 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
     }
 
   impl->surface_geometry_dirty = TRUE;
-  gdk_surface_request_compute_size (surface);
+  gdk_surface_request_layout (surface);
 
   GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
             g_message ("configure, surface %p %dx%d,%s%s%s%s",
@@ -3314,7 +3312,6 @@ gdk_wayland_surface_destroy (GdkSurface *surface,
 
   frame_clock = gdk_surface_get_frame_clock (surface);
   g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_before_paint, surface);
-  g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_compute_size, surface);
   g_signal_handlers_disconnect_by_func (frame_clock, on_frame_clock_after_paint, surface);
 
   display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
@@ -4110,6 +4107,7 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
   impl_class->set_opaque_region = gdk_wayland_surface_set_opaque_region;
   impl_class->set_shadow_width = gdk_wayland_surface_set_shadow_width;
   impl_class->create_gl_context = gdk_wayland_surface_create_gl_context;
+  impl_class->compute_size = gdk_wayland_surface_compute_size;
 }
 
 void
@@ -4893,7 +4891,7 @@ gdk_wayland_toplevel_present (GdkToplevel       *toplevel,
   if (!pending_configure)
     {
       impl->surface_geometry_dirty = TRUE;
-      gdk_surface_request_compute_size (surface);
+      gdk_surface_request_layout (surface);
     }
 }
 


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