liballeg/allegro5

CMD key on osx suppresses all key up events

Opened this issue · 1 comments

This may be an allegro issue or an OSX issue... but I don't get keyup events for any keys at all if CMD is held down. I added logging to _al_osx_keyboard_handler keybd.m and confirmed that there just isn't any event send if CMD is down. This is directly from keyDown:(NSEvent*) so it seems like an OSX issue, but maybe there's a way to opt into better key events?

I found this solution: https://lists.apple.com/archives/cocoa-dev/2003/Oct/msg00442.html

Extending NSApplication sendEvent: apparently does the job. Not sure how to do that for allegro. Gotta figure out how to extend a class in objc, and I guess replace [NSApplication sharedApplication]; with the subclass one?

https://forums.macrumors.com/threads/why-cant-i-subclass-nsapplication.185009/

I noticed the same allegro issue in OSX and it causes unwanted key-repeats in an emulator I'm currently working on.
As a workaround, I'm calling al_clear_keyboard_state after each normal key's keydown event, which is far from ideal and needs ALLEGRO_UNSTABLE defined.

Note that these missing keyup events are also noticeable in OSX allegro when you press a key while switching in and out a window, see issue #728