_x11 fixes

This commit is contained in:
2025-01-23 21:56:39 +02:00
parent aac7149106
commit 97ccb1cd21
4 changed files with 20 additions and 19 deletions

View File

@@ -913,6 +913,7 @@ DragDropEffect Window::DoDragDropX11(const StringView& data)
// Make sure SDL hasn't grabbed the pointer, and force ungrab it
XUngrabPointer(xDisplay, CurrentTime);
auto hintAutoCapture = SDL_GetHint(SDL_HINT_MOUSE_AUTO_CAPTURE);
SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, "0");
// Begin dragging
@@ -921,7 +922,7 @@ DragDropEffect Window::DoDragDropX11(const StringView& data)
if (X11::XGrabPointer(xDisplay, mainWindow, 1, Button1MotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, rootWindow, cursorWrong, CurrentTime) != GrabSuccess)
{
SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, "1");
SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, hintAutoCapture);
return DragDropEffect::None;
}
X11::XSetSelectionOwner(xDisplay, xAtomXdndSelection, mainWindow, CurrentTime);
@@ -1203,7 +1204,7 @@ DragDropEffect Window::DoDragDropX11(const StringView& data)
XUngrabPointer(xDisplay, CurrentTime);
X11::XFlush(xDisplay);
SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, "1");
SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, hintAutoCapture);
return result;
}
@@ -1544,7 +1545,7 @@ bool SDLPlatform::InitPlatformX11(void* display)
SDL_SetX11EventHook((SDL_X11EventHook)&X11EventHook, nullptr);
X11::XSetErrorHandler(X11ErrorHandler);
//xDisplay = X11::XOpenDisplay(nullptr);
xDisplay = X11::XOpenDisplay(nullptr);
xAtomDeleteWindow = X11::XInternAtom(xDisplay, "WM_DELETE_WINDOW", 0);
xAtomXdndEnter = X11::XInternAtom(xDisplay, "XdndEnter", 0);
xAtomXdndPosition = X11::XInternAtom(xDisplay, "XdndPosition", 0);