_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

@@ -16,6 +16,7 @@ API_CLASS(Static) class FLAXENGINE_API Time
friend class Engine;
friend class TimeService;
friend class PhysicsSettings;
friend Window;
public:
/// <summary>

View File

@@ -1396,11 +1396,7 @@ DragDropEffect Window::DoDragDrop(const StringView& data)
StringAnsi dataAnsi(data);
LinuxDropTextData dropData;
dropData.Text = data;
#if !PLATFORM_SDL
unsigned long mainWindow = _window;
#else
unsigned long mainWindow = (unsigned long)_handle;
#endif
// Begin dragging
auto screen = X11::XDefaultScreen(xDisplay);

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);

View File

@@ -50,8 +50,8 @@ bool SDLPlatform::Init()
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "x11", SDL_HINT_OVERRIDE);
else if (CommandLine::Options.Wayland)
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
else
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
//else
// SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
#endif
#if PLATFORM_LINUX
@@ -83,17 +83,20 @@ bool SDLPlatform::Init()
SDL_SetHint(SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY, "1");
#if PLATFORM_WINDOWS
// Disable SDL clipboard support
SDL_SetEventEnabled(SDL_EVENT_CLIPBOARD_UPDATE, false);
//#if PLATFORM_WINDOWS
//if (UsesWindows() || UsesX11())
{
// Disable SDL clipboard support
SDL_SetEventEnabled(SDL_EVENT_CLIPBOARD_UPDATE, false);
// Disable SDL drag and drop support
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, false);
SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, false);
SDL_SetEventEnabled(SDL_EVENT_DROP_BEGIN, false);
SDL_SetEventEnabled(SDL_EVENT_DROP_COMPLETE, false);
SDL_SetEventEnabled(SDL_EVENT_DROP_POSITION, false);
#endif
// Disable SDL drag and drop support
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, false);
SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, false);
SDL_SetEventEnabled(SDL_EVENT_DROP_BEGIN, false);
SDL_SetEventEnabled(SDL_EVENT_DROP_COMPLETE, false);
SDL_SetEventEnabled(SDL_EVENT_DROP_POSITION, false);
}
//#endif
//if (InitPlatform())
// return true;