diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/wlr/types/wlr_gtk_primary_selection.h | 41 | ||||
-rw-r--r-- | include/wlr/types/wlr_seat.h | 12 | ||||
-rw-r--r-- | include/wlr/xwayland.h | 9 |
3 files changed, 52 insertions, 10 deletions
diff --git a/include/wlr/types/wlr_gtk_primary_selection.h b/include/wlr/types/wlr_gtk_primary_selection.h index f3410f69..e2019123 100644 --- a/include/wlr/types/wlr_gtk_primary_selection.h +++ b/include/wlr/types/wlr_gtk_primary_selection.h @@ -14,7 +14,8 @@ struct wlr_gtk_primary_selection_device_manager { struct wl_global *global; - struct wl_list resources; + struct wl_list resources; // wl_resource_get_link + struct wl_list devices; // wlr_gtk_primary_selection_device::link struct wl_listener display_destroy; @@ -25,6 +26,28 @@ struct wlr_gtk_primary_selection_device_manager { void *data; }; +/** + * A device is a per-seat object used to set and get the current selection. + */ +struct wlr_gtk_primary_selection_device { + struct wlr_gtk_primary_selection_device_manager *manager; + struct wlr_seat *seat; + struct wl_list link; // wlr_gtk_primary_selection_device_manager::devices + struct wl_list resources; // wl_resource_get_link + + struct wlr_gtk_primary_selection_source *source; + struct wl_list offers; // wlr_gtk_primary_selection_offer::link + + struct wl_listener seat_destroy; + struct wl_listener seat_focus_change; + struct wl_listener source_destroy; + + void *data; +}; + +/** + * A source is the sending side of a selection. + */ struct wlr_gtk_primary_selection_source { // source metadata struct wl_array mime_types; @@ -34,9 +57,6 @@ struct wlr_gtk_primary_selection_source { const char *mime_type, int32_t fd); void (*cancel)(struct wlr_gtk_primary_selection_source *source); - // source status - struct wlr_seat_client *seat_client; - struct { struct wl_signal destroy; } events; @@ -44,9 +64,15 @@ struct wlr_gtk_primary_selection_source { void *data; }; +/** + * An offer is the receiving side of a selection. When the selection is set, + * offers are created for the currently focused client and can be used to + * initiate the data transfer. + */ struct wlr_gtk_primary_selection_offer { struct wl_resource *resource; struct wlr_gtk_primary_selection_source *source; + struct wl_list link; // wlr_gtk_primary_selection_device::offers struct wl_listener source_destroy; @@ -58,9 +84,10 @@ struct wlr_gtk_primary_selection_device_manager * void wlr_gtk_primary_selection_device_manager_destroy( struct wlr_gtk_primary_selection_device_manager *manager); -void wlr_seat_client_send_gtk_primary_selection(struct wlr_seat_client *seat_client); -void wlr_seat_set_gtk_primary_selection(struct wlr_seat *seat, - struct wlr_gtk_primary_selection_source *source, uint32_t serial); +void wlr_gtk_primary_selection_device_manager_set_selection( + struct wlr_gtk_primary_selection_device_manager *manager, + struct wlr_seat *seat, + struct wlr_gtk_primary_selection_source *source); void wlr_gtk_primary_selection_source_init( struct wlr_gtk_primary_selection_source *source); diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 9670e6a5..f064c3bb 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -30,7 +30,6 @@ struct wlr_seat_client { struct wl_list keyboards; struct wl_list touches; struct wl_list data_devices; - struct wl_list primary_selection_devices; struct { struct wl_signal destroy; @@ -168,6 +167,10 @@ struct wlr_seat_keyboard_state { struct wlr_seat_keyboard_grab *grab; struct wlr_seat_keyboard_grab *default_grab; + + struct { + struct wl_signal focus_change; // wlr_seat_keyboard_focus_change_event + } events; }; struct wlr_seat_touch_state { @@ -194,6 +197,7 @@ struct wlr_seat { struct wlr_data_source *selection_source; uint32_t selection_serial; + // not owned by the seat struct wlr_gtk_primary_selection_source *primary_selection_source; uint32_t primary_selection_serial; @@ -208,7 +212,6 @@ struct wlr_seat { struct wl_listener display_destroy; struct wl_listener selection_source_destroy; - struct wl_listener primary_selection_source_destroy; struct wl_listener drag_source_destroy; struct { @@ -248,6 +251,11 @@ struct wlr_seat_pointer_focus_change_event { double sx, sy; }; +struct wlr_seat_keyboard_focus_change_event { + struct wlr_seat *seat; + struct wlr_surface *old_surface, *new_surface; +}; + /** * Allocates a new wlr_seat and adds a wl_seat global to the display. */ diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 8247aa15..9a7f0f07 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -18,6 +18,7 @@ struct wlr_xwm; struct wlr_xwayland_cursor; +struct wlr_gtk_primary_selection_device_manager; struct wlr_xwayland { pid_t pid; @@ -42,13 +43,15 @@ struct wlr_xwayland { struct wl_display *wl_display; struct wlr_compositor *compositor; struct wlr_seat *seat; - struct wl_listener seat_destroy; + struct wlr_gtk_primary_selection_device_manager *gtk_primary_selection; struct { struct wl_signal ready; struct wl_signal new_surface; } events; + struct wl_listener seat_destroy; + /** * Add a custom event handler to xwayland. Return 1 if the event was * handled or 0 to use the default wlr-xwayland handler. wlr-xwayland will @@ -223,6 +226,10 @@ void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface, void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland, struct wlr_seat *seat); +void wlr_xwayland_set_gtk_primary_selection_device_manager( + struct wlr_xwayland *xwayland, + struct wlr_gtk_primary_selection_device_manager *manager); + bool wlr_surface_is_xwayland_surface(struct wlr_surface *surface); struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface( |