diff --git a/Source/Engine/Engine/Time.h b/Source/Engine/Engine/Time.h index ff81fb93e..a67f7c2c4 100644 --- a/Source/Engine/Engine/Time.h +++ b/Source/Engine/Engine/Time.h @@ -16,6 +16,7 @@ API_CLASS(Static) class FLAXENGINE_API Time friend class Engine; friend class TimeService; friend class PhysicsSettings; + friend Window; public: /// diff --git a/Source/Engine/Platform/Linux/LinuxPlatform.cpp b/Source/Engine/Platform/Linux/LinuxPlatform.cpp index 202f4a851..33de8cf4b 100644 --- a/Source/Engine/Platform/Linux/LinuxPlatform.cpp +++ b/Source/Engine/Platform/Linux/LinuxPlatform.cpp @@ -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); diff --git a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp index 26d6c5321..4ec4cead0 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp @@ -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); diff --git a/Source/Engine/Platform/SDL/SDLPlatform.cpp b/Source/Engine/Platform/SDL/SDLPlatform.cpp index ccf40470a..7a55ff6fb 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.cpp @@ -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;