Fix cursor visibility on startup and focus - #980
Conversation
| } | ||
|
|
||
| void MainWindow::focusEvent(FocusEvent &event) { | ||
| setCursorShape(event.in ? CursorShape::Hidden : CursorShape::Arrow); |
| auto rect = SystemApi::windowClientRect(hwnd()); | ||
| setCursorPosition(rect.w/2,rect.h/2); | ||
| setCursorShape(fs ? CursorShape::Hidden : CursorShape::Arrow); | ||
| setCursorPosition(Point(w()/2,h()/2)); |
There was a problem hiding this comment.
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.
| mobileUi(player), | ||
| #endif | ||
| player(dialogs,inventory) { | ||
| setCursorShape(CursorShape::Hidden); |
There was a problem hiding this comment.
Game meant to hide cursor only in full-screen mode.
856dc10 to
3c70e1d
Compare
|
Before, OpenGothic left the native cursor visible ingame, even if starting fullscreen and even if no mouse movement was generated after the fullscreen transition.
Doing it now without the unnecessary toggle.
&
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:
|
see Tempest change: Try/Tempest#98
Removed the old fullscreen-dependent cursor handling and replaced with a simple centering call.