-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS modifiers become sticky when released simultaneously #10934
Comments
Can you provide instructions for setting up your macro? I couldn't reproduce this just by hitting the keys myself. |
I use a logitech mouse and logitech G HUB to setup the macro which is just recording a single ALT. Recording any ALT just triggers both ALTs when played back with my setup. |
I tried installing G HUB, but it says my Logitech mouse is inactive. Can you debug Cocoa_HandleKeyEvent() and see what's going on there? |
Hi, I tried using a debugger and stepping through, but the bug doesn't occur when it gets paused. So I printed the modflags near the end of case NSEventTypeFlagsChanged: {
// see if the new modifierFlags mean any existing keys should be pressed/released...
const unsigned int modflags = (unsigned int)[event modifierFlags];
printf("modflags: %x\n", modflags);
... Envoking the macro gives me
If I try pressing it manually (left alt pressed first and released first) it gives this
The macro doesn't trigger any release event which seems like is the problem. From my understanding 0x80000 means either LAlt and RAlt are pressed, but it's missing the 0x20 and 0x40 bits that are supposed to represent specifically if LAlt or RAlt is being pressed. Perhaps a special case or an apple bug? |
Possibly an Apple bug, or a bug in how G HUB is simulating key presses. I'm going to bump this out of the milestone, but feel free to continue your investigation here. |
Hello, I updated to the SDL3 main branch a few weeks ago (and recently also), and this issue appeared.
Basically, when two modifiers are released simultaneously, the modifiers become sticky.
This becomes problematic when using macros on mouses, when keystrokes are invoked programmatically and thus very precisely. I have a test macro that presses alt (it pressed both left and right), and the alt modifier stays even after I released it. Only when I press another modifier does it get reset. My guess is there might be a race condition when trying to set the mod state simultaneously?
sdlbug.mov
Here im invoking the macro that presses LALT + RALT, then pressing jkjk. Only after i press ctrl, do the mod state reset.
The text was updated successfully, but these errors were encountered: