Merge branch 'wayland-min-version' into 'main'

wayland: Check some required globals

See merge request GNOME/gtk!7062
This commit is contained in:
Matthias Clasen 2024-03-20 02:57:06 +00:00
commit 3b87903889
3 changed files with 21 additions and 11 deletions

View File

@ -310,7 +310,8 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
if (buffer)
{
wl_surface_attach (pointer->pointer_surface, buffer, 0, 0);
wl_surface_set_buffer_scale (pointer->pointer_surface, scale);
if (wl_surface_get_version (pointer->pointer_surface) >= WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
wl_surface_set_buffer_scale (pointer->pointer_surface, scale);
wl_surface_damage (pointer->pointer_surface, 0, 0, w, h);
wl_surface_commit (pointer->pointer_surface);
}

View File

@ -95,7 +95,6 @@
#define GTK_SHELL1_VERSION 5
#define OUTPUT_VERSION_WITH_DONE 2
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
#define XDG_ACTIVATION_VERSION 1
#define OUTPUT_VERSION 3
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
@ -585,22 +584,19 @@ gdk_registry_handle_global (void *data,
{
display_wayland->xdg_activation =
wl_registry_bind (display_wayland->wl_registry, id,
&xdg_activation_v1_interface,
MIN (version, XDG_ACTIVATION_VERSION));
&xdg_activation_v1_interface, 1);
}
else if (strcmp (interface, "wp_fractional_scale_manager_v1") == 0)
{
display_wayland->fractional_scale =
wl_registry_bind (display_wayland->wl_registry, id,
&wp_fractional_scale_manager_v1_interface,
MIN (version, 1));
&wp_fractional_scale_manager_v1_interface, 1);
}
else if (strcmp (interface, "wp_viewporter") == 0)
{
display_wayland->viewporter =
wl_registry_bind (display_wayland->wl_registry, id,
&wp_viewporter_interface,
MIN (version, 1));
&wp_viewporter_interface, 1);
}
@ -700,7 +696,8 @@ _gdk_wayland_display_open (const char *display_name)
process_on_globals_closures (display_wayland);
/* Wait for initializing to complete. This means waiting for all
* asynchronous roundtrips that were triggered during initial roundtrip. */
* asynchronous roundtrips that were triggered during initial roundtrip.
*/
while (display_wayland->async_roundtrips != NULL)
{
if (wl_display_dispatch (display_wayland->wl_display) < 0)
@ -710,6 +707,18 @@ _gdk_wayland_display_open (const char *display_name)
}
}
/* Check that we got all the required globals */
if (display_wayland->compositor == NULL ||
display_wayland->shm == NULL ||
display_wayland->data_device_manager == NULL)
{
g_warning ("The Wayland compositor does not provide one or more of the required interfaces, "
"not using Wayland display");
g_object_unref (display);
return NULL;
}
if (display_wayland->xdg_wm_base_id)
{
display_wayland->shell_variant = GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL;

View File

@ -466,9 +466,9 @@ gdk_wayland_surface_create_subsurface (GdkSurface *surface)
GdkWaylandSubsurface *sub;
struct wl_region *region;
if (disp->viewporter == NULL)
if (disp->subcompositor == NULL || disp->viewporter == NULL)
{
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Can't use subsurfaces without viewporter");
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Can't use subsurfaces without subcompositor and viewporter");
return NULL;
}