Fix Utiliti crash on macOS from right-click input#952
Draft
Conversation
…d and mouseReleased Co-authored-by: nightm4re94 <26114385+nightm4re94@users.noreply.github.com> Agent-Logs-Url: https://github.com/gurkenlabs/litiengine/sessions/4db57302-960d-4666-a1c1-27f498cb79d2
Copilot
AI
changed the title
[WIP] Fix Utiliti crash on Mac OS X from right click input
Fix Utiliti crash on macOS from right-click input
Mar 23, 2026
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.
Context
On macOS, right-clicking (or two-finger trackpad click) in Utiliti caused an immediate crash. Root cause: Java fires
isPopupTrigger()onmousePressedon macOS, but onmouseReleasedon Windows/Linux. The existing popup handlers only checkedSwingUtilities.isRightMouseButton()inmouseReleased, which is not the correct cross-platform pattern.From the Java docs:
Summary
UI.java/MapList.java— popup trigger handlingAdded
mousePressedhandlers and replacedSwingUtilities.isRightMouseButton(e)withe.isPopupTrigger()in bothmousePressedandmouseReleased:Removed the now-unused
SwingUtilitiesimport fromMapList.java.Mouse.java— button state trackingsetPressed(false)was called on any single button release. Fixed to only clearpressedwhen all tracked buttons (left + right) are released, preventing state corruption when right-clicking while holding the left button.MapComponent.java— dead code removalRemoved an unreachable right-click check inside the
CREATEbranch ofhandleMouseReleased. The method's early return on!isLeftMouseButtonalready exits before that branch is entered.Additional thoughts
No Mac hardware is available for direct testing. The fix follows the standard Java cross-platform popup pattern and should resolve the macOS-specific crash without affecting Windows/Linux behavior.
Quality assurance
Original prompt
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.