From f241165c195897d90be02452cd14314eecb9e730 Mon Sep 17 00:00:00 2001 From: 56789a1987 <47248675+56789a1987@users.noreply.github.com> Date: Wed, 18 Dec 2024 21:10:46 +0800 Subject: [PATCH] [x11] Fix drag & drop receiving incorrect file with some file managers On Dolphin file manager, dropping file always returns the first file. --- os/x11/window.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/os/x11/window.cpp b/os/x11/window.cpp index 2dc2a2b04..f777d80c1 100644 --- a/os/x11/window.cpp +++ b/os/x11/window.cpp @@ -1252,13 +1252,17 @@ void WindowX11::processX11Event(XEvent& event) XSendEvent(m_display, sourceWindow, 0, 0, &event2); } else if (event.xclient.message_type == XdndDrop) { + // The time stamp must be passed to XConvertSelection + // to insure that the correct data is received. + const Time time = event.xclient.data.l[2]; + // Save the X11 window from where this XdndDrop message came // from, so then we can send a XdndFinished later. g_dndSource = (::Window)event.xclient.data.l[0]; // Ask for the XdndSelection, we're going to receive the // dropped items in the SelectionNotify. - XConvertSelection(m_display, XdndSelection, URI_LIST, XdndSelection, m_window, CurrentTime); + XConvertSelection(m_display, XdndSelection, URI_LIST, XdndSelection, m_window, time); } break;