mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-24 06:59:45 -05:00
data-device, primary-selection: add request_set_selection
This makes compositors able to block and/or customize set_selection requests coming from clients. For instance, it's possible for a compositor to disable rich selection content (by removing all MIME types except text/plain). This commit implements the design proposed in [1]. Two new events are added to wlr_seat: request_set_selection and request_set_primary_selection. Compositors need to listen to these events and either destroy the source or effectively set the selection. Fixes https://github.com/swaywm/wlroots/issues/1138 [1]: https://github.com/swaywm/wlroots/issues/1367#issuecomment-442403454
This commit is contained in:
parent
c41d01306d
commit
4cb0697e57
15 changed files with 142 additions and 63 deletions
|
|
@ -350,7 +350,7 @@ static void xwm_selection_get_targets(struct wlr_xwm_selection *selection) {
|
|||
bool ok = source_get_targets(selection, &source->base.mime_types,
|
||||
&source->mime_types_atoms);
|
||||
if (ok) {
|
||||
wlr_seat_set_selection(xwm->seat, &source->base,
|
||||
wlr_seat_request_set_selection(xwm->seat, &source->base,
|
||||
wl_display_next_serial(xwm->xwayland->wl_display));
|
||||
} else {
|
||||
wlr_data_source_cancel(&source->base);
|
||||
|
|
@ -425,10 +425,10 @@ int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
|
|||
// A real X client selection went away, not our
|
||||
// proxy selection
|
||||
if (selection == &xwm->clipboard_selection) {
|
||||
wlr_seat_set_selection(xwm->seat, NULL,
|
||||
wlr_seat_request_set_selection(xwm->seat, NULL,
|
||||
wl_display_next_serial(xwm->xwayland->wl_display));
|
||||
} else if (selection == &xwm->primary_selection) {
|
||||
wlr_seat_set_primary_selection(xwm->seat, NULL,
|
||||
wlr_seat_request_set_primary_selection(xwm->seat, NULL,
|
||||
wl_display_next_serial(xwm->xwayland->wl_display));
|
||||
} else if (selection == &xwm->dnd_selection) {
|
||||
// TODO: DND
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue