diff options
Diffstat (limited to 'src/gui/platform')
| -rw-r--r-- | src/gui/platform/darwin/qappleiconengine.mm | 188 | ||||
| -rw-r--r-- | src/gui/platform/darwin/qapplekeymapper.mm | 153 | 
2 files changed, 163 insertions, 178 deletions
| diff --git a/src/gui/platform/darwin/qappleiconengine.mm b/src/gui/platform/darwin/qappleiconengine.mm index 20d50b0d8a8..3228b97fdb0 100644 --- a/src/gui/platform/darwin/qappleiconengine.mm +++ b/src/gui/platform/darwin/qappleiconengine.mm @@ -30,27 +30,28 @@ auto *loadImage(const QString &iconName)          {"call-start"_L1, @"phone.arrow.up.right"},          {"call-stop"_L1, @"phone.down"},          {"contact-new"_L1, @"person.crop.circle.badge.plus"}, -        {"document-new"_L1, @"doc.badge.plus"}, -        {"document-open"_L1, @"folder"}, -        {"document-open-recent"_L1, @"doc.badge.clock"}, -        {"document-page-setup"_L1, @"doc.badge.gearshape"}, +        {"document-new"_L1, @"plus"}, +        {"document-open"_L1, @"arrow.up.forward"}, +        {"document-open-recent"_L1, @"clock"}, +        {"document-page-setup"_L1, @"text.page"},          {"document-print"_L1, @"printer"}, -        //{"document-print-preview"_L1, @""}, -        {"document-properties"_L1, @"doc.badge.ellipsis"}, -        //{"document-revert"_L1, @""}, +        {"document-print-preview"_L1, @"richtext.page"}, +        {"document-properties"_L1, @"info.circle.text.page"}, +        {"document-revert"_L1, @"arrow.counterclockwise"},          {"document-save"_L1, @"square.and.arrow.down"}, -        //{"document-save-as"_L1, @""}, +        {"document-save-as"_L1, @"square.and.arrow.down.on.square"},          {"document-send"_L1, @"paperplane"}, +        {"document-export"_L1, @"square.and.arrow.up"},          {"edit-clear"_L1, @"xmark.circle"},          {"edit-copy"_L1, @"doc.on.doc"},          {"edit-cut"_L1, @"scissors"}, -        {"edit-delete"_L1, @"delete.left"}, -        {"edit-find"_L1, @"magnifyingglass"}, +        {"edit-delete"_L1, @"trash"}, +        {"edit-find"_L1, @"text.page.badge.magnifyingglass"},          //{"edit-find-replace"_L1, @"arrow.up.left.and.down.right.magnifyingglass"}, -        {"edit-paste"_L1, @"clipboard"}, -        {"edit-redo"_L1, @"arrowshape.turn.up.right"}, -         //{"edit-select-all"_L1, @""}, -        {"edit-undo"_L1, @"arrowshape.turn.up.left"}, +        {"edit-paste"_L1, @"document.on.clipboard"}, +        {"edit-redo"_L1, @"arrow.uturn.forward"}, +        {"edit-select-all"_L1, @"character.textbox"}, +        {"edit-undo"_L1, @"arrow.uturn.backward"},          {"folder-new"_L1, @"folder.badge.plus"},          {"format-indent-less"_L1, @"decrease.indent"},          {"format-indent-more"_L1, @"increase.indent"}, @@ -65,35 +66,36 @@ auto *loadImage(const QString &iconName)          {"format-text-underline"_L1, @"underline"},          {"format-text-strikethrough"_L1, @"strikethrough"},          //{"go-bottom"_L1, @""}, -        {"go-down"_L1, @"arrowshape.down"}, -        {"go-first"_L1, @"increase.indent"}, +        {"go-down"_L1, @"chevron.down"}, +        //{"go-first"_L1, @""},          {"go-home"_L1, @"house"},          //{"go-jump"_L1, @""},          //{"go-last"_L1, @""}, -        {"go-next"_L1, @"arrowshape.right"}, -        {"go-previous"_L1, @"arrowshape.left"}, +        {"go-next"_L1, @"chevron.right"}, +        {"go-previous"_L1, @"chevron.left"},          //{"go-top"_L1, @""}, -        {"go-up"_L1, @"arrowshape.up"}, +        {"go-up"_L1, @"chevron.up"},          {"help-about"_L1, @"info.circle"},          //{"help-contents"_L1, @""},          {"help-faq"_L1, @"questionmark.app"},          {"insert-image"_L1, @"photo.badge.plus"},          {"insert-link"_L1, @"link.badge.plus"}, -        //{"insert-object"_L1, @""}, -        {"insert-text"_L1, @"textformat"}, +        {"insert-object"_L1, @"widget.small.badge.plus"}, +        {"insert-text"_L1, @"text.badge.plus"},          {"list-add"_L1, @"plus.circle"},          {"list-remove"_L1, @"minus.circle"},          {"mail-forward"_L1, @"arrowshape.turn.up.right"},          {"mail-mark-important"_L1, @"star"},          {"mail-mark-junk"_L1, @"xmark.bin"}, -        {"mail-mark-notjunk"_L1, @"trash.slash"}, +        {"mail-mark-notjunk"_L1, @"arrow.up.bin"},          {"mail-mark-read"_L1, @"envelope.open"}, -        {"mail-mark-unread"_L1, @"envelope.fill"}, +        {"mail-mark-unread"_L1, @"envelope.badge"},          {"mail-message-new"_L1, @"square.and.pencil"},          {"mail-reply-all"_L1, @"arrowshape.turn.up.left.2"},          {"mail-reply-sender"_L1, @"arrowshape.turn.up.left"}, -        {"mail-send"_L1, @"paperplane"}, -        {"mail-send-receive"_L1, @"envelope.arrow.triangle.branch"}, +        {"mail-send"_L1, @"arrow.up.circle.fill"}, +        {"mail-send-receive"_L1, @"arrow.trianglehead.2.clockwise.rotate.90"}, +        {"mail-replied"_L1, @"envelope.and.arrow.trianglehead.branch"},          {"media-eject"_L1, @"eject"},          {"media-playback-pause"_L1, @"pause"},          {"media-playback-start"_L1, @"play"}, @@ -108,61 +110,61 @@ auto *loadImage(const QString &iconName)          {"object-rotate-left"_L1, @"rotate.left"},          {"object-rotate-right"_L1, @"rotate.right"},          {"process-stop"_L1, @"stop.circle"}, -        {"system-lock-screen"_L1, @"lock.display"}, -        {"system-log-out"_L1, @"door.left.hand.open"}, +        {"system-lock-screen"_L1, @"lock"}, +        {"system-log-out"_L1, @"person.crop.circle"},          //{"system-run"_L1, @""},          {"system-search"_L1, @"magnifyingglass"}, -        //{"system-reboot"_L1, @""}, +        {"system-reboot"_L1, @"restart"},          {"system-shutdown"_L1, @"power"}, -        //{"tools-check-spelling"_L1, @""}, +        {"tools-check-spelling"_L1, @"textformat.characters.dottedunderline"},          {"view-fullscreen"_L1, @"arrow.up.left.and.arrow.down.right"},          {"view-refresh"_L1, @"arrow.clockwise"},          {"view-restore"_L1, @"arrow.down.right.and.arrow.up.left"}, -        //{"view-sort-ascending"_L1, @""}, -        //{"view-sort-descending"_L1, @""}, +        {"view-sort-ascending"_L1, @"arrow.up"}, +        {"view-sort-descending"_L1, @"arrow.down"},          {"window-close"_L1, @"xmark.circle"},          {"window-new"_L1, @"macwindow.badge.plus"},          {"zoom-fit-best"_L1, @"square.arrowtriangle.4.outward"},          {"zoom-in"_L1, @"plus.magnifyingglass"}, -        //{"zoom-original"_L1, @""}, +        {"zoom-original"_L1, @"1.magnifyingglass"},          {"zoom-out"_L1, @"minus.magnifyingglass"},          {"process-working"_L1, @"circle.dotted"}, -        //{"accessories-calculator"_L1, @""}, -        //{"accessories-character-map"_L1, @""}, +        {"accessories-calculator"_L1, @"plus.forwardslash.minus"}, +        {"accessories-character-map"_L1, @"keyboard.macwindow"},          {"accessories-dictionary"_L1, @"character.book.closed"},          {"accessories-text-editor"_L1, @"textformat"},          {"help-browser"_L1, @"folder.badge.questionmark"},          {"multimedia-volume-control"_L1, @"speaker.wave.3"},          {"preferences-desktop-accessibility"_L1, @"accessibility"}, -        //{"preferences-desktop-font"_L1, @""}, -        {"preferences-desktop-keyboard"_L1, @"keyboard.badge.ellipsis"}, -        //{"preferences-desktop-locale"_L1, @""}, -        //{"preferences-desktop-multimedia"_L1, @""}, -        //{"preferences-desktop-screensaver"_L1, @""}, -        //{"preferences-desktop-theme"_L1, @""}, -        //{"preferences-desktop-wallpaper"_L1, @""}, +        {"preferences-desktop-font"_L1, @"textformat.characters"}, +        {"preferences-desktop-keyboard"_L1, @"keyboard"}, +        {"preferences-desktop-locale"_L1, @"mappin.and.ellipse"}, +        {"preferences-desktop-multimedia"_L1, @"music.note.tv"}, +        {"preferences-desktop-screensaver"_L1, @"display"}, +        {"preferences-desktop-theme"_L1, @"paintpalette"}, +        {"preferences-desktop-wallpaper"_L1, @"photo.tv"},          {"system-file-manager"_L1, @"folder.badge.gearshape"}, -        //{"system-software-install"_L1, @""}, -        //{"system-software-update"_L1, @""}, d -        //{"utilities-system-monitor"_L1, @""}, +        {"system-software-install"_L1, @"laptopcomputer.and.arrow.down"}, +        {"system-software-update"_L1, @"laptopcomputer.badge.checkmark"}, +        {"utilities-system-monitor"_L1, @"chart.bar.xaxis"},          {"utilities-terminal"_L1, @"apple.terminal"}, -        //{"applications-accessories"_L1, @""}, -        //{"applications-development"_L1, @""}, -        //{"applications-engineering"_L1, @""}, -        {"applications-games"_L1, @"gamecontroller"}, -        //{"applications-graphics"_L1, @""}, +        {"applications-accessories"_L1, @"scanner"}, +        {"applications-development"_L1, @"hammer"}, +        {"applications-engineering"_L1, @"wrench.and.screwdriver"}, +        {"applications-games"_L1, @"gamecontroller.circle"}, +        {"applications-graphics"_L1, @"theatermask.and.paintbrush"},          {"applications-internet"_L1, @"network"},          {"applications-multimedia"_L1, @"tv.and.mediabox"}, -        //{"applications-office"_L1, @""}, -        //{"applications-other"_L1, @""}, +        {"applications-office"_L1, @"square.and.pencil.circle"}, +        {"applications-other"_L1, @"app.grid"},          {"applications-science"_L1, @"atom"}, -        //{"applications-system"_L1, @""}, -        //{"applications-utilities"_L1, @""}, +        {"applications-system"_L1, @"gear"}, +        {"applications-utilities"_L1, @"wrench.and.screwdriver"},          {"preferences-desktop"_L1, @"menubar.dock.rectangle"}, -        //{"preferences-desktop-peripherals"_L1, @""}, -        //{"preferences-desktop-personal"_L1, @""}, -        //{"preferences-other"_L1, @""}, -        //{"preferences-system"_L1, @""}, +        {"preferences-desktop-peripherals"_L1, @"iphone.and.ipod"}, +        {"preferences-desktop-personal"_L1, @"person.badge.key"}, +        {"preferences-other"_L1, @"gear"}, +        {"preferences-system"_L1, @"gear"},          {"preferences-system-network"_L1, @"network"},          {"system-help"_L1, @"questionmark.diamond"},          {"audio-card"_L1, @"waveform.circle"}, @@ -175,40 +177,40 @@ auto *loadImage(const QString &iconName)          {"drive-harddisk"_L1, @"internaldrive"},          {"drive-optical"_L1, @"opticaldiscdrive"},          {"drive-removable-media"_L1, @"externaldrive"}, -        {"input-gaming"_L1, @"gamecontroller"}, // "games" also using this one +        {"input-gaming"_L1, @"gamecontroller"},          {"input-keyboard"_L1, @"keyboard"},          {"input-mouse"_L1, @"computermouse"},          {"input-tablet"_L1, @"ipad"},          {"media-flash"_L1, @"mediastick"},          //{"media-floppy"_L1, @""}, -        //{"media-optical"_L1, @""}, +        {"media-optical"_L1, @"opticaldisc"},          {"media-tape"_L1, @"recordingtape"}, -        //{"modem"_L1, @""}, -        {"multimedia-player"_L1, @"play.rectangle"}, +        {"modem"_L1, @"phone.connection"}, +        {"multimedia-player"_L1, @"ipod"},          {"network-wired"_L1, @"app.connected.to.app.below.fill"},          {"network-wireless"_L1, @"wifi"},          {"network-workgroup"_L1, @"network"}, -        //{"pda"_L1, @""}, +        {"pda"_L1, @"flipphone"},          {"phone"_L1, @"iphone"},          {"printer"_L1, @"printer"},          {"scanner"_L1, @"scanner"},          {"video-display"_L1, @"play.display"}, -        //{"emblem-default"_L1, @""}, +        {"emblem-default"_L1, @"circle"},          {"emblem-documents"_L1, @"doc.circle"},          {"emblem-downloads"_L1, @"arrow.down.circle"}, -        {"emblem-favorite"_L1, @"star"}, -        {"emblem-important"_L1, @"exclamationmark.bubble.circle"}, -        {"emblem-mail"_L1, @"envelope"}, -        {"emblem-photos"_L1, @"photo.stack"}, -        //{"emblem-readonly"_L1, @""}, -        {"emblem-shared"_L1, @"folder.badge.person.crop"}, +        {"emblem-favorite"_L1, @"star.circle"}, +        {"emblem-important"_L1, @"exclamationmark.circle"}, +        {"emblem-mail"_L1, @"envelope.circle"}, +        {"emblem-photos"_L1, @"photo.circle"}, +        {"emblem-readonly"_L1, @"eye.circle"}, +        {"emblem-shared"_L1, @"person.2.circle"},          {"emblem-symbolic-link"_L1, @"link.circle"},          {"emblem-synchronized"_L1, @"arrow.triangle.2.circlepath.circle"}, -        {"emblem-system"_L1, @"gear"}, -        //{"emblem-unreadable"_L1, @""}, +        {"emblem-system"_L1, @"gear.circle"}, +        {"emblem-unreadable"_L1, @"eye.slash.circle"},          {"text-x-generic"_L1, @"doc"}, // until iOS 18/macOS 15; @"document" after that          {"folder"_L1, @"folder"}, -        //{"folder-remote"_L1, @""}, +        {"folder-remote"_L1, @"icloud"},          {"network-server"_L1, @"server.rack"},          //{"start-here"_L1, @""},          {"user-bookmarks"_L1, @"bookmark.circle"}, @@ -229,28 +231,28 @@ auto *loadImage(const QString &iconName)          {"dialog-question"_L1, @"questionmark.circle"},          {"dialog-warning"_L1, @"exclamationmark.octagon"},          {"folder-drag-accept"_L1, @"plus.rectangle.on.folder"}, -        //{"folder-open"_L1, @""}, +        {"folder-open"_L1, @"arrow.forward.folder"},          {"folder-visiting"_L1, @"folder.circle"}, -        {"image-loading"_L1, @"photo.circle"}, -        {"image-missing"_L1, @"photo"}, +        {"image-loading"_L1, @"photo.badge.arrow.down"}, +        {"image-missing"_L1, @"photo.badge.exclamationmark"},          {"mail-attachment"_L1, @"paperclip"},          {"mail-unread"_L1, @"envelope.badge"},          {"mail-read"_L1, @"envelope.open"}, -        {"mail-replied"_L1, @"arrowshape.turn.up.left"}, +        //{"mail-replied"_L1, @""},          //{"mail-signed"_L1, @""}, -        //{"mail-signed-verified"_L1, @""}, -        {"media-playlist-repeat"_L1, @"repet"}, +        {"mail-signed-verified"_L1, @"envelope.badge.shield.half.filled"}, +        {"media-playlist-repeat"_L1, @"repeat"},          {"media-playlist-shuffle"_L1, @"shuffle"}, -        //{"network-error"_L1, @""}, -        //{"network-idle"_L1, @""}, -        {"network-offline"_L1, @"network.slash"}, -        //{"network-receive"_L1, @""}, -        //{"network-transmit"_L1, @""}, -        //{"network-transmit-receive"_L1, @""}, +        {"network-error"_L1, @"xmark.icloud"}, +        {"network-idle"_L1, @"icloud"}, +        {"network-offline"_L1, @"icloud.slash"}, +        {"network-receive"_L1, @"icloud.and.arrow.down"}, +        {"network-transmit"_L1, @"icloud.and.arrow.up"}, +        {"network-transmit-receive"_L1, @"arrow.trianglehead.2.clockwise.rotate.90.icloud"},          //{"printer-error"_L1, @""}, -        {"printer-printing"_L1, @"printer.dotmatrix.filled.and.paper"}, // not sure -        {"security-high"_L1, @"lock.shield"}, -        //{"security-medium"_L1, @""}, +        {"printer-printing"_L1, @"printer.dotmatrix"}, +        {"security-high"_L1, @"lock.badge.checkmark"}, +        {"security-medium"_L1, @"lock"},          {"security-low"_L1, @"lock.trianglebadge.exclamationmark"},          {"software-update-available"_L1, @"arrowshape.up.circle"},          {"software-update-urgent"_L1, @"exclamationmark.transmission"}, @@ -258,9 +260,9 @@ auto *loadImage(const QString &iconName)          {"sync-synchronizing"_L1, @"arrow.triangle.2.circlepath"},          {"task-due"_L1, @"clock.badge.exclamationmark"},          {"task-past-due"_L1, @"clock.badge.xmark"}, -        {"user-available"_L1, @"person.crop.circle.badge.checkmark"}, -        {"user-away"_L1, @"person.crop.circle.badge.clock"}, -        //{"user-idle"_L1, @""}, +        {"user-available"_L1, @"person.crop.circle.badge"}, +        {"user-away"_L1, @"person.crop.circle.badge.moon"}, +        {"user-idle"_L1, @"person.crop.circle.badge.clock"},          {"user-offline"_L1, @"person.crop.circle.badge.xmark"},          //{"user-trash-full"_L1, @""},          {"weather-clear"_L1, @"sun.max"}, @@ -269,9 +271,9 @@ auto *loadImage(const QString &iconName)          {"weather-few-clouds-night"_L1, @"cloud.moon"},          {"weather-fog"_L1, @"cloud.fog"},          {"weather-overcast"_L1, @"cloud"}, -        //{"weather-severe-alert"_L1, @""}, -        {"weather-showers"_L1, @"cloud.rain"}, -        //{"weather-showers-scattered"_L1, @""}, +        {"weather-severe-alert"_L1, @"cloud.bolt.rain"}, +        {"weather-showers"_L1, @"cloud.heavyrain"}, +        {"weather-showers-scattered"_L1, @"cloud.drizzle"},          {"weather-snow"_L1, @"cloud.snow"},          {"weather-storm"_L1, @"tropicalstorm"},      }; diff --git a/src/gui/platform/darwin/qapplekeymapper.mm b/src/gui/platform/darwin/qapplekeymapper.mm index 214865864ff..49f7a8ff0cb 100644 --- a/src/gui/platform/darwin/qapplekeymapper.mm +++ b/src/gui/platform/darwin/qapplekeymapper.mm @@ -94,60 +94,10 @@ static CarbonModifiers toCarbonModifiers(Qt::KeyboardModifiers qtModifiers)      return carbonModifiers;  } -// Keyboard keys (non-modifiers) -static QHash<char16_t, Qt::Key> standardKeys = { -    { kHomeCharCode, Qt::Key_Home }, -    { kEnterCharCode, Qt::Key_Enter }, -    { kEndCharCode, Qt::Key_End }, -    { kBackspaceCharCode, Qt::Key_Backspace }, -    { kTabCharCode, Qt::Key_Tab }, -    { kPageUpCharCode, Qt::Key_PageUp }, -    { kPageDownCharCode, Qt::Key_PageDown }, -    { kReturnCharCode, Qt::Key_Return }, -    { kEscapeCharCode, Qt::Key_Escape }, -    { kLeftArrowCharCode, Qt::Key_Left }, -    { kRightArrowCharCode, Qt::Key_Right }, -    { kUpArrowCharCode, Qt::Key_Up }, -    { kDownArrowCharCode, Qt::Key_Down }, -    { kHelpCharCode, Qt::Key_Help }, -    { kDeleteCharCode, Qt::Key_Delete }, -    // ASCII maps, for debugging -    { ':', Qt::Key_Colon }, -    { ';', Qt::Key_Semicolon }, -    { '<', Qt::Key_Less }, -    { '=', Qt::Key_Equal }, -    { '>', Qt::Key_Greater }, -    { '?', Qt::Key_Question }, -    { '@', Qt::Key_At }, -    { ' ', Qt::Key_Space }, -    { '!', Qt::Key_Exclam }, -    { '"', Qt::Key_QuoteDbl }, -    { '#', Qt::Key_NumberSign }, -    { '$', Qt::Key_Dollar }, -    { '%', Qt::Key_Percent }, -    { '&', Qt::Key_Ampersand }, -    { '\'', Qt::Key_Apostrophe }, -    { '(', Qt::Key_ParenLeft }, -    { ')', Qt::Key_ParenRight }, -    { '*', Qt::Key_Asterisk }, -    { '+', Qt::Key_Plus }, -    { ',', Qt::Key_Comma }, -    { '-', Qt::Key_Minus }, -    { '.', Qt::Key_Period }, -    { '/', Qt::Key_Slash }, -    { '[', Qt::Key_BracketLeft }, -    { ']', Qt::Key_BracketRight }, -    { '\\', Qt::Key_Backslash }, -    { '_', Qt::Key_Underscore }, -    { '`', Qt::Key_QuoteLeft }, -    { '{', Qt::Key_BraceLeft }, -    { '}', Qt::Key_BraceRight }, -    { '|', Qt::Key_Bar }, -    { '~', Qt::Key_AsciiTilde }, -    { '^', Qt::Key_AsciiCircum } -}; - -static QHash<char16_t, Qt::Key> virtualKeys = { +// NSEvent.keyCode codes for keys that are independent of keyboard layout. +// Some of these are technically possible to add custom key maps for, but +// doing so would be unexpected. +static QHash<char16_t, Qt::Key> layoutIndependentKeyCodes = {      { kVK_F1, Qt::Key_F1 },      { kVK_F2, Qt::Key_F2 },      { kVK_F3, Qt::Key_F3 }, @@ -164,16 +114,57 @@ static QHash<char16_t, Qt::Key> virtualKeys = {      { kVK_F14, Qt::Key_F14 },      { kVK_F15, Qt::Key_F15 },      { kVK_F16, Qt::Key_F16 }, +    { kVK_F17, Qt::Key_F17 }, +    { kVK_F18, Qt::Key_F18 }, +    { kVK_F19, Qt::Key_F19 }, +    { kVK_F20, Qt::Key_F20 }, +      { kVK_Return, Qt::Key_Return },      { kVK_Tab, Qt::Key_Tab }, +    { kVK_Space, Qt::Key_Space },      { kVK_Escape, Qt::Key_Escape }, -    { kVK_Help, Qt::Key_Help }, +    { kVK_Delete, Qt::Key_Backspace }, +    { kVK_ForwardDelete, Qt::Key_Delete }, + +    { kVK_Home, Qt::Key_Home }, +    { kVK_End, Qt::Key_End }, +    { kVK_PageUp, Qt::Key_PageUp }, +    { kVK_PageDown, Qt::Key_PageDown }, +      { kVK_UpArrow, Qt::Key_Up },      { kVK_DownArrow, Qt::Key_Down },      { kVK_LeftArrow, Qt::Key_Left },      { kVK_RightArrow, Qt::Key_Right }, -    { kVK_PageUp, Qt::Key_PageUp }, -    { kVK_PageDown, Qt::Key_PageDown } + +    { kVK_CapsLock, Qt::Key_CapsLock }, +    { kVK_Shift, Qt::Key_Shift }, +    { kVK_RightShift, Qt::Key_Shift }, + +#if 0 +    // FIXME: Map these here instead of relying on +    // custom logic in [QNSView flagsChanged:] + +    { kVK_Command, Qt::Key_unknown }, +    { kVK_RightCommand, Qt::Key_unknown }, +    { kVK_Option, Qt::Key_unknown }, +    { kVK_RightOption, Qt::Key_unknown }, +    { kVK_Control, Qt::Key_unknown }, +    { kVK_RightControl, Qt::Key_unknown }, +    { kVK_Function, Qt::Key_unknown }, +#endif + +    { kVK_VolumeUp, Qt::Key_VolumeUp }, +    { kVK_VolumeDown, Qt::Key_VolumeDown }, +    { kVK_Mute, Qt::Key_VolumeMute }, + +#if 0 +    // FIXME: Figure out which Qt::Key this maps to +    { kVK_ContextualMenu, Qt::Key_unknown }, +#endif +    { kVK_Help, Qt::Key_Help }, + +    { kVK_ANSI_KeypadClear, Qt::Key_Clear }, +    { kVK_ANSI_KeypadEnter, Qt::Key_Enter },  };  static QHash<char16_t, Qt::Key> functionKeys = { @@ -211,41 +202,19 @@ static int toKeyCode(const QChar &key, int virtualKey, int modifiers)      qCDebug(lcQpaKeyMapperKeys, "Mapping key: %d (0x%04x) / vk %d (0x%04x)",          key.unicode(), key.unicode(), virtualKey, virtualKey); -    if (key == char16_t(kClearCharCode) && virtualKey == 0x47) -        return Qt::Key_Clear; - -    if (key.isDigit()) { -        qCDebug(lcQpaKeyMapperKeys, "Got digit key: %d", key.digitValue()); -        return key.digitValue() + Qt::Key_0; -    } - -    if (key.isLetter()) { -        qCDebug(lcQpaKeyMapperKeys, "Got letter key: %d", (key.toUpper().unicode() - 'A')); -        return (key.toUpper().unicode() - 'A') + Qt::Key_A; -    } -    if (key.isSymbol()) { -        qCDebug(lcQpaKeyMapperKeys, "Got symbol key: %d", (key.unicode())); -        return key.unicode(); -    } - -    if (auto qtKey = standardKeys.value(key.unicode())) { +    // Check first if we have a virtual key that should be treated as layout +    // independent. If so, we want to return early without inspecting the key. +    if (auto qtKey = layoutIndependentKeyCodes.value(virtualKey)) { +        qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey << "based on layout independent virtual key";          // To work like Qt for X11 we issue Backtab when Shift + Tab are pressed          if (qtKey == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { -            qCDebug(lcQpaKeyMapperKeys, "Got key: Qt::Key_Backtab"); +            qCDebug(lcQpaKeyMapperKeys, "Transformed into Qt::Key_Backtab");              return Qt::Key_Backtab;          } - -        qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey; -        return qtKey; -    } - -    // Last ditch try to match the scan code -    if (auto qtKey = virtualKeys.value(virtualKey)) { -        qCDebug(lcQpaKeyMapperKeys) << "Got scancode" << qtKey;          return qtKey;      } -    // Check if they belong to key codes in private unicode range +    // Then check if the key is one of the functions keys in the private Unicode range      if (key >= char16_t(NSUpArrowFunctionKey) && key <= char16_t(NSModeSwitchFunctionKey)) {          if (auto qtKey = functionKeys.value(key.unicode())) {              qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey; @@ -257,6 +226,20 @@ static int toKeyCode(const QChar &key, int virtualKey, int modifiers)          }      } +    if (key.isDigit()) { +        qCDebug(lcQpaKeyMapperKeys, "Got digit key: %d", key.digitValue()); +        return key.digitValue() + Qt::Key_0; +    } + +    if (key.isLetter()) { +        qCDebug(lcQpaKeyMapperKeys, "Got letter key: %d", (key.toUpper().unicode() - 'A')); +        return (key.toUpper().unicode() - 'A') + Qt::Key_A; +    } +    if (key.isSymbol()) { +        qCDebug(lcQpaKeyMapperKeys, "Got symbol key: %d", (key.unicode())); +        return key.unicode(); +    } +      qCDebug(lcQpaKeyMapperKeys, "Unknown case.. %d[%d] %d", key.unicode(), key.toLatin1(), virtualKey);      return Qt::Key_unknown;  } | 
