No KeyDown event for Command + Ctrl + Enter on macOS

26 views
Skip to first unread message

charl...@gmail.com

unread,
Apr 18, 2022, 8:22:52 PM4/18/22
to wxPython-users
wxPython 4.1.1

Run wxdemo on Windows 7 or 10, pull up the KeyEvent demo.
Press Ctrl-Alt-Enter on your PC keyboard, and you'll see this:

Event Type      Key Name        Key Code        Modifiers
KeyDown         WXK_ALT         307             -A---
KeyDown         WXK_CONTROL     308             CA--R
KeyDown         WXK_RETURN      13              CA--R
KeyUp           WXK_RETURN      13              CA--R
KeyUp           WXK_CONTROL     308             -A---
KeyUp           WXK_ALT         307             -----

Noticed highlighted KeyDown event for Enter with Ctrl + Alt pressed, which is what I'd expect.

Run the same demo on macOS 10.15 or 11, this time pressing Command+Ctrl+Enter:

Event Type      Key Name        Key Code        Modifiers
KeyDown         WXK_COMMAND     308             C----
KeyDown         WXK_RAW_CONTROL 396             C---R
       <--- no KeyDown for 13 with C---R? --> 
KeyUp           WXK_RETURN      13              C---R
KeyUp           WXK_COMMAND     308             ----R
KeyUp           WXK_RAW_CONTROL 396             -----

... there's no KeyDown for the return key with CR modifiers. Why not? Is that a bug?

I thought this might be something about macOS -- but here's a simple web page that grabs key events in Javascript: https://unixpapa.com/js/testkey.html

For Windows it shows what we'd expect: keydown 13, ctrl/alt true.

keydown  keyCode=13        which=13        charCode=0        
         shiftKey=false ctrlKey=true  altKey=true  metaKey=false

For mac - also exactly what I'd expect: keydown for 13, ctrl/meta true.

keydown  keyCode=13        which=13        charCode=0        
         shiftKey=false ctrlKey=true  altKey=false metaKey=true 


So it would appears other applications (at least, browser) can see that event just fine.

Why can't wxPython see a KeyDown for Enter with Command and Control both pressed on macos?

Thanks for any pointers or workarounds:
-ck


Reply all
Reply to author
Forward
0 new messages