[Cocoa] Keyup events are not fired if cmd/meta key is pressed
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P5)
Tracking
()
People
(Reporter: tcsc, Unassigned)
References
Details
(Whiteboard: tpi:+)
Comment 2•8 years ago
|
||
Comment 3•8 years ago
|
||
Reporter | ||
Comment 4•8 years ago
|
||
Comment 6•8 years ago
|
||
Updated•8 years ago
|
Reporter | ||
Comment 7•8 years ago
|
||
Comment 8•8 years ago
|
||
Reporter | ||
Comment 9•8 years ago
|
||
Updated•8 years ago
|
![]() |
||
Updated•8 years ago
|
Comment 10•8 years ago
|
||
Updated•8 years ago
|
Comment 11•5 years ago
|
||
Moving all keyboard/IME handling bugs to DOM: UI Events & Focus Handling component.
Updated•5 years ago
|
Updated•2 years ago
|
Comment 13•2 years ago
|
||
Any chance to solve this issue?
Is there other way to implement reliable shortcuts? Any suggestions?
For example I am building editor and I cannot use cmd+1, cmd+2 to switch between modes. I need to release key every time for shortcuts to work.
Comment 14•2 years ago
|
||
We don't have any chance to fire keyup
event since macOS does not notify the timing and fact to native apps. And basically, apps should handle at keydown
rather than keyup
for shortcut keys. One of special cases at keyup
is hiding popups which is shown at keydown
, though.
Comment 15•2 years ago
|
||
I'm afraid that is incorrect. We know from TigerVNC that the OS will fire an event for this scenario just fine.
I would guess that the event gets gobbled up somewhere in Firefox' shortcut handling code, even if there is no shortcut bound to that combination.
Comment 16•2 years ago
•
|
||
All native key up events come here first:
https://searchfox.org/mozilla-central/rev/26790fecfcda622dab234b28859da721b80f3a35/widget/cocoa/TextInputHandler.mm#1883-1892
Therefore, you can check the OS's behavior with MOZ_LOG=KeyboardHandler:3,sync
(see also about:logging). (I've not checked recent macOS's behavior, however, we don't have any filter to discard only some keyup
events.)
Comment 17•2 years ago
|
||
That looks deep inside the code, and not at the start of where events enter the application. You can test TigerVNC with the arguments -Log \*:stderr:100
and you can see that it has no problem catching this key release event.
As for the technical details, it catches events early in the chain by overriding [NSApplication sendEvent:]
:
https://github.com/fltk/fltk/blob/390f530abb4074e06f69bb9bc07031e6a4492f7b/src/Fl_cocoa.mm#L1823
Where the event is then passed along to the application code:
https://github.com/fltk/fltk/blob/390f530abb4074e06f69bb9bc07031e6a4492f7b/src/Fl_cocoa.mm#L1826
https://github.com/TigerVNC/tigervnc/blob/57cdcedf1bde06195f782fd2cfcf302050245da6/vncviewer/Viewport.cxx#L937
https://github.com/TigerVNC/tigervnc/blob/57cdcedf1bde06195f782fd2cfcf302050245da6/vncviewer/Viewport.cxx#L1133
Comment 18•2 years ago
|
||
Thank you for the example.
Then, we could fix this if we hack around here:
https://searchfox.org/mozilla-central/rev/26790fecfcda622dab234b28859da721b80f3a35/widget/cocoa/nsAppShell.mm#165
Description
•