summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformopenglwindow.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <[email protected]>2025-10-13 17:51:05 +0200
committerTor Arne Vestbø <[email protected]>2025-10-23 11:04:20 +0200
commit4a09c6d82990044fc35a59f28466b9c28e3df3bf (patch)
tree976de860977a777513bf1d0db999ad47e91616fb /src/plugins/platforms/android/qandroidplatformopenglwindow.h
parentcb7b2e529fe990077b348044d3e393a2eae848d9 (diff)
macOS: Map function keys by their virtual key code, not MacRoman charsHEADdev
When mapping incoming key events to their possible key combinations for shortcut mapping we use UCKeyTranslate, or its modern Cocoa equivalent [NSEvent charactersByApplyingModifiers:] (which plumbs to UCKeyTranslate internally). When doing so for function keys, we get back characters codes such as 0x01 / ␁ / Start of Heading when pressing the Home key, or 0x04 / ␄ / End of Transmission when pressing the End key, which map to kHomeCharCode and kEndCharCode correspondingly in the MacRoman character codes table from HIToolBox's Events.h We used these MacRoman character code mappings to turn kHomeCharCode into Qt::Key_Home and kEndCharCode into Qt::Key_End. Surprisingly UCKeyTranslate/charactersByApplyingModifiers does not return the equivalent function key character codes from the NSEvent.h header, such as NSEndFunctionKey, even if the original NSEvent we're processing has this as the NSEvent.characters or NSEvent.charactersIgnoringModifiers, as reported here: https://developer.apple.com/forums/thread/803439 This is a problem because key events with the Control (^) key also (naturally) map to these character codes when fed through UCKeyTranslate, which resulted in matching shortcuts for Qt::Key_Home and Qt::Key_End if the user pressed Control+A or Control+D. Or even worse, if users had shortcuts registered for Ctrl+A and Home, or Ctrl+D and End, at the same time, these shortcuts would be considered ambiguous. To fix this we now map function keys via the keyboard layout independent virtual key codes from the same HIToolBox Events.h header, which ensures we only map real function keys during to Qt::Keys such as Qt::Key_End. Note that we still consider the keyboard-layout-mapped character codes for functions keys coming from NSEvent.h, in case there are layouts that explicitly map to these. Fixes: QTBUG-134441 Pick-to: 6.10 6.8 Change-Id: Iac8def7540247665562b438bf4af06b4347d33b0 Reviewed-by: Doris Verria <[email protected]>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformopenglwindow.h')
0 files changed, 0 insertions, 0 deletions