Fix X11 cursor visibility on window enter - #100
Open
Abendlied wants to merge 1 commit into
Open
Conversation
Try
reviewed
Sep 5, 2026
| w->update(); | ||
| w->applyLayout(); | ||
| } | ||
| SystemApi::dispatchMouseReevaluate(*implTrieRoot(this)); |
Owner
There was a problem hiding this comment.
Calling to reevaluate whole tree, inside Widget::setGeometry just like so, can be huge performance issue - better not touch for now.
| } | ||
|
|
||
| void EventDispatcher::implSetMouseOver(const std::shared_ptr<Widget::Ref> &wptr,MouseEvent& orig) { | ||
| void EventDispatcher::implSetMouseOver(const std::shared_ptr<Widget::Ref> &wptr,MouseEvent& orig,bool force) { |
| break; | ||
| } | ||
| case EnterNotify: { | ||
| SystemApi::dispatchMouseReevaluate(cb,Point(xev.xcrossing.x,xev.xcrossing.y)); |
Owner
There was a problem hiding this comment.
I think it's good call to monitor EnterWindowMask, but then it suppose to be something like SystemAPI::dispatchMouseEnter/SystemAPI::dispatchMouseLeave
| if(astate.disable>0) | ||
| implDisableSum(w,astate.disable); | ||
| lay->applyLayout(); | ||
| SystemApi::dispatchMouseReevaluate(*implTrieRoot(this)); |
Owner
There was a problem hiding this comment.
same problem as in setGeometry: construction of complex UI will hammer such reevaluation
| dispatchMouseReevaluate(wnd,mousePosition); | ||
| } | ||
|
|
||
| void EventDispatcher::dispatchMouseReevaluate(Widget& wnd, Point pos) { |
Owner
There was a problem hiding this comment.
so far it look like hallucinated move-event... lets focus on EnterNotify first.
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 native mouse cursor remained visible in-game even though
CursorShape::Hiddenwas requested during game startup.The initial PR https://github.com/Try/Tempest/pull/98/changes is flawed. It adressed the symptom but violated the framework cursor management model completely.
Now in the new approach I try to follow the recommendation.
EventDispatcherdid not know the mouse position until after receiving aMotionNotify. When the mouse was already over the game window, and no mouse movement received, the cursor state was not updated. This happened every time due to fullscreen.The new implementation now gets the initial pointer position from
EnterNotifyand reevaluates the hovered widget when the window receives focus. The hover state is also reevaluated with widget geometry change.Window::setCursorShape()stays how it is, cursor management is now inEventDispatcher.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 for hovering.