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

This commit is contained in:
Jonas Ådahl
2020-11-24 16:03:07 +01:00
parent 4af54fb410
commit 68c14242b2
2 changed files with 28 additions and 1 deletions

View File

@@ -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);
}
}
}
/*

View File

@@ -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);