[gtk: 15/88] gdk/surface: Add API to request 'compute-size' clock phase




commit 68c14242b2840a8d66dd07118c39d842086b3ca2
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Nov 24 16:03:07 2020 +0100

    gdk/surface: Add API to request 'compute-size' clock phase

 gdk/gdksurface.c        | 26 +++++++++++++++++++++++++-
 gdk/gdksurfaceprivate.h |  3 +++
 2 files changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index d1e6192e53..0d36a58a03 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -1285,6 +1285,25 @@ gdk_surface_emit_size_changed (GdkSurface *surface,
   g_signal_emit (surface, signals[SIZE_CHANGED], 0, width, height);
 }
 
+void
+gdk_surface_request_compute_size (GdkSurface *surface)
+{
+  GdkFrameClock *frame_clock;
+
+  if (surface->update_freeze_count ||
+      gdk_surface_is_toplevel_frozen (surface))
+    {
+      surface->pending_request_compute_size = TRUE;
+      return;
+    }
+
+  frame_clock = gdk_surface_get_frame_clock (surface);
+  g_return_if_fail (frame_clock);
+
+  gdk_frame_clock_request_phase (frame_clock,
+                                 GDK_FRAME_CLOCK_PHASE_COMPUTE_SIZE);
+}
+
 static void
 gdk_surface_process_updates_internal (GdkSurface *surface)
 {
@@ -1530,8 +1549,13 @@ gdk_surface_thaw_updates (GdkSurface *surface)
           surface->pending_schedule_update = FALSE;
           gdk_surface_schedule_update (surface);
         }
-    }
 
+      if (surface->pending_request_compute_size)
+        {
+          surface->pending_request_compute_size = FALSE;
+          gdk_surface_request_compute_size (surface);
+        }
+    }
 }
 
 /*
diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h
index 5f5c3c178d..a6a981dbb8 100644
--- a/gdk/gdksurfaceprivate.h
+++ b/gdk/gdksurfaceprivate.h
@@ -54,6 +54,7 @@ struct _GdkSurface
   cairo_region_t *update_area;
   guint update_freeze_count;
   gboolean pending_schedule_update;
+  gboolean pending_request_compute_size;
   /* This is the update_area that was in effect when the current expose
      started. It may be smaller than the expose area if we'e painting
      more than we have to, but it represents the "true" damage. */
@@ -337,6 +338,8 @@ void       gdk_surface_emit_size_changed   (GdkSurface       *surface,
                                             int               width,
                                             int               height);
 
+void       gdk_surface_request_compute_size (GdkSurface      *surface);
+
 GDK_AVAILABLE_IN_ALL
 void           gdk_surface_request_motion (GdkSurface *surface);
 


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