From ddba811d8612dca8f5d13ac53bb443b6d7d8c803 Mon Sep 17 00:00:00 2001 From: Julien Lebosquain Date: Tue, 10 Feb 2026 16:04:37 +0000 Subject: [PATCH] Fix X11 clipboard manager store completion (#20514) * Fix X11 clipboard manager store completion * Restore storeAtomTcs completion on selection clear --- src/Avalonia.X11/Clipboard/X11Clipboard.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.X11/Clipboard/X11Clipboard.cs b/src/Avalonia.X11/Clipboard/X11Clipboard.cs index f0f4561945..6435e42e32 100644 --- a/src/Avalonia.X11/Clipboard/X11Clipboard.cs +++ b/src/Avalonia.X11/Clipboard/X11Clipboard.cs @@ -55,10 +55,9 @@ namespace Avalonia.X11.Clipboard _storedDataTransfer = null; _storeAtomTcs?.TrySetResult(true); - return; } - if (ev.type == XEventName.SelectionRequest) + else if (ev.type == XEventName.SelectionRequest) { var sel = ev.SelectionRequestEvent; var resp = new XEvent @@ -83,6 +82,17 @@ namespace Avalonia.X11.Clipboard XSendEvent(_x11.Display, sel.requestor, false, new IntPtr((int)EventMask.NoEventMask), ref resp); } + else if (ev.type == XEventName.SelectionNotify) + { + if (ev.SelectionEvent.selection == _x11.Atoms.CLIPBOARD_MANAGER && + ev.SelectionEvent.target == _x11.Atoms.SAVE_TARGETS && + _x11.Atoms.CLIPBOARD_MANAGER != IntPtr.Zero && + _x11.Atoms.SAVE_TARGETS != IntPtr.Zero) + { + _storeAtomTcs?.TrySetResult(true); + } + } + IntPtr WriteTargetToProperty(IntPtr target, IntPtr window, IntPtr property) { if (target == _x11.Atoms.TARGETS)