diff --git a/Source/Engine/Platform/SDL/SDLPlatform.cpp b/Source/Engine/Platform/SDL/SDLPlatform.cpp index a3952495a..f9bfd096a 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.cpp @@ -217,9 +217,15 @@ void SDLPlatform::Tick() if (draggedWindow == nullptr) return true; + // When the window is being dragged on Windows, the internal message loop is blocking + // the SDL event queue. We need to handle all relevant events in this event watch callback + // to ensure dragging related functionality doesn't break due to engine not getting updated. + // This also happens to fix the engine freezing during the dragging operation. + SDLWindow* window = SDLWindow::GetWindowFromEvent(*event); if (event->type == SDL_EVENT_WINDOW_EXPOSED) { + // The internal timer is sending exposed events every ~16ms Engine::OnUpdate();//Scripting::Update(); // For docking updates Engine::OnDraw(); return false; diff --git a/Source/Engine/Platform/SDL/SDLWindow.cpp b/Source/Engine/Platform/SDL/SDLWindow.cpp index e5c46f5ed..894397a63 100644 --- a/Source/Engine/Platform/SDL/SDLWindow.cpp +++ b/Source/Engine/Platform/SDL/SDLWindow.cpp @@ -67,6 +67,11 @@ void GetRelativeWindowOffset(WindowType type, SDLWindow* parentWindow, Int2& pos Int2 GetSDLWindowScreenPosition(const SDLWindow* window); void SetSDLWindowScreenPosition(const SDLWindow* window, const int x, const int y); +bool IsPopupWindow(WindowType type) +{ + return type == WindowType::Popup || type == WindowType::Tooltip; +} + class SDLDropFilesData : public IGuiData { public: @@ -824,7 +829,7 @@ void SDLWindow::Show() BringToFront(); // Reused top-most windows doesn't stay on top for some reason - if (_settings.IsTopmost && _settings.Type != WindowType::Tooltip) + if (_settings.IsTopmost && !IsPopupWindow(_settings.Type)) SetIsAlwaysOnTop(true); if (_isTrackingMouse) @@ -980,11 +985,6 @@ void SDLWindow::SetClientBounds(const Rectangle& clientArea) SDL_SetWindowSize(_window, newW, newH); } -bool IsPopupWindow(WindowType type) -{ - return type == WindowType::Popup || type == WindowType::Tooltip; -} - void GetRelativeWindowOffset(WindowType type, SDLWindow* parentWindow, Int2& positionOffset) { if (!IsPopupWindow(type))