Skip to content

Fix cursor jumping when closing rank editor GUI#313

Merged
MassAnarchyy merged 1 commit into
masterfrom
fix/gui-cursor-jump-on-close
Jun 10, 2026
Merged

Fix cursor jumping when closing rank editor GUI#313
MassAnarchyy merged 1 commit into
masterfrom
fix/gui-cursor-jump-on-close

Conversation

@Eldrinn-Elantey

Copy link
Copy Markdown
Contributor

closeScreen() was always called before displayGuiScreen(prevScreen), which internally triggered setIngameFocus() and grabbed/centered the mouse. setCursorPosition then tried to restore the original position but was broken due to a LWJGL2 coordinate mismatch (getY() is bottom-origin, setCursorPosition expects top-origin), causing the cursor to land at a mirrored position (e.g. top-right click -> cursor ends up at bottom-right).

Fixed by skipping closeScreen() when a previous screen is being opened — the mouse is never grabbed so no restoration is needed.

closeScreen() was always called before displayGuiScreen(prevScreen), triggering setIngameFocus() which grabbed and centered the mouse. setCursorPosition then tried to restore the cursor but had inverted Y (LWJGL2 getY is bottom-origin, setCursorPosition is top-origin). Fixed by skipping closeScreen() when a previous screen is being opened, making cursor restoration unnecessary.
@Eldrinn-Elantey Eldrinn-Elantey requested a review from a team June 10, 2026 00:01
@MassAnarchyy MassAnarchyy merged commit da09db6 into master Jun 10, 2026
1 check passed
@MassAnarchyy MassAnarchyy deleted the fix/gui-cursor-jump-on-close branch June 10, 2026 03:41
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