]> git.xonotic.org Git - xonotic/netradiant.git/commit
macos: workaround the laggy XY/Camera window mouse pointer recentering
authorThomas Debesse <dev@illwieckz.net>
Wed, 10 Mar 2021 06:25:34 +0000 (07:25 +0100)
committerThomas Debesse <dev@illwieckz.net>
Wed, 10 Mar 2021 11:21:06 +0000 (12:21 +0100)
commit8cb6710a9cd536a423dd4e1767e318192f2bb301
tree569bf7b6e7c76881a676f6082d618fcb0c464dee
parent5be978bbdfa45b8c20c479f3c58d5c5566f7bcfe
macos: workaround the laggy XY/Camera window mouse pointer recentering

On macOS, a huge lag occurs when the pointer is recentered.
This happens when calling GTK functions to set the pointer
at the center of the widget so it looks to be a lag in GTK
or in underlayer macOS technology GTK relies on.

When that mouse pointer recenter is disabled, one can drag
infinitely without lag BUT then comes weird bugs because
the “released right mouse button” event is only read when
the mouse is over the widget, so if one releases over
another widget, the mouse pointer is not released
and if one do another right mouse click on another XY widget,
the internal state becomes corrupted and a crash is
expected to happen soon.

So the idea of that workaround is to only reposition
the pointer when an edge of the XY/Camera window is reached,
so the user does not experience lag for the whole size
of the XY window, experiencing the lag only when a
whole dimension is moved. To optimize the distance
the user can move without lag, when an edge is reached
the pointer is repositioned on the opposite edge.

It was noticed the pointer is not hidden on macOS when
moving the map, so the pointer being visible during
all the move operation is not restored to the initial
position when it is released, but keep the position
currently seen by the user at right mouse button release
time.

Note: It was noticed it is possible to esscape the capturing
widnow when the render is slow and framerate is low, it
may also occurs with touch screens (like virtual machines has)
to move the pointer out of the XY/Camera widget and get the
internal state corruption problem.
CMakeLists.txt
libs/gtkutil/cursor.cpp