| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2017~2017 CSSlayer <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "qtkey.h" |
| 9 |
|
| 10 |
#include <QHash> |
| 11 |
#include <QString> |
| 12 |
#include <ctype.h> |
| 13 |
#include <qnamespace.h> |
| 14 |
#include <unordered_map> |
| 15 |
#include <xkbcommon/xkbcommon.h> |
| 16 |
|
| 17 |
const std::unordered_map<uint32_t, int> &KeyTbl() { |
| 18 |
static std::unordered_map<uint32_t, int> keyTbl{ |
| 19 |
std::make_pair(XKB_KEY_KP_Space, Qt::Key_Space), |
| 20 |
std::make_pair(XKB_KEY_KP_Tab, Qt::Key_Tab), |
| 21 |
std::make_pair(XKB_KEY_KP_Enter, Qt::Key_Enter), |
| 22 |
std::make_pair(XKB_KEY_KP_F1, Qt::Key_F1), |
| 23 |
std::make_pair(XKB_KEY_KP_F2, Qt::Key_F2), |
| 24 |
std::make_pair(XKB_KEY_KP_F3, Qt::Key_F3), |
| 25 |
std::make_pair(XKB_KEY_KP_F4, Qt::Key_F4), |
| 26 |
std::make_pair(XKB_KEY_KP_Home, Qt::Key_Home), |
| 27 |
std::make_pair(XKB_KEY_KP_Left, Qt::Key_Left), |
| 28 |
std::make_pair(XKB_KEY_KP_Up, Qt::Key_Up), |
| 29 |
std::make_pair(XKB_KEY_KP_Right, Qt::Key_Right), |
| 30 |
std::make_pair(XKB_KEY_KP_Down, Qt::Key_Down), |
| 31 |
std::make_pair(XKB_KEY_KP_Page_Up, Qt::Key_PageUp), |
| 32 |
std::make_pair(XKB_KEY_KP_Page_Down, Qt::Key_PageDown), |
| 33 |
std::make_pair(XKB_KEY_KP_End, Qt::Key_End), |
| 34 |
std::make_pair(XKB_KEY_KP_Begin, Qt::Key_Clear), |
| 35 |
std::make_pair(XKB_KEY_KP_Insert, Qt::Key_Insert), |
| 36 |
std::make_pair(XKB_KEY_KP_Delete, Qt::Key_Delete), |
| 37 |
std::make_pair(XKB_KEY_KP_Equal, Qt::Key_Equal), |
| 38 |
std::make_pair(XKB_KEY_KP_Multiply, Qt::Key_multiply), |
| 39 |
std::make_pair(XKB_KEY_KP_Add, Qt::Key_Plus), |
| 40 |
std::make_pair(XKB_KEY_KP_Separator, Qt::Key_Comma), |
| 41 |
std::make_pair(XKB_KEY_KP_Subtract, Qt::Key_Minus), |
| 42 |
std::make_pair(XKB_KEY_KP_Decimal, Qt::Key_Period), |
| 43 |
std::make_pair(XKB_KEY_KP_Divide, Qt::Key_Slash), |
| 44 |
|
| 45 |
std::make_pair(XKB_KEY_KP_0, Qt::Key_0), |
| 46 |
std::make_pair(XKB_KEY_KP_1, Qt::Key_1), |
| 47 |
std::make_pair(XKB_KEY_KP_2, Qt::Key_2), |
| 48 |
std::make_pair(XKB_KEY_KP_3, Qt::Key_3), |
| 49 |
std::make_pair(XKB_KEY_KP_4, Qt::Key_4), |
| 50 |
std::make_pair(XKB_KEY_KP_5, Qt::Key_5), |
| 51 |
std::make_pair(XKB_KEY_KP_6, Qt::Key_6), |
| 52 |
std::make_pair(XKB_KEY_KP_7, Qt::Key_7), |
| 53 |
std::make_pair(XKB_KEY_KP_8, Qt::Key_8), |
| 54 |
std::make_pair(XKB_KEY_KP_9, Qt::Key_9), |
| 55 |
|
| 56 |
std::make_pair(XKB_KEY_Escape, Qt::Key_Escape), |
| 57 |
std::make_pair(XKB_KEY_Tab, Qt::Key_Tab), |
| 58 |
std::make_pair(XKB_KEY_ISO_Left_Tab, Qt::Key_Backtab), |
| 59 |
std::make_pair(XKB_KEY_BackSpace, Qt::Key_Backspace), |
| 60 |
std::make_pair(XKB_KEY_Return, Qt::Key_Return), |
| 61 |
std::make_pair(XKB_KEY_KP_Enter, Qt::Key_Enter), |
| 62 |
std::make_pair(XKB_KEY_Insert, Qt::Key_Insert), |
| 63 |
std::make_pair(XKB_KEY_Delete, Qt::Key_Delete), |
| 64 |
std::make_pair(XKB_KEY_Clear, Qt::Key_Delete), |
| 65 |
std::make_pair(XKB_KEY_Pause, Qt::Key_Pause), |
| 66 |
std::make_pair(XKB_KEY_Print, Qt::Key_Print), |
| 67 |
std::make_pair(XKB_KEY_Sys_Req, Qt::Key_SysReq), |
| 68 |
std::make_pair(0x1005FF60, Qt::Key_SysReq), |
| 69 |
std::make_pair(0x1007ff00, Qt::Key_SysReq), |
| 70 |
|
| 71 |
std::make_pair(XKB_KEY_Home, Qt::Key_Home), |
| 72 |
std::make_pair(XKB_KEY_End, Qt::Key_End), |
| 73 |
std::make_pair(XKB_KEY_Left, Qt::Key_Left), |
| 74 |
std::make_pair(XKB_KEY_Up, Qt::Key_Up), |
| 75 |
std::make_pair(XKB_KEY_Right, Qt::Key_Right), |
| 76 |
std::make_pair(XKB_KEY_Down, Qt::Key_Down), |
| 77 |
std::make_pair(XKB_KEY_Page_Up, Qt::Key_PageUp), |
| 78 |
std::make_pair(XKB_KEY_Page_Down, Qt::Key_PageDown), |
| 79 |
std::make_pair(XKB_KEY_Shift_L, Qt::Key_Shift), |
| 80 |
std::make_pair(XKB_KEY_Shift_R, Qt::Key_Shift), |
| 81 |
std::make_pair(XKB_KEY_Shift_Lock, Qt::Key_Shift), |
| 82 |
std::make_pair(XKB_KEY_Control_L, Qt::Key_Control), |
| 83 |
std::make_pair(XKB_KEY_Control_R, Qt::Key_Control), |
| 84 |
std::make_pair(XKB_KEY_Meta_L, Qt::Key_Meta), |
| 85 |
std::make_pair(XKB_KEY_Meta_R, Qt::Key_Meta), |
| 86 |
std::make_pair(XKB_KEY_Alt_L, Qt::Key_Alt), |
| 87 |
std::make_pair(XKB_KEY_Alt_R, Qt::Key_Alt), |
| 88 |
std::make_pair(XKB_KEY_Caps_Lock, Qt::Key_CapsLock), |
| 89 |
std::make_pair(XKB_KEY_Num_Lock, Qt::Key_NumLock), |
| 90 |
std::make_pair(XKB_KEY_Scroll_Lock, Qt::Key_ScrollLock), |
| 91 |
std::make_pair(XKB_KEY_F1, Qt::Key_F1), |
| 92 |
std::make_pair(XKB_KEY_F2, Qt::Key_F2), |
| 93 |
std::make_pair(XKB_KEY_F3, Qt::Key_F3), |
| 94 |
std::make_pair(XKB_KEY_F4, Qt::Key_F4), |
| 95 |
std::make_pair(XKB_KEY_F5, Qt::Key_F5), |
| 96 |
std::make_pair(XKB_KEY_F6, Qt::Key_F6), |
| 97 |
std::make_pair(XKB_KEY_F7, Qt::Key_F7), |
| 98 |
std::make_pair(XKB_KEY_F8, Qt::Key_F8), |
| 99 |
std::make_pair(XKB_KEY_F9, Qt::Key_F9), |
| 100 |
std::make_pair(XKB_KEY_F10, Qt::Key_F10), |
| 101 |
std::make_pair(XKB_KEY_F11, Qt::Key_F11), |
| 102 |
std::make_pair(XKB_KEY_F12, Qt::Key_F12), |
| 103 |
std::make_pair(XKB_KEY_F13, Qt::Key_F13), |
| 104 |
std::make_pair(XKB_KEY_F14, Qt::Key_F14), |
| 105 |
std::make_pair(XKB_KEY_F15, Qt::Key_F15), |
| 106 |
std::make_pair(XKB_KEY_F16, Qt::Key_F16), |
| 107 |
std::make_pair(XKB_KEY_F17, Qt::Key_F17), |
| 108 |
std::make_pair(XKB_KEY_F18, Qt::Key_F18), |
| 109 |
std::make_pair(XKB_KEY_F19, Qt::Key_F19), |
| 110 |
std::make_pair(XKB_KEY_F20, Qt::Key_F20), |
| 111 |
std::make_pair(XKB_KEY_F21, Qt::Key_F21), |
| 112 |
std::make_pair(XKB_KEY_F22, Qt::Key_F22), |
| 113 |
std::make_pair(XKB_KEY_F23, Qt::Key_F23), |
| 114 |
std::make_pair(XKB_KEY_F24, Qt::Key_F24), |
| 115 |
std::make_pair(XKB_KEY_F25, Qt::Key_F25), |
| 116 |
std::make_pair(XKB_KEY_F26, Qt::Key_F26), |
| 117 |
std::make_pair(XKB_KEY_F27, Qt::Key_F27), |
| 118 |
std::make_pair(XKB_KEY_F28, Qt::Key_F28), |
| 119 |
std::make_pair(XKB_KEY_F29, Qt::Key_F29), |
| 120 |
std::make_pair(XKB_KEY_F30, Qt::Key_F30), |
| 121 |
std::make_pair(XKB_KEY_F31, Qt::Key_F31), |
| 122 |
std::make_pair(XKB_KEY_F32, Qt::Key_F32), |
| 123 |
std::make_pair(XKB_KEY_F33, Qt::Key_F33), |
| 124 |
std::make_pair(XKB_KEY_F34, Qt::Key_F34), |
| 125 |
std::make_pair(XKB_KEY_F35, Qt::Key_F35), |
| 126 |
std::make_pair(XKB_KEY_Super_L, Qt::Key_Super_L), |
| 127 |
std::make_pair(XKB_KEY_Super_R, Qt::Key_Super_R), |
| 128 |
std::make_pair(XKB_KEY_Menu, Qt::Key_Menu), |
| 129 |
std::make_pair(XKB_KEY_Hyper_L, Qt::Key_Hyper_L), |
| 130 |
std::make_pair(XKB_KEY_Hyper_R, Qt::Key_Hyper_R), |
| 131 |
std::make_pair(XKB_KEY_Help, Qt::Key_Help), |
| 132 |
std::make_pair(XKB_KEY_ISO_Level3_Shift, Qt::Key_AltGr), |
| 133 |
std::make_pair(XKB_KEY_Multi_key, Qt::Key_Multi_key), |
| 134 |
std::make_pair(XKB_KEY_Codeinput, Qt::Key_Codeinput), |
| 135 |
std::make_pair(XKB_KEY_SingleCandidate, Qt::Key_SingleCandidate), |
| 136 |
std::make_pair(XKB_KEY_MultipleCandidate, Qt::Key_MultipleCandidate), |
| 137 |
std::make_pair(XKB_KEY_PreviousCandidate, Qt::Key_PreviousCandidate), |
| 138 |
std::make_pair(XKB_KEY_Mode_switch, Qt::Key_Mode_switch), |
| 139 |
std::make_pair(XKB_KEY_script_switch, Qt::Key_Mode_switch), |
| 140 |
std::make_pair(XKB_KEY_Kanji, Qt::Key_Kanji), |
| 141 |
std::make_pair(XKB_KEY_Muhenkan, Qt::Key_Muhenkan), |
| 142 |
std::make_pair(XKB_KEY_Henkan, Qt::Key_Henkan), |
| 143 |
std::make_pair(XKB_KEY_Romaji, Qt::Key_Romaji), |
| 144 |
std::make_pair(XKB_KEY_Hiragana, Qt::Key_Hiragana), |
| 145 |
std::make_pair(XKB_KEY_Katakana, Qt::Key_Katakana), |
| 146 |
std::make_pair(XKB_KEY_Hiragana_Katakana, Qt::Key_Hiragana_Katakana), |
| 147 |
std::make_pair(XKB_KEY_Zenkaku, Qt::Key_Zenkaku), |
| 148 |
std::make_pair(XKB_KEY_Hankaku, Qt::Key_Hankaku), |
| 149 |
std::make_pair(XKB_KEY_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku), |
| 150 |
std::make_pair(XKB_KEY_Touroku, Qt::Key_Touroku), |
| 151 |
std::make_pair(XKB_KEY_Massyo, Qt::Key_Massyo), |
| 152 |
std::make_pair(XKB_KEY_Kana_Lock, Qt::Key_Kana_Lock), |
| 153 |
std::make_pair(XKB_KEY_Kana_Shift, Qt::Key_Kana_Shift), |
| 154 |
std::make_pair(XKB_KEY_Eisu_Shift, Qt::Key_Eisu_Shift), |
| 155 |
std::make_pair(XKB_KEY_Eisu_toggle, Qt::Key_Eisu_toggle), |
| 156 |
std::make_pair(XKB_KEY_Kanji_Bangou, Qt::Key_Codeinput), |
| 157 |
std::make_pair(XKB_KEY_Zen_Koho, Qt::Key_MultipleCandidate), |
| 158 |
std::make_pair(XKB_KEY_Mae_Koho, Qt::Key_PreviousCandidate), |
| 159 |
std::make_pair(XKB_KEY_Hangul, Qt::Key_Hangul), |
| 160 |
std::make_pair(XKB_KEY_Hangul_Start, Qt::Key_Hangul_Start), |
| 161 |
std::make_pair(XKB_KEY_Hangul_End, Qt::Key_Hangul_End), |
| 162 |
std::make_pair(XKB_KEY_Hangul_Hanja, Qt::Key_Hangul_Hanja), |
| 163 |
std::make_pair(XKB_KEY_Hangul_Jamo, Qt::Key_Hangul_Jamo), |
| 164 |
std::make_pair(XKB_KEY_Hangul_Romaja, Qt::Key_Hangul_Romaja), |
| 165 |
std::make_pair(XKB_KEY_Hangul_Codeinput, Qt::Key_Codeinput), |
| 166 |
std::make_pair(XKB_KEY_Hangul_Jeonja, Qt::Key_Hangul_Jeonja), |
| 167 |
std::make_pair(XKB_KEY_Hangul_Banja, Qt::Key_Hangul_Banja), |
| 168 |
std::make_pair(XKB_KEY_Hangul_PreHanja, Qt::Key_Hangul_PreHanja), |
| 169 |
std::make_pair(XKB_KEY_Hangul_PostHanja, Qt::Key_Hangul_PostHanja), |
| 170 |
std::make_pair(XKB_KEY_Hangul_SingleCandidate, Qt::Key_SingleCandidate), |
| 171 |
std::make_pair(XKB_KEY_Hangul_MultipleCandidate, |
| 172 |
Qt::Key_MultipleCandidate), |
| 173 |
std::make_pair(XKB_KEY_Hangul_PreviousCandidate, |
| 174 |
Qt::Key_PreviousCandidate), |
| 175 |
std::make_pair(XKB_KEY_Hangul_Special, Qt::Key_Hangul_Special), |
| 176 |
std::make_pair(XKB_KEY_Hangul_switch, Qt::Key_Mode_switch), |
| 177 |
std::make_pair(XKB_KEY_dead_grave, Qt::Key_Dead_Grave), |
| 178 |
std::make_pair(XKB_KEY_dead_acute, Qt::Key_Dead_Acute), |
| 179 |
std::make_pair(XKB_KEY_dead_circumflex, Qt::Key_Dead_Circumflex), |
| 180 |
std::make_pair(XKB_KEY_dead_tilde, Qt::Key_Dead_Tilde), |
| 181 |
std::make_pair(XKB_KEY_dead_macron, Qt::Key_Dead_Macron), |
| 182 |
std::make_pair(XKB_KEY_dead_breve, Qt::Key_Dead_Breve), |
| 183 |
std::make_pair(XKB_KEY_dead_abovedot, Qt::Key_Dead_Abovedot), |
| 184 |
std::make_pair(XKB_KEY_dead_diaeresis, Qt::Key_Dead_Diaeresis), |
| 185 |
std::make_pair(XKB_KEY_dead_abovering, Qt::Key_Dead_Abovering), |
| 186 |
std::make_pair(XKB_KEY_dead_doubleacute, Qt::Key_Dead_Doubleacute), |
| 187 |
std::make_pair(XKB_KEY_dead_caron, Qt::Key_Dead_Caron), |
| 188 |
std::make_pair(XKB_KEY_dead_cedilla, Qt::Key_Dead_Cedilla), |
| 189 |
std::make_pair(XKB_KEY_dead_ogonek, Qt::Key_Dead_Ogonek), |
| 190 |
std::make_pair(XKB_KEY_dead_iota, Qt::Key_Dead_Iota), |
| 191 |
std::make_pair(XKB_KEY_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound), |
| 192 |
std::make_pair(XKB_KEY_dead_semivoiced_sound, |
| 193 |
Qt::Key_Dead_Semivoiced_Sound), |
| 194 |
std::make_pair(XKB_KEY_dead_belowdot, Qt::Key_Dead_Belowdot), |
| 195 |
std::make_pair(XKB_KEY_dead_hook, Qt::Key_Dead_Hook), |
| 196 |
std::make_pair(XKB_KEY_dead_horn, Qt::Key_Dead_Horn), |
| 197 |
std::make_pair(XKB_KEY_XF86Back, Qt::Key_Back), |
| 198 |
std::make_pair(XKB_KEY_XF86Forward, Qt::Key_Forward), |
| 199 |
std::make_pair(XKB_KEY_XF86Stop, Qt::Key_Stop), |
| 200 |
std::make_pair(XKB_KEY_XF86Refresh, Qt::Key_Refresh), |
| 201 |
std::make_pair(XKB_KEY_XF86AudioLowerVolume, Qt::Key_VolumeDown), |
| 202 |
std::make_pair(XKB_KEY_XF86AudioMute, Qt::Key_VolumeMute), |
| 203 |
std::make_pair(XKB_KEY_XF86AudioRaiseVolume, Qt::Key_VolumeUp), |
| 204 |
std::make_pair(XKB_KEY_XF86AudioPlay, Qt::Key_MediaPlay), |
| 205 |
std::make_pair(XKB_KEY_XF86AudioStop, Qt::Key_MediaStop), |
| 206 |
std::make_pair(XKB_KEY_XF86AudioPrev, Qt::Key_MediaPrevious), |
| 207 |
std::make_pair(XKB_KEY_XF86AudioNext, Qt::Key_MediaNext), |
| 208 |
std::make_pair(XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord), |
| 209 |
std::make_pair(XKB_KEY_XF86AudioPause, Qt::Key_MediaPause), |
| 210 |
std::make_pair(XKB_KEY_XF86HomePage, Qt::Key_HomePage), |
| 211 |
std::make_pair(XKB_KEY_XF86Favorites, Qt::Key_Favorites), |
| 212 |
std::make_pair(XKB_KEY_XF86Search, Qt::Key_Search), |
| 213 |
std::make_pair(XKB_KEY_XF86Standby, Qt::Key_Standby), |
| 214 |
std::make_pair(XKB_KEY_XF86OpenURL, Qt::Key_OpenUrl), |
| 215 |
std::make_pair(XKB_KEY_XF86Mail, Qt::Key_LaunchMail), |
| 216 |
std::make_pair(XKB_KEY_XF86AudioMedia, Qt::Key_LaunchMedia), |
| 217 |
std::make_pair(XKB_KEY_XF86MyComputer, Qt::Key_Launch0), |
| 218 |
std::make_pair(XKB_KEY_XF86Calculator, Qt::Key_Launch1), |
| 219 |
std::make_pair(XKB_KEY_XF86Launch0, Qt::Key_Launch2), |
| 220 |
std::make_pair(XKB_KEY_XF86Launch1, Qt::Key_Launch3), |
| 221 |
std::make_pair(XKB_KEY_XF86Launch2, Qt::Key_Launch4), |
| 222 |
std::make_pair(XKB_KEY_XF86Launch3, Qt::Key_Launch5), |
| 223 |
std::make_pair(XKB_KEY_XF86Launch4, Qt::Key_Launch6), |
| 224 |
std::make_pair(XKB_KEY_XF86Launch5, Qt::Key_Launch7), |
| 225 |
std::make_pair(XKB_KEY_XF86Launch6, Qt::Key_Launch8), |
| 226 |
std::make_pair(XKB_KEY_XF86Launch7, Qt::Key_Launch9), |
| 227 |
std::make_pair(XKB_KEY_XF86Launch8, Qt::Key_LaunchA), |
| 228 |
std::make_pair(XKB_KEY_XF86Launch9, Qt::Key_LaunchB), |
| 229 |
std::make_pair(XKB_KEY_XF86LaunchA, Qt::Key_LaunchC), |
| 230 |
std::make_pair(XKB_KEY_XF86LaunchB, Qt::Key_LaunchD), |
| 231 |
std::make_pair(XKB_KEY_XF86LaunchC, Qt::Key_LaunchE), |
| 232 |
std::make_pair(XKB_KEY_XF86LaunchD, Qt::Key_LaunchF), |
| 233 |
std::make_pair(XKB_KEY_XF86MonBrightnessUp, Qt::Key_MonBrightnessUp), |
| 234 |
std::make_pair(XKB_KEY_XF86MonBrightnessDown, |
| 235 |
Qt::Key_MonBrightnessDown), |
| 236 |
std::make_pair(XKB_KEY_XF86KbdLightOnOff, Qt::Key_KeyboardLightOnOff), |
| 237 |
std::make_pair(XKB_KEY_XF86KbdBrightnessUp, |
| 238 |
Qt::Key_KeyboardBrightnessUp), |
| 239 |
std::make_pair(XKB_KEY_XF86KbdBrightnessDown, |
| 240 |
Qt::Key_KeyboardBrightnessDown), |
| 241 |
std::make_pair(XKB_KEY_XF86PowerOff, Qt::Key_PowerOff), |
| 242 |
std::make_pair(XKB_KEY_XF86WakeUp, Qt::Key_WakeUp), |
| 243 |
std::make_pair(XKB_KEY_XF86Eject, Qt::Key_Eject), |
| 244 |
std::make_pair(XKB_KEY_XF86ScreenSaver, Qt::Key_ScreenSaver), |
| 245 |
std::make_pair(XKB_KEY_XF86WWW, Qt::Key_WWW), |
| 246 |
std::make_pair(XKB_KEY_XF86Memo, Qt::Key_Memo), |
| 247 |
std::make_pair(XKB_KEY_XF86LightBulb, Qt::Key_LightBulb), |
| 248 |
std::make_pair(XKB_KEY_XF86Shop, Qt::Key_Shop), |
| 249 |
std::make_pair(XKB_KEY_XF86History, Qt::Key_History), |
| 250 |
std::make_pair(XKB_KEY_XF86AddFavorite, Qt::Key_AddFavorite), |
| 251 |
std::make_pair(XKB_KEY_XF86HotLinks, Qt::Key_HotLinks), |
| 252 |
std::make_pair(XKB_KEY_XF86BrightnessAdjust, Qt::Key_BrightnessAdjust), |
| 253 |
std::make_pair(XKB_KEY_XF86Finance, Qt::Key_Finance), |
| 254 |
std::make_pair(XKB_KEY_XF86Community, Qt::Key_Community), |
| 255 |
std::make_pair(XKB_KEY_XF86AudioRewind, Qt::Key_AudioRewind), |
| 256 |
std::make_pair(XKB_KEY_XF86BackForward, Qt::Key_BackForward), |
| 257 |
std::make_pair(XKB_KEY_XF86ApplicationLeft, Qt::Key_ApplicationLeft), |
| 258 |
std::make_pair(XKB_KEY_XF86ApplicationRight, Qt::Key_ApplicationRight), |
| 259 |
std::make_pair(XKB_KEY_XF86Book, Qt::Key_Book), |
| 260 |
std::make_pair(XKB_KEY_XF86CD, Qt::Key_CD), |
| 261 |
std::make_pair(XKB_KEY_XF86Calculater, Qt::Key_Calculator), |
| 262 |
std::make_pair(XKB_KEY_XF86ToDoList, Qt::Key_ToDoList), |
| 263 |
std::make_pair(XKB_KEY_XF86ClearGrab, Qt::Key_ClearGrab), |
| 264 |
std::make_pair(XKB_KEY_XF86Close, Qt::Key_Close), |
| 265 |
std::make_pair(XKB_KEY_XF86Copy, Qt::Key_Copy), |
| 266 |
std::make_pair(XKB_KEY_XF86Cut, Qt::Key_Cut), |
| 267 |
std::make_pair(XKB_KEY_XF86Display, Qt::Key_Display), |
| 268 |
std::make_pair(XKB_KEY_XF86DOS, Qt::Key_DOS), |
| 269 |
std::make_pair(XKB_KEY_XF86Documents, Qt::Key_Documents), |
| 270 |
std::make_pair(XKB_KEY_XF86Excel, Qt::Key_Excel), |
| 271 |
std::make_pair(XKB_KEY_XF86Explorer, Qt::Key_Explorer), |
| 272 |
std::make_pair(XKB_KEY_XF86Game, Qt::Key_Game), |
| 273 |
std::make_pair(XKB_KEY_XF86Go, Qt::Key_Go), |
| 274 |
std::make_pair(XKB_KEY_XF86iTouch, Qt::Key_iTouch), |
| 275 |
std::make_pair(XKB_KEY_XF86LogOff, Qt::Key_LogOff), |
| 276 |
std::make_pair(XKB_KEY_XF86Market, Qt::Key_Market), |
| 277 |
std::make_pair(XKB_KEY_XF86Meeting, Qt::Key_Meeting), |
| 278 |
std::make_pair(XKB_KEY_XF86MenuKB, Qt::Key_MenuKB), |
| 279 |
std::make_pair(XKB_KEY_XF86MenuPB, Qt::Key_MenuPB), |
| 280 |
std::make_pair(XKB_KEY_XF86MySites, Qt::Key_MySites), |
| 281 |
std::make_pair(XKB_KEY_XF86News, Qt::Key_News), |
| 282 |
std::make_pair(XKB_KEY_XF86OfficeHome, Qt::Key_OfficeHome), |
| 283 |
std::make_pair(XKB_KEY_XF86Option, Qt::Key_Option), |
| 284 |
std::make_pair(XKB_KEY_XF86Paste, Qt::Key_Paste), |
| 285 |
std::make_pair(XKB_KEY_XF86Phone, Qt::Key_Phone), |
| 286 |
std::make_pair(XKB_KEY_XF86Calendar, Qt::Key_Calendar), |
| 287 |
std::make_pair(XKB_KEY_XF86Reply, Qt::Key_Reply), |
| 288 |
std::make_pair(XKB_KEY_XF86Reload, Qt::Key_Reload), |
| 289 |
std::make_pair(XKB_KEY_XF86RotateWindows, Qt::Key_RotateWindows), |
| 290 |
std::make_pair(XKB_KEY_XF86RotationPB, Qt::Key_RotationPB), |
| 291 |
std::make_pair(XKB_KEY_XF86RotationKB, Qt::Key_RotationKB), |
| 292 |
std::make_pair(XKB_KEY_XF86Save, Qt::Key_Save), |
| 293 |
std::make_pair(XKB_KEY_XF86Send, Qt::Key_Send), |
| 294 |
std::make_pair(XKB_KEY_XF86Spell, Qt::Key_Spell), |
| 295 |
std::make_pair(XKB_KEY_XF86SplitScreen, Qt::Key_SplitScreen), |
| 296 |
std::make_pair(XKB_KEY_XF86Support, Qt::Key_Support), |
| 297 |
std::make_pair(XKB_KEY_XF86TaskPane, Qt::Key_TaskPane), |
| 298 |
std::make_pair(XKB_KEY_XF86Terminal, Qt::Key_Terminal), |
| 299 |
std::make_pair(XKB_KEY_XF86Tools, Qt::Key_Tools), |
| 300 |
std::make_pair(XKB_KEY_XF86Travel, Qt::Key_Travel), |
| 301 |
std::make_pair(XKB_KEY_XF86Video, Qt::Key_Video), |
| 302 |
std::make_pair(XKB_KEY_XF86Word, Qt::Key_Word), |
| 303 |
std::make_pair(XKB_KEY_XF86Xfer, Qt::Key_Xfer), |
| 304 |
std::make_pair(XKB_KEY_XF86ZoomIn, Qt::Key_ZoomIn), |
| 305 |
std::make_pair(XKB_KEY_XF86ZoomOut, Qt::Key_ZoomOut), |
| 306 |
std::make_pair(XKB_KEY_XF86Away, Qt::Key_Away), |
| 307 |
std::make_pair(XKB_KEY_XF86Messenger, Qt::Key_Messenger), |
| 308 |
std::make_pair(XKB_KEY_XF86WebCam, Qt::Key_WebCam), |
| 309 |
std::make_pair(XKB_KEY_XF86MailForward, Qt::Key_MailForward), |
| 310 |
std::make_pair(XKB_KEY_XF86Pictures, Qt::Key_Pictures), |
| 311 |
std::make_pair(XKB_KEY_XF86Music, Qt::Key_Music), |
| 312 |
std::make_pair(XKB_KEY_XF86Battery, Qt::Key_Battery), |
| 313 |
std::make_pair(XKB_KEY_XF86Bluetooth, Qt::Key_Bluetooth), |
| 314 |
std::make_pair(XKB_KEY_XF86WLAN, Qt::Key_WLAN), |
| 315 |
std::make_pair(XKB_KEY_XF86UWB, Qt::Key_UWB), |
| 316 |
std::make_pair(XKB_KEY_XF86AudioForward, Qt::Key_AudioForward), |
| 317 |
std::make_pair(XKB_KEY_XF86AudioRepeat, Qt::Key_AudioRepeat), |
| 318 |
std::make_pair(XKB_KEY_XF86AudioRandomPlay, Qt::Key_AudioRandomPlay), |
| 319 |
std::make_pair(XKB_KEY_XF86Subtitle, Qt::Key_Subtitle), |
| 320 |
std::make_pair(XKB_KEY_XF86AudioCycleTrack, Qt::Key_AudioCycleTrack), |
| 321 |
std::make_pair(XKB_KEY_XF86Time, Qt::Key_Time), |
| 322 |
std::make_pair(XKB_KEY_XF86Hibernate, Qt::Key_Hibernate), |
| 323 |
std::make_pair(XKB_KEY_XF86View, Qt::Key_View), |
| 324 |
std::make_pair(XKB_KEY_XF86TopMenu, Qt::Key_TopMenu), |
| 325 |
std::make_pair(XKB_KEY_XF86PowerDown, Qt::Key_PowerDown), |
| 326 |
std::make_pair(XKB_KEY_XF86Suspend, Qt::Key_Suspend), |
| 327 |
std::make_pair(XKB_KEY_XF86ContrastAdjust, Qt::Key_ContrastAdjust), |
| 328 |
|
| 329 |
std::make_pair(XKB_KEY_XF86LaunchE, Qt::Key_LaunchG), |
| 330 |
std::make_pair(XKB_KEY_XF86LaunchF, Qt::Key_LaunchH), |
| 331 |
|
| 332 |
std::make_pair(XKB_KEY_XF86Select, Qt::Key_Select), |
| 333 |
std::make_pair(XKB_KEY_Cancel, Qt::Key_Cancel), |
| 334 |
std::make_pair(XKB_KEY_Execute, Qt::Key_Execute), |
| 335 |
std::make_pair(XKB_KEY_XF86Sleep, Qt::Key_Sleep), |
| 336 |
}; |
| 337 |
return keyTbl; |
| 338 |
} |
| 339 |
|
| 340 |
int keysymToQtKey(uint32_t key) { |
| 341 |
auto iter = KeyTbl().find(key); |
| 342 |
if (iter != KeyTbl().end()) { |
| 343 |
return iter->second; |
| 344 |
} |
| 345 |
return 0; |
| 346 |
} |
| 347 |
|
| 348 |
int keysymToQtKey(uint32_t keysym, const QString &text) { |
| 349 |
int code = 0; |
| 350 |
if (keysym < 128) { |
| 351 |
// upper-case key, if known |
| 352 |
code = isprint((int)keysym) ? toupper((int)keysym) : 0; |
| 353 |
} else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && |
| 354 |
text.unicode()->unicode() != 0x7f && |
| 355 |
!(keysym >= XKB_KEY_dead_grave && |
| 356 |
keysym <= XKB_KEY_dead_currency)) { |
| 357 |
code = text.unicode()->toUpper().unicode(); |
| 358 |
} else { |
| 359 |
// any other keys |
| 360 |
code = keysymToQtKey(keysym); |
| 361 |
} |
| 362 |
|
| 363 |
return code; |
| 364 |
} |