diff --git a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp index 45d9dc095..5174f4973 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp @@ -21,6 +21,11 @@ #include "Engine/Profiler/ProfilerCPU.h" #include "Engine/Platform/Linux/IncludeX11.h" +namespace X11 +{ +#include +#include +} #include #include @@ -785,6 +790,32 @@ DragDropEffect Window::DoDragDropX11(const StringView& data) { X11::XNextEvent(xDisplay, &event); + // Hardcoded hack for SDL3 with X11 to end drag + if (event.type == XFixesSelectionNotifyEvent - 2) + break; + + if (event.type == GenericEvent) + { + X11::XGenericEventCookie& cookie = event.xcookie; + if (X11::XGetEventData(xDisplay, &cookie)) + { + switch (cookie.evtype) + { + case XI_Motion: + { + auto xev = (const X11::xXIDeviceEvent*)cookie.data; + // TODO: implement drag over/move/leave events via XInput2 and restore it in Editor (SDL_VIDEO_X11_XINPUT2=1 in SDLPlatform.cpp) + break; + } + default: + //LOG(Info, "Generic event: {}", (int32)cookie.evtype); + break; + } + X11::XFreeEventData(xDisplay, &cookie); + } + continue; + } + if (event.type == SelectionClear) break; if (event.type == SelectionRequest)