wayland: Use wl_compositor version 6

This gives us events for preferred_buffer_scale (which we ignore)
and preferred_buffer_transform (which we also currently ignore).
This commit is contained in:
Matthias Clasen 2024-04-21 19:27:58 -04:00
parent 5c972e4786
commit c0caae0ff0
2 changed files with 38 additions and 4 deletions

View File

@ -440,7 +440,7 @@ gdk_registry_handle_global (void *data,
{
display_wayland->compositor =
wl_registry_bind (display_wayland->wl_registry, id,
&wl_compositor_interface, MIN (version, 5));
&wl_compositor_interface, MIN (version, 6));
}
else if (strcmp (interface, "wl_shm") == 0)
{

View File

@ -821,6 +821,11 @@ gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
gdk_wayland_surface_update_size (surface,
surface->width, surface->height,
&GDK_FRACTIONAL_SCALE_INIT (scale));
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"preferred fractional scale, surface %p scale %f",
surface,
gdk_fractional_scale_to_double (&GDK_FRACTIONAL_SCALE_INIT (scale)));
}
static const struct wp_fractional_scale_v1_listener fractional_scale_listener = {
@ -837,8 +842,8 @@ surface_enter (void *data,
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GDK_DISPLAY_DEBUG(gdk_surface_get_display (surface), EVENTS,
"surface enter, surface %p output %p", surface, output);
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"surface enter, surface %p output %p", surface, output);
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
@ -870,9 +875,38 @@ surface_leave (void *data,
gdk_surface_leave_monitor (surface, monitor);
}
static void
surface_preferred_buffer_scale (void *data,
struct wl_surface *wl_surface,
int32_t factor)
{
GdkSurface *surface = GDK_SURFACE (data);
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"preferred buffer scale, surface %p scale %d",
surface, factor);
}
static void
surface_preferred_buffer_transform (void *data,
struct wl_surface *wl_surface,
uint32_t transform)
{
GdkSurface *surface = GDK_SURFACE (data);
const char *transform_name[] = {
"normal", "90", "180", "270", "flipped", "flipped-90", "flipped-180", "flipped-270"
};
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"preferred buffer transform, surface %p transform %s",
surface, transform_name[transform]);
}
static const struct wl_surface_listener surface_listener = {
surface_enter,
surface_leave
surface_leave,
surface_preferred_buffer_scale,
surface_preferred_buffer_transform,
};
static void