From ee57da9634ee4c57ab57413d4ee1983fb7a8d0e0 Mon Sep 17 00:00:00 2001 From: jonri Date: Fri, 22 Mar 2024 08:43:40 -0400 Subject: [PATCH 1/2] Improve mouse cursor hiding consistency when the pointer is captured. This fixes issues under Wayland when dragging the 2D and 3D views. --- libs/wxutil/FreezePointer.cpp | 4 ++-- radiant/xyview/OrthoView.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/wxutil/FreezePointer.cpp b/libs/wxutil/FreezePointer.cpp index f16ac98b04..b4273865ed 100644 --- a/libs/wxutil/FreezePointer.cpp +++ b/libs/wxutil/FreezePointer.cpp @@ -28,7 +28,7 @@ void FreezePointer::startCapture(wxWindow* window, if (_hidePointer) { - topLevel->SetCursor(wxCursor(wxCURSOR_BLANK)); + window->SetCursor(wxCursor(wxCURSOR_BLANK)); } // We capture the mouse on the toplevel app, coordinates @@ -92,7 +92,7 @@ void FreezePointer::endCapture() if (_hidePointer) { - topLevel->SetCursor(wxCursor(wxCURSOR_DEFAULT)); + window->SetCursor(wxCursor(wxCURSOR_DEFAULT)); } if (topLevel->HasCapture()) diff --git a/radiant/xyview/OrthoView.cpp b/radiant/xyview/OrthoView.cpp index b261bfda4d..ab53f4b76e 100644 --- a/radiant/xyview/OrthoView.cpp +++ b/radiant/xyview/OrthoView.cpp @@ -423,6 +423,9 @@ bool OrthoView::checkChaseMouse(unsigned int state) void OrthoView::setCursorType(CursorType type) { + if (_freezePointer.isCapturing(_wxGLWidget)) + return; + switch (type) { case CursorType::Pointer: From cbda48384c3b2ced6412812ecd1a25440541c89e Mon Sep 17 00:00:00 2001 From: jonri Date: Fri, 22 Mar 2024 12:23:23 -0400 Subject: [PATCH 2/2] Force GDK backend to X11 on Linux --- radiant/RadiantApp.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/radiant/RadiantApp.cpp b/radiant/RadiantApp.cpp index a26c7aca19..4b63d43181 100644 --- a/radiant/RadiantApp.cpp +++ b/radiant/RadiantApp.cpp @@ -89,7 +89,15 @@ class RadiantApp::ArtProvider final: public wxArtProvider }; RadiantApp::RadiantApp() -{} +{ +#if defined(__linux__) + // The native Wayland backend for GTK does not implement the mouse pointer + // warping functions used in the FreezePointer class. Forcing the backend + // to X11 will let us run using XWayland which does provide emulation of + // this functionality. + setenv("GDK_BACKEND", "x11", 0); +#endif +} RadiantApp::~RadiantApp() {}