mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-01 22:58:38 -04:00
gtk-primary-selection: refactor everything, untie from seat
This commits completely refactors wlr_gtk_primary_selection. The goal is to remove gtk-primary-selection state from the seat and better handle inert resources where it makes sense. wlr_seat_client.primary_selection_devices has been removed and replaced by wlr_gtk_primary_selection_device. This allows us to make offers inert when the current selection is replaced. wlr_seat_set_primary_selection has been removed because it relied on wlr_seat instead of wlr_gtk_primary_selection_device_manager. A new function, wlr_gtk_primary_selection_device_manager_set_selection (candidate for the longest function name in wlroots) has been added. It doesn't take a serial anymore as serial checking only makes sense for set_selection requests coming from Wayland clients (serial checking is now done in the Wayland interface implementation). Since wlr_gtk_primary_selection_device_manager is now required to set the selection, a new function wlr_xwayland_set_gtk_primary_selection_device_manager (candidate number two for longest function name) has been added. Devices are now made inert when the seat goes away. Future work includes removing the last primary selection bits from the seat, mainly wlr_seat.primary_selection_source and wlr_seat.events.primary_selection, replacing those with new fields in wlr_gtk_primary_selection_device. Or maybe we could keep those in the seat and replace them with a re-usable interface (for future zwp_primary_selection_v1 support). We need to think how we'll sync these three protocols (GTK, X11 and wayland-protocols). See https://github.com/swaywm/wlroots/issues/1388
This commit is contained in:
parent
05bb440786
commit
f001f98cef
10 changed files with 314 additions and 145 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue