Skip to content

Fix cursor visibility on startup and focus - #980

Open
Abendlied wants to merge 2 commits into
Try:masterfrom
Abendlied:fix-cursor-visibility
Open

Fix cursor visibility on startup and focus#980
Abendlied wants to merge 2 commits into
Try:masterfrom
Abendlied:fix-cursor-visibility

Conversation

@Abendlied

Copy link
Copy Markdown

see Tempest change: Try/Tempest#98

Removed the old fullscreen-dependent cursor handling and replaced with a simple centering call.

Comment thread common/mainwindow.cpp Outdated
}

void MainWindow::focusEvent(FocusEvent &event) {
setCursorShape(event.in ? CursorShape::Hidden : CursorShape::Arrow);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why toggle from hidden to arrow?

Comment thread common/mainwindow.cpp Outdated
auto rect = SystemApi::windowClientRect(hwnd());
setCursorPosition(rect.w/2,rect.h/2);
setCursorShape(fs ? CursorShape::Hidden : CursorShape::Arrow);
setCursorPosition(Point(w()/2,h()/2));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Game not meant to own mouse, when in window mode. Also setCursorPosition should not be called here in window mode, but that's different issue.

Comment thread common/mainwindow.cpp Outdated
mobileUi(player),
#endif
player(dialogs,inventory) {
setCursorShape(CursorShape::Hidden);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Game meant to hide cursor only in full-screen mode.

@Abendlied
Abendlied force-pushed the fix-cursor-visibility branch from 856dc10 to 3c70e1d Compare September 11, 2026 14:45
@Abendlied

Copy link
Copy Markdown
Author

Before, OpenGothic left the native cursor visible ingame, even if starting fullscreen and even if no mouse movement was generated after the fullscreen transition.

why toggle from hidden to arrow?

Doing it now without the unnecessary toggle.

Game meant to hide cursor only in full-screen mode.

&

Game not meant to own mouse, when in window mode. [...]

This fix now hides the cursor immediately after entering fullscreen. It only recenters the mouse during resize when the window is fullscreen. This should satisty your requirement for the window mode.

Tempest now handles X11 EnterNotify so that the hovered widget and its cursor state are evaluated when the pointer enters the game window.

Tested on Linux/X11:

  1. Cursor hidden on fullscreen startup.
  2. Cursor remains hidden during gameplay.
  3. Cursor becomes visible when focus is lost (Alt-Tabbing).
  4. Cursor becomes hidden again when focus returns, both with and without mouse movement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants