[gtk/matthiasc/surface-state-rework: 69/80] x11/surface: Compute size after update too




commit 84ad0131c4eafc188009115f948abf30ecff4dbc
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sat Dec 5 11:13:07 2020 +0100

    x11/surface: Compute size after update too
    
    This will sometimes mean a frame is skipped if a resize was requested
    during the update phase of the frame dispatch. Not doing so can cause
    trying to allocate a window smaller than the minimum size of the widget.

 gdk/x11/gdksurface-x11.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 0348e9b85b..8c65183f5d 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -1002,6 +1002,19 @@ on_frame_clock_before_paint (GdkFrameClock *clock,
   gdk_x11_surface_begin_frame (surface, FALSE);
 }
 
+static void
+on_frame_clock_after_update (GdkFrameClock *clock,
+                             GdkSurface    *surface)
+{
+  GdkX11Surface *impl = GDK_X11_SURFACE (surface);
+
+  if (impl->compute_size_source_id)
+    {
+      g_clear_handle_id (&impl->compute_size_source_id, g_source_remove);
+      compute_size_idle (surface);
+    }
+}
+
 static void
 on_frame_clock_after_paint (GdkFrameClock *clock,
                             GdkSurface     *surface)
@@ -1024,6 +1037,8 @@ connect_frame_clock (GdkSurface *surface)
 
       g_signal_connect (frame_clock, "before-paint",
                         G_CALLBACK (on_frame_clock_before_paint), surface);
+      g_signal_connect_after (frame_clock, "update",
+                              G_CALLBACK (on_frame_clock_after_update), surface);
       g_signal_connect (frame_clock, "after-paint",
                         G_CALLBACK (on_frame_clock_after_paint), surface);
 
@@ -1043,6 +1058,8 @@ disconnect_frame_clock (GdkSurface *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_after_update, surface);
       g_signal_handlers_disconnect_by_func (frame_clock,
                                             on_frame_clock_after_paint, surface);
 


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