Skip to content

Commit

Permalink
#6203: Merge pull request #37 from jonri/wayland_mouse_fix
Browse files Browse the repository at this point in the history
Improve mouse cursor hiding consistency when the pointer is captured.
  • Loading branch information
codereader authored Mar 31, 2024
2 parents 9a9c014 + cbda483 commit b1be82d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions libs/wxutil/FreezePointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -92,7 +92,7 @@ void FreezePointer::endCapture()

if (_hidePointer)
{
topLevel->SetCursor(wxCursor(wxCURSOR_DEFAULT));
window->SetCursor(wxCursor(wxCURSOR_DEFAULT));
}

if (topLevel->HasCapture())
Expand Down
10 changes: 9 additions & 1 deletion radiant/RadiantApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{}
Expand Down
3 changes: 3 additions & 0 deletions radiant/xyview/OrthoView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b1be82d

Please sign in to comment.