fix: Hide Cursor during Mouse Panning

When incorporating mouse hiding into the GRenderWindow I ended up not providing any logic for the mouse to appropiately hide during panning. This should solve the issue.

Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
Collecting
2025-12-10 08:59:18 +00:00
parent f1c935fc23
commit bab42bccd2

View File

@@ -656,8 +656,9 @@ InputCommon::MouseButton GRenderWindow::QtButtonToMouseButton(Qt::MouseButton bu
} }
void GRenderWindow::mousePressEvent(QMouseEvent* event) { void GRenderWindow::mousePressEvent(QMouseEvent* event) {
// A click is also mouse activity. Restore cursor and restart the timer. // A click is also mouse activity. Restore cursor and restart the timer,
if (UISettings::values.hide_mouse) { // but only if mouse panning is NOT active.
if (UISettings::values.hide_mouse && !Settings::values.mouse_panning) {
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
mouse_hide_timer.start(); mouse_hide_timer.start();
} }
@@ -681,11 +682,20 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) {
} }
void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
// Any mouse activity must FIRST restore the cursor before doing anything else.
if (UISettings::values.hide_mouse) { if (UISettings::values.hide_mouse) {
if (Settings::values.mouse_panning) {
// Panning is ON. Enforce a hidden cursor immediately and do not start the hide timer.
// This check prevents redundant calls if the cursor is already hidden.
if (QApplication::overrideCursor() == nullptr || QApplication::overrideCursor()->shape() != Qt::BlankCursor) {
QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
}
} else {
// Panning is OFF. Use the standard timer-based logic.
// Any physical mouse movement restores the cursor and restarts the timer.
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
mouse_hide_timer.start(); mouse_hide_timer.start();
} }
}
// Touch input is handled in TouchUpdateEvent // Touch input is handled in TouchUpdateEvent
if (event->source() == Qt::MouseEventSynthesizedBySystem) { if (event->source() == Qt::MouseEventSynthesizedBySystem) {