mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
fix: send XdndStatus(rejected) instead of XdndFinished on non-accepting window
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/dc998620-35db-456d-8355-63e39f385464 Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
3118901800
commit
c7ded8b8fd
33
glfw/x11_window.c
vendored
33
glfw/x11_window.c
vendored
@@ -1580,25 +1580,24 @@ update_drop_state(_GLFWwindow* window, size_t accepted_count) {
|
||||
if (new_preferred_mime) strncpy(dnd.format, new_preferred_mime, arraysz(dnd.format)-1);
|
||||
else dnd.format[0] = 0;
|
||||
}
|
||||
if (accepted) {
|
||||
XEvent reply = { ClientMessage };
|
||||
reply.xclient.window = dnd.source;
|
||||
reply.xclient.message_type = _glfw.x11.XdndStatus;
|
||||
reply.xclient.format = 32;
|
||||
reply.xclient.data.l[0] = window->x11.handle;
|
||||
reply.xclient.data.l[2] = 0; // Specify an empty rectangle
|
||||
reply.xclient.data.l[3] = 0;
|
||||
XEvent reply = { ClientMessage };
|
||||
reply.xclient.window = dnd.source;
|
||||
reply.xclient.message_type = _glfw.x11.XdndStatus;
|
||||
reply.xclient.format = 32;
|
||||
reply.xclient.data.l[0] = window->x11.handle;
|
||||
reply.xclient.data.l[2] = 0; // Specify an empty rectangle
|
||||
reply.xclient.data.l[3] = 0;
|
||||
|
||||
if (dnd.format_priority > 0 && accepted) {
|
||||
// Reply that we are ready to copy the dragged data
|
||||
reply.xclient.data.l[1] = 1; // Accept with no rectangle
|
||||
if (_glfw.x11.xdnd.version >= 2) reply.xclient.data.l[4] = _glfw.x11.XdndActionCopy;
|
||||
}
|
||||
XSendEvent(_glfw.x11.display, _glfw.x11.xdnd.source, False, NoEventMask, &reply);
|
||||
XFlush(_glfw.x11.display);
|
||||
} else {
|
||||
end_drop(window, GLFW_DRAG_OPERATION_GENERIC);
|
||||
if (accepted && dnd.format_priority > 0) {
|
||||
// Reply that we are ready to copy the dragged data
|
||||
reply.xclient.data.l[1] = 1; // Accept with no rectangle
|
||||
if (_glfw.x11.xdnd.version >= 2) reply.xclient.data.l[4] = _glfw.x11.XdndActionCopy;
|
||||
}
|
||||
// Always send XdndStatus (accepted or rejected). XdndFinished must only be
|
||||
// sent after XdndDrop, never during drag motion — sending it here was
|
||||
// prematurely terminating the drag source when no MIME type was accepted.
|
||||
XSendEvent(_glfw.x11.display, _glfw.x11.xdnd.source, False, NoEventMask, &reply);
|
||||
XFlush(_glfw.x11.display);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user