From 367b488e47989c4114ee43c000a6fa04e1f9a78c Mon Sep 17 00:00:00 2001 From: Ollie Date: Thu, 28 May 2026 21:04:24 +0200 Subject: [PATCH] =?UTF-8?q?selection:=20push=20data=20to=20compositor=20on?= =?UTF-8?q?=20acquire=20for=20Wayland=20(select=E2=86=92paste)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WINGs/selection_x11.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/WINGs/selection_x11.c b/WINGs/selection_x11.c index 6507730..4380458 100644 --- a/WINGs/selection_x11.c +++ b/WINGs/selection_x11.c @@ -353,6 +353,26 @@ Bool WMCreateSelectionHandler(WMView * view, WMNativeAtom selection, Time timest WMAddToArray(selHandlers, handler); + /* On Wayland (no X11 SelectionRequest events), immediately push + * the selection data via the clipboard store path so external + * clients can paste it. The data is fetched from the view's + * convertSelection callback. */ + if (vb->selection_fetch && handler->procs.convertSelection) { + WMNativeAtom textAtom = XA_STRING; + WMNativeAtom type; + WMData *data = handler->procs.convertSelection(handler->view, + selection, textAtom, handler->data, &type); + if (data) { + if (view->screen->viewBackend->clipboard_store) { + view->screen->viewBackend->clipboard_store( + view->screen->viewBackendCtx, + WMDataBytes(data), + WMGetDataLength(data)); + } + WMReleaseData(data); + } + } + return True; }