Merge branch 'wayland-empty-frame' into 'main'

wayland: Add a way to check if a surface is dirty

See merge request GNOME/gtk!6822
This commit is contained in:
Matthias Clasen
2024-01-28 17:02:29 +00:00
3 changed files with 14 additions and 2 deletions

View File

@@ -87,9 +87,8 @@ static void
gdk_wayland_gl_context_empty_frame (GdkDrawContext *draw_context)
{
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (impl->has_pending_subsurface_commits)
if (gdk_wayland_surface_needs_commit (surface))
{
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);

View File

@@ -129,6 +129,7 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
guint *next_image_delay);
void gdk_wayland_surface_sync (GdkSurface *surface);
gboolean gdk_wayland_surface_needs_commit (GdkSurface *surface);
void gdk_wayland_surface_commit (GdkSurface *surface);
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
void gdk_wayland_surface_request_frame (GdkSurface *surface);

View File

@@ -746,6 +746,18 @@ gdk_wayland_surface_sync (GdkSurface *surface)
gdk_wayland_surface_sync_viewport (surface);
}
gboolean
gdk_wayland_surface_needs_commit (GdkSurface *surface)
{
GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (surface);
return self->has_pending_subsurface_commits ||
self->opaque_region_dirty ||
self->input_region_dirty ||
self->buffer_scale_dirty ||
self->viewport_dirty;
}
static void
gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
struct wp_fractional_scale_v1 *fractional_scale,