Skip to content

Fix modifier keys in Meteor GUIs - #6735

Merged
MineGame159 merged 1 commit into
MeteorDevelopment:masterfrom
machiecodes:fix/gui-modifiers
Oct 18, 2026
Merged

MineGame159 merged 1 commit into
MeteorDevelopment:masterfrom
machiecodes:fix/gui-modifiers

Conversation

@machiecodes

Copy link
Copy Markdown
Contributor

Type of change

  • Bug fix
  • New feature

Description

After migrating to SDL inputs, we were checking for modifier keys like this:

boolean control = SystemUtils.IS_OS_MAC 
? input.modifiers() == InputConstants.MOD_SUPER 
: input.modifiers() == InputConstants.MOD_CONTROL;

to determine whether control is pressed. This wouldn't work because the input constants for modifiers are masks that you compare against the actual pressed modifiers:

MOD_SHIFT   =   0000 0000 0011 (3)
MOD_CONTROL =   0000 1100 0000 (192)
MOD_ALT     =   0011 0000 0000 (768)
MOD_SUPER   =   1100 0000 0000 (3072)

whereas the current modifiers found in a KeyEvent might look like this:

// Right control is pressed, left is not
event.modifiers() = 0000 1000 0000

Added Input#modsMatch(int currentMods, int... desiredMods) to mimic previous logic, it checks if the current modifiers contains only the desired ones, nothing else.

Related issues

image

How Has This Been Tested?

8mb.video-8ZP-u2psrsrN.mp4

Checklist:

  • My code follows the style guidelines of this project.
  • I have added comments to my code in more complex areas.
  • I have tested the code in both development and production environments.

@MineGame159
MineGame159 merged commit 84d6aa6 into MeteorDevelopment:master Oct 18, 2026
1 check passed
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