Commit Graph

46 Commits

Author SHA1 Message Date
Simon Ser ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
Manuel Stoeckl edb30a6828 Implement serial validation for selection requests
This change tracks, for each wlr_seat_client, the most recent serial
numbers which were sent to the client. When the client makes a
selection request, wlroots now verifies that the serial number
associated with the selection request was actually provided to that
specific client. This ensures that the client that was most
recently interacted with always has priority for its copy selection
requests, and that no other clients can incorrectly use a larger serial
value and "steal" the role of having the copy selection.

Also, the code used to determine when a given selection is superseded
by a newer request uses < instead of <= to allow clients to make
multiple selection requests with the same serial number and have the
last one hold.

To limit memory use, a ring buffer is used to store runs of sequential
serial numbers, and all serial numbers earlier than the start of the
ring buffer are assumed to be valid. Faking very old serials is
unlikely to be disruptive.

Assuming all clients are correctly written, the only additional
constraint which this patch should impose is that serial numbers
are now bound to seats: clients may not receive a serial number
from an input event on one seat and then use that to request
copy-selection on another seat.
2019-06-30 15:01:05 -04:00
emersion d6de640440
data-device: unbreak wl_data_source.cancel during drag-and-drop 2019-02-20 18:42:34 +01:00
emersion 6291e84532
data-device: refactor wlr_drag 2019-02-20 18:42:29 +01:00
emersion a1f9d7ad9e
data-device: keep track of wlr_data_offer in wlr_seat lists 2019-01-24 12:18:41 +01:00
emersion 909b3b16f3
data-device: add wlr_data_offer.type 2019-01-24 12:18:40 +01:00
emersion 0040f7089f
data-device: unexport wlr_seat_client_send_selection 2019-01-24 12:15:18 +01:00
emersion 1150ff13ce
data-device: make sources inert, rename cancel to destroy 2019-01-24 12:12:55 +01:00
emersion 4cb0697e57 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
2019-01-24 11:38:23 +01:00
emersion 06467d2e12
primary-selection: add a serial argument
The serial needs to be bumped when X11 clients set the selection, otherwise
some Wayland clients (e.g. GTK) will overwrite it when they gain focus.
2019-01-21 19:23:40 +01:00
emersion 5d26da9d15
data-device: allow multiple devices for the same seat
This commit makes it possible for a single client to have multiple data devices
for the same seat. This fixes issues with Firefox.

This mainly removes wlr_data_source.offer. We make sure we create one data
offer per device. We now make the offer inert when the source is destroyed.

Fixes the second half of https://github.com/swaywm/wlroots/issues/1041
2018-11-26 12:35:48 +01:00
emersion f44003f04b data-device: remove wlr_data_source.seat_client
Since the source doesn't always come from a client, this field
doesn't make sense. It is replaced by a new "finalized" field in
wlr_client_data_source. This is used to make sure set_actions is
not sent after start_drag has been sent.

A check in data_offer_choose_action has been removed: if an offer
has been sent then start_drag has been called, no need to check.

I also wanted to add a check for wl_data_source.offer, but it
turns out (1) this isn't in the spec (2) it breaks GTK+.

This is some preliminary work for Firefox on Wayland compatibility.
2018-10-07 16:01:57 +02:00
nyorain f6168c2afe Fix #1129 and remove sx, sy from wlr_drag_icon
sx, sy used to store the buffer offset of the drag surface which was
then be added (by rootston) to the drag icon position.
Buffer offsets are handled already in surface_intersect_output
(output.c) so they were added twice for dnd surfaces.
2018-09-07 14:48:28 +02:00
Drew DeVault 211ae764fd Initial pass on API stability guarantees
This introduces -DWLR_USE_UNSTABLE and adds information regarding the
stability status to all headers. I started with a conservative set of
headers to mark as stable:

- types/wlr_matrix.h
- util/edges.h
- util/log.h
- util/region.h
- xcursor.h
2018-07-29 19:20:34 -04:00
emersion deeca53e33
Rename wl_resources to resource, wl_global to global 2018-07-08 19:21:31 +01:00
Tony Crisci 319ebdf476 add back map event 2018-06-05 22:50:29 -04:00
Tony Crisci 1c75d4e54a rename drag-icon map to unmap 2018-06-05 18:17:42 -04:00
Tony Crisci 58d549c98a add data to wlr_drag_icon 2018-06-03 20:11:59 -04:00
emersion 5d37b14116
data-device: make sure resources are correctly destroyed 2018-05-03 20:22:51 +01:00
emersion d5f46f4db4
data-device: redesign wlr_data_source 2018-03-29 17:53:13 -04:00
emersion 2a34b154e6
xwayland: send DND_DROP 2018-03-28 15:33:23 -04:00
emersion 73394deb76
xwayland: send DND_POSITION 2018-03-28 14:16:14 -04:00
emersion 0d7a81ccdf
xwayland: send DND_ENTER 2018-03-28 12:59:11 -04:00
emersion 4d282c8590
rootston: damage tracking for drag icons 2018-01-23 13:37:58 +01:00
emersion f237b5c7a7
Make wlr_data_source abstract.
This removes some fields specific to sources coming from clients.

This adds some drag'n'drop-related callbacks.
2017-12-29 22:51:33 +01:00
emersion a79dc7df51
Merge pull request #524 from acrisci/role-committed
[wip] Role committed
2017-12-27 13:02:49 +01:00
Tony Crisci e42d762a88 drag-icon: surface committed 2017-12-27 06:41:14 -05:00
emersion 4a11609b76
Fix use-after-free when destroying selection sources 2017-12-25 18:18:26 +01:00
emersion 6dffaa7bb7
Implement xwayland primary selection sync 2017-12-25 16:10:16 +01:00
emersion c7900663bc
Add display destroy listener to data device 2017-12-07 00:50:55 +01:00
Tony Crisci af23192ede wlr-seat: remove client bound and unbound signal 2017-11-19 11:13:59 -05:00
Tony Crisci 3b74db467b data-device: wlr-drag-icon 2017-11-19 09:33:55 -05:00
Tony Crisci a337e95505 wlr-touch: make dnd work 2017-11-15 08:34:48 -05:00
Tony Crisci 6a516f7c41 basic touch dnd 2017-11-15 08:34:48 -05:00
Tony Crisci 94e7dc8a3e data-device: touch grab stubs 2017-11-15 08:34:48 -05:00
Timidger 80bf3cfff0 Fixes #399 Adds wlr_data_device_manager destructor
Fixed issues
2017-11-09 18:52:58 -08:00
Tony Crisci 1a756b3123 bugfix: dnd force cancel 2017-11-01 08:05:02 -04:00
Tony Crisci fddef4d58e rename seat handle to seat client 2017-10-30 08:37:54 -04:00
Tony Crisci 2d35e20691 data-device: keyboard grabs 2017-10-16 07:52:04 -04:00
Tony Crisci 02f4acc69f data-device: refactor set selections for xwayland 2017-10-15 14:49:43 -04:00
Tony Crisci df0a8d3abe wlr-data-device: drag icons 2017-10-15 11:06:03 -04:00
Tony Crisci a1bfa4a2f2 wlr-data-device: basic drag and drop 2017-10-15 05:59:52 -04:00
Tony Crisci 07259cf8ea wlr-data-device: source actions 2017-10-15 05:59:52 -04:00
Tony Crisci 25831d287e wlr-data-device: offer set actions 2017-10-15 05:59:52 -04:00
Tony Crisci 3892acecac wlr-data-device: basic clipboard 2017-10-15 05:59:52 -04:00
Tony Crisci 6a7560fae0 wlr-data-device interface 2017-10-15 05:59:52 -04:00