From 50531cd6f0c5b465a9040654b92504594cec1fd5 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sun, 2 Feb 2025 18:36:03 +0200 Subject: [PATCH] Fix window dragging when not supported by Wayland compositor (cherry picked from commit 3554747a6745ab8b5cfa3017dfb8ead80f6c924e) --- Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp index 35095b654..a95ec620f 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp @@ -310,7 +310,7 @@ namespace WaylandImpl LOG(Warning, "wl_display_roundtrip_queue failed, errno: {}", errno); // Wait until window has showed up - if (wrappedToplevel == nullptr && dragWindow && Platform::AtomicRead(&WaitFlag) != 0) + if (DragManager != nullptr && wrappedToplevel == nullptr && dragWindow && Platform::AtomicRead(&WaitFlag) != 0) { auto toplevel = static_cast(SDL_GetPointerProperty(SDL_GetWindowProperties(draggedWindow), SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER, nullptr)); if (toplevel != nullptr) @@ -1431,7 +1431,11 @@ DragDropEffect SDLWindow::DoDragDrop(const StringView& data, const Float2& offse else SDL_ShowWindow(_window); } - WindowBase::Show(); + // Only show the window if toplevel dragging is supported + if (WaylandImpl::DragManager != nullptr) + WindowBase::Show(); + else + Hide(); WaylandImpl::DraggingWindow = true; DoDragDropWayland(String(""), dragSourceWindow, dragOffset);