Fix cursor visibility for window cursor state - #98
Open
Abendlied wants to merge 1 commit into
Open
Conversation
Owner
|
Hi, @Abendlied and thanks for PR! Unfortunately, in current state this is not a working code. In engine, it's allowed to call In principle, one way to actually fix this is to reevaluate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix for Linux on X11.
The mouse cursor always remained visible ingame. The initial
setCursorShape(CursorShape::Hidden)call in common/mainwindow.cpp either did not update the (system native) mouse cursor until a mouse moving event was triggered or it does not stick.The expected behaviour however is that the cursor is hidden while OpenGothic has focus and only become visible when losing focus, e.g. alt-tabbing scenario. So we have to touch the X11 API.
Widget::setCursorShape()only updated the native window cursor whenwstate.moveOverwas set..During window initialisation, this state is not yet set. We have a timing problem leading tosetCursorShape(CursorShape::Hidden)not reaching the X11 implementation part. Basically this caused that setting the cursor during startup had no effect.We fix this when we make
Window::setCursorShape()update the cursor immediately when called, even whenmoveOverhas not been set yet.This hides the native window cursor during initialisation of the game and it consequently stays invisible when the game starts.
Tested on Linux with X11:
Cursor is hidden immediately on startup of the game and remains hidden as long as OpenGothic has focus. Cursor becomes visible when losing focus, e.g. alt-tabbing. Cursor is hidden again when focus comes back to OpenGothic.
I did not witness any mouse movement or handling changes on the potato of a machine I am running this with.