From 8163f7e1e21d9b039319cc3e38993811bfbeea4f Mon Sep 17 00:00:00 2001 From: emersion Date: Thu, 24 Jan 2019 12:04:41 +0100 Subject: primary-selection-v1: copy from gtk-primary-selection --- include/wlr/types/meson.build | 1 + include/wlr/types/wlr_primary_selection_v1.h | 52 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 include/wlr/types/wlr_primary_selection_v1.h (limited to 'include') diff --git a/include/wlr/types/meson.build b/include/wlr/types/meson.build index 82715ad1..fe39db36 100644 --- a/include/wlr/types/meson.build +++ b/include/wlr/types/meson.build @@ -28,6 +28,7 @@ install_headers( 'wlr_pointer_gestures_v1.h', 'wlr_pointer.h', 'wlr_presentation_time.h', + 'wlr_primary_selection_v1.h', 'wlr_primary_selection.h', 'wlr_region.h', 'wlr_relative_pointer_v1.h', diff --git a/include/wlr/types/wlr_primary_selection_v1.h b/include/wlr/types/wlr_primary_selection_v1.h new file mode 100644 index 00000000..e6bde8a3 --- /dev/null +++ b/include/wlr/types/wlr_primary_selection_v1.h @@ -0,0 +1,52 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + +#ifndef WLR_TYPES_WLR_PRIMARY_SELECTION_V1_H +#define WLR_TYPES_WLR_PRIMARY_SELECTION_V1_H + +#include +#include + +struct wlr_primary_selection_v1_device_manager { + struct wl_global *global; + struct wl_list resources; // wl_resource_get_link + struct wl_list devices; // wlr_primary_selection_v1_device::link + + struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +/** + * A device is a per-seat object used to set and get the current selection. + */ +struct wlr_primary_selection_v1_device { + struct wlr_primary_selection_v1_device_manager *manager; + struct wlr_seat *seat; + struct wl_list link; // wlr_primary_selection_v1_device_manager::devices + struct wl_list resources; // wl_resource_get_link + + struct wl_list offers; // wl_resource_get_link + + struct wl_listener seat_destroy; + struct wl_listener seat_focus_change; + struct wl_listener seat_set_primary_selection; + + void *data; +}; + +struct wlr_primary_selection_v1_device_manager * + wlr_primary_selection_v1_device_manager_create(struct wl_display *display); +void wlr_primary_selection_v1_device_manager_destroy( + struct wlr_primary_selection_v1_device_manager *manager); + +#endif -- cgit v1.2.3