aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTudor Brindus <me@tbrindus.ca>2021-02-03 00:16:15 -0500
committerSimon Ser <contact@emersion.fr>2021-02-04 17:06:14 +0100
commit2fa257313ac888f8b61fba8e7c457eac9e1973c3 (patch)
treeefa2eff824f4207770ee97b28e4d02e097d65000 /include
parent7964a313e8c59ed664235884d9b612273b12fc57 (diff)
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.
Diffstat (limited to 'include')
-rw-r--r--include/xwayland/xwm.h5
1 files changed, 0 insertions, 5 deletions
diff --git a/include/xwayland/xwm.h b/include/xwayland/xwm.h
index f467e107..d12eb681 100644
--- a/include/xwayland/xwm.h
+++ b/include/xwayland/xwm.h
@@ -103,13 +103,8 @@ struct wlr_xwm {
xcb_render_pictformat_t render_format_id;
xcb_cursor_t cursor;
- // FIXME: need one per selection to simultaneously request both mimetypes,
- // I think.
- xcb_window_t selection_window;
struct wlr_xwm_selection clipboard_selection;
struct wlr_xwm_selection primary_selection;
-
- xcb_window_t dnd_window;
struct wlr_xwm_selection dnd_selection;
struct wlr_xwayland_surface *focus_surface;