xwayland: Add primary selection and data device protocols

This is preparation work for the next commit.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
This commit is contained in:
Olivier Fourdan 2026-03-11 14:25:52 +01:00
parent 7861fe9c54
commit d0f41bbf35
3 changed files with 21 additions and 0 deletions

View file

@ -52,6 +52,7 @@ tearing_xml = join_paths(protodir, 'staging', 'tearing-control', 'tearing-contro
fractional_scale_xml = join_paths(protodir, 'staging', 'fractional-scale', 'fractional-scale-v1.xml')
syncobj_xml = join_paths(protodir, 'staging', 'linux-drm-syncobj', 'linux-drm-syncobj-v1.xml')
system_bell_xml = join_paths(protodir, 'staging', 'xdg-system-bell', 'xdg-system-bell-v1.xml')
primary_selection_xml = join_paths(protodir, 'unstable', 'primary-selection', 'primary-selection-unstable-v1.xml')
proto_xml = [
relative_xml,
@ -70,6 +71,7 @@ proto_xml = [
fractional_scale_xml,
syncobj_xml,
system_bell_xml,
primary_selection_xml,
]
client_header = generator(scanner,

View file

@ -73,6 +73,7 @@
#include "xwayland-shell-v1-client-protocol.h"
#include "tearing-control-v1-client-protocol.h"
#include "fractional-scale-v1-client-protocol.h"
#include "primary-selection-unstable-v1-client-protocol.h"
static DevPrivateKeyRec xwl_screen_private_key;
static DevPrivateKeyRec xwl_client_private_key;
@ -258,6 +259,14 @@ xwl_close_screen(ScreenPtr screen)
xwl_seat_destroy(xwl_seat);
xwl_screen_release_tablet_manager(xwl_screen);
if (xwl_screen->data_device_manager) {
wl_data_device_manager_destroy(xwl_screen->data_device_manager);
xwl_screen->data_device_manager = NULL;
}
if (xwl_screen->primary_selection_manager) {
zwp_primary_selection_device_manager_v1_destroy(xwl_screen->primary_selection_manager);
xwl_screen->primary_selection_manager = NULL;
}
struct xwl_drm_lease_device *device_data, *next;
xorg_list_for_each_entry_safe(device_data, next,
@ -551,6 +560,14 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
xwl_screen->fractional_scale_manager =
wl_registry_bind(registry, id, &wp_fractional_scale_manager_v1_interface, 1);
}
else if (!xwl_screen->rootless && strcmp(interface, wl_data_device_manager_interface.name) == 0) {
xwl_screen->data_device_manager =
wl_registry_bind(registry, id, &wl_data_device_manager_interface, 1);
}
else if (!xwl_screen->rootless && strcmp(interface, zwp_primary_selection_device_manager_v1_interface.name) == 0) {
xwl_screen->primary_selection_manager =
wl_registry_bind(registry, id, &zwp_primary_selection_device_manager_v1_interface, 1);
}
#ifdef XWL_HAS_GLAMOR
else if (xwl_screen->glamor) {
xwl_glamor_init_wl_registry(xwl_screen, registry, id, interface,

View file

@ -119,6 +119,8 @@ struct xwl_screen {
struct wp_fractional_scale_manager_v1 *fractional_scale_manager;
struct wp_linux_drm_syncobj_manager_v1 *explicit_sync;
struct xdg_system_bell_v1 *system_bell;
struct wl_data_device_manager *data_device_manager;
struct zwp_primary_selection_device_manager_v1 *primary_selection_manager;
struct xorg_list drm_lease_devices;
struct xorg_list queued_drm_lease_devices;
struct xorg_list drm_leases;