gdk/surface: Allow inhibit layout from backend

If compute_size() returns TRUE, the layout will not be propagated to
GTK. This will be used by the X11 backend to queue asynchronous resizes
that shouldn't yet allocate in GTK.
This commit is contained in:
Jonas Ådahl
2020-12-05 00:11:08 +01:00
parent ff23a2a582
commit 3bbeb891c4
4 changed files with 11 additions and 4 deletions

View File

@@ -1340,7 +1340,10 @@ gdk_surface_layout_on_clock (GdkFrameClock *clock,
class = GDK_SURFACE_GET_CLASS (surface);
if (class->compute_size)
class->compute_size (surface);
{
if (class->compute_size (surface))
return;
}
g_signal_emit (surface, signals[LAYOUT], 0, surface->width, surface->height);
}

View File

@@ -162,7 +162,7 @@ struct _GdkSurfaceClass
GdkGLContext *share,
GError **error);
void (* request_layout) (GdkSurface *surface);
void (* compute_size) (GdkSurface *surface);
gboolean (* compute_size) (GdkSurface *surface);
};
#define GDK_SURFACE_DESTROYED(d) (((GdkSurface *)(d))->destroyed)

View File

@@ -639,7 +639,7 @@ configure_drag_surface_geometry (GdkSurface *surface)
impl->scale);
}
static void
static gboolean
gdk_wayland_surface_compute_size (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
@@ -655,6 +655,8 @@ gdk_wayland_surface_compute_size (GdkSurface *surface)
impl->next_layout.surface_geometry_dirty = FALSE;
}
return FALSE;
}
static void

View File

@@ -295,7 +295,7 @@ gdk_x11_surface_request_layout (GdkSurface *surface)
}
}
static void
static gboolean
gdk_x11_surface_compute_size (GdkSurface *surface)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
@@ -352,6 +352,8 @@ gdk_x11_surface_compute_size (GdkSurface *surface)
impl->next_layout.surface_geometry_dirty = FALSE;
}
return surface->resize_count > 0;
}
gboolean