wlroots-hyprland/include
Tudor Brindus 2fa257313a xwayland/selection: use one target window per selection
Previously, the clipboard and primary selections shared the same window.
This was racey, and could have led to pasting failures.

On xfixes selection owner change notification, the logic for requesting
the supported mimetypes of the new owner's selection looks like:

  xcb_convert_selection(
    xwm->xcb_conn,
    selection->window,
    selection->atom,
    xwm->atoms[TARGETS],
    xwm->atoms[WL_SELECTION],
    selection->timestamp
  );

This means ask the selection owner to write its TARGETS for the
`selection->atom` selection (one of PRIMARY, CLIPBOARD, DND_SELECTION)
to `selection->window`'s WL_SELECTION atom.

However, `selection->window` is shared for both PRIMARY and CLIPBOARD
selections, and WL_SELECTION is used as the target atom in both cases.
So, there's a race when both selections change at the same time.

The CLIPBOARD selection might support mimetypes {A, B, C}, and the
PRIMARY only {A, B}. If the ConvertSelection requests/responses "cross
on the wire", so to speak, wlroots can end up believing that the PRIMARY
selection also supports C.

A Wayland client may then ask for the PRIMARY selection in C format,
which will fail with "convert selection failed".

This commit fixes this by using a separate window for PRIMARY and
CLIPBOARD target requests, so that WL_SELECTION can be used as the
target atom in both cases.
2021-02-04 17:06:14 +01:00
..
backend backend/drm: don't blit in drm_fb_import 2021-01-24 18:33:56 +01:00
render render: introduce private wlr_renderer_autocreate_with_drm_fd 2021-01-16 22:52:26 +01:00
types region: make wlr_region_create private 2021-02-02 23:42:53 +01:00
util util: add support for generating UUIDs 2021-01-05 20:32:56 +01:00
wlr region: make wlr_region_create private 2021-02-02 23:42:53 +01:00
xcursor Use fixed size integer type 2020-09-01 11:58:56 +02:00
xwayland xwayland/selection: use one target window per selection 2021-02-04 17:06:14 +01:00
meson.build types: add wlr_xdg_foreign_v2 2021-01-05 20:32:56 +01:00