tests/wayland-test-client-utils: Allow to bind to cursor shape

Also allow specifying to version so we can test version specific things.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4307>
This commit is contained in:
Sebastian Wick 2025-02-28 00:27:13 +01:00 committed by Marge Bot
parent 0e4f4147a2
commit b18565cee6
2 changed files with 15 additions and 0 deletions

View File

@ -454,6 +454,18 @@ handle_registry_global (void *user_data,
wl_registry_bind (registry, id,
&wp_color_manager_v1_interface, 1);
}
else if (strcmp (interface, wp_cursor_shape_manager_v1_interface.name) == 0)
{
int cusor_shape_version = 1;
if (display->capabilities & WAYLAND_DISPLAY_CAPABILITY_CURSOR_SHAPE_V2)
cusor_shape_version = 2;
display->cursor_shape_mgr =
wl_registry_bind (registry, id,
&wp_cursor_shape_manager_v1_interface,
cusor_shape_version);
}
else if (strcmp (interface, wp_viewporter_interface.name) == 0)
{
display->viewporter = wl_registry_bind (registry, id,

View File

@ -7,6 +7,7 @@
#include <wayland-client.h>
#include "color-management-v1-client-protocol.h"
#include "cursor-shape-v1-client-protocol.h"
#include "fractional-scale-v1-client-protocol.h"
#include "linux-dmabuf-v1-client-protocol.h"
#include "single-pixel-buffer-v1-client-protocol.h"
@ -20,6 +21,7 @@ typedef enum _WaylandDisplayCapabilities
WAYLAND_DISPLAY_CAPABILITY_TEST_DRIVER = 1 << 0,
WAYLAND_DISPLAY_CAPABILITY_XDG_SHELL_V4 = 1 << 1,
WAYLAND_DISPLAY_CAPABILITY_XDG_SHELL_V6 = 1 << 2,
WAYLAND_DISPLAY_CAPABILITY_CURSOR_SHAPE_V2 = 1 << 3,
} WaylandDisplayCapabilities;
typedef struct _DmaBufFormat
@ -44,6 +46,7 @@ typedef struct _WaylandDisplay
struct wp_fractional_scale_manager_v1 *fractional_scale_mgr;
struct wp_single_pixel_buffer_manager_v1 *single_pixel_mgr;
struct wp_color_manager_v1 *color_management_mgr;
struct wp_cursor_shape_manager_v1 *cursor_shape_mgr;
struct wp_viewporter *viewporter;
struct xdg_wm_base *xdg_wm_base;
struct wl_seat *wl_seat;