File indexing completed on 2024-04-21 03:59:26
0001 /* 0002 SPDX-FileCopyrightText: 2001 Ellis Whitehead <ellis@kde.org> 0003 0004 Win32 port: 0005 SPDX-FileCopyrightText: 2004 Jarosław Staniek <staniek@kde.org> 0006 0007 SPDX-License-Identifier: LGPL-2.1-or-later 0008 */ 0009 0010 #include "kkeyserver.h" 0011 0012 #include "kwindowsystem_xcb_debug.h" 0013 0014 #include <private/qtx11extras_p.h> 0015 0016 #define XK_MISCELLANY 0017 #define XK_XKB_KEYS 0018 #include <X11/X.h> 0019 #include <X11/Xlib.h> 0020 #include <X11/Xutil.h> 0021 #include <X11/keysymdef.h> 0022 #include <xcb/xcb_keysyms.h> 0023 #define X11_ONLY(arg) arg, // allows to omit an argument 0024 0025 #include <QCoreApplication> 0026 0027 namespace KKeyServer 0028 { 0029 //--------------------------------------------------------------------- 0030 // Array Structures 0031 //--------------------------------------------------------------------- 0032 0033 struct ModInfo { 0034 int modQt; 0035 const char *psName; 0036 QString *sLabel; // this struct is used in static objects, so must use a pointer here. 0037 }; 0038 0039 //--------------------------------------------------------------------- 0040 // Arrays 0041 //--------------------------------------------------------------------- 0042 0043 // Key names with this context are extracted elsewhere, 0044 // no need for I18N_NOOP2's here. 0045 #define KEYCTXT "keyboard-key-name" 0046 static ModInfo g_rgModInfo[4] = { 0047 {Qt::SHIFT, "Shift", nullptr}, 0048 {Qt::CTRL, "Ctrl", nullptr}, 0049 {Qt::ALT, "Alt", nullptr}, 0050 {Qt::META, "Meta", nullptr}, 0051 }; 0052 0053 //--------------------------------------------------------------------- 0054 // Initialization 0055 //--------------------------------------------------------------------- 0056 static bool g_bInitializedKKeyLabels; 0057 static bool g_bMacLabels; 0058 0059 static void intializeKKeyLabels() 0060 { 0061 g_rgModInfo[0].sLabel = new QString(QCoreApplication::translate("KKeyServer", (g_rgModInfo[0].psName), KEYCTXT)); 0062 g_rgModInfo[1].sLabel = new QString(QCoreApplication::translate("KKeyServer", (g_rgModInfo[1].psName), KEYCTXT)); 0063 g_rgModInfo[2].sLabel = new QString(QCoreApplication::translate("KKeyServer", (g_rgModInfo[2].psName), KEYCTXT)); 0064 g_rgModInfo[3].sLabel = new QString(QCoreApplication::translate("KKeyServer", (g_rgModInfo[3].psName), KEYCTXT)); 0065 g_bMacLabels = (*g_rgModInfo[2].sLabel == QLatin1String("Command")); 0066 g_bInitializedKKeyLabels = true; 0067 } 0068 0069 //--------------------------------------------------------------------- 0070 // Public functions 0071 //--------------------------------------------------------------------- 0072 0073 static QString modToString(uint mod, bool bUserSpace) 0074 { 0075 if (bUserSpace && !g_bInitializedKKeyLabels) { 0076 intializeKKeyLabels(); 0077 } 0078 0079 QString s; 0080 for (int i = 3; i >= 0; i--) { 0081 if (mod & g_rgModInfo[i].modQt) { 0082 if (!s.isEmpty()) { 0083 s += QLatin1Char('+'); 0084 } 0085 s += (bUserSpace) ? *g_rgModInfo[i].sLabel : QLatin1String(g_rgModInfo[i].psName); 0086 } 0087 } 0088 return s; 0089 } 0090 0091 QString modToStringUser(uint mod) 0092 { 0093 return modToString(mod, true); 0094 } 0095 0096 uint stringUserToMod(const QString &mod) 0097 { 0098 for (int i = 3; i >= 0; i--) { 0099 if (mod.toLower() == g_rgModInfo[i].sLabel->toLower()) { 0100 return g_rgModInfo[i].modQt; 0101 } 0102 } 0103 return 0; 0104 } 0105 0106 bool isShiftAsModifierAllowed(int keyQt) 0107 { 0108 // remove any modifiers 0109 keyQt &= ~Qt::KeyboardModifierMask; 0110 0111 // Shift only works as a modifier with certain keys. It's not possible 0112 // to enter the SHIFT+5 key sequence for me because this is handled as 0113 // '%' by qt on my keyboard. 0114 // The working keys are all hardcoded here :-( 0115 if (keyQt >= Qt::Key_F1 && keyQt <= Qt::Key_F35) { 0116 return true; 0117 } 0118 0119 // Returns false if not a unicode code point 0120 if (QChar::isLetter(keyQt)) { 0121 return true; 0122 } 0123 0124 switch (keyQt) { 0125 case Qt::Key_Return: 0126 case Qt::Key_Space: 0127 case Qt::Key_Backspace: 0128 case Qt::Key_Tab: 0129 case Qt::Key_Backtab: 0130 case Qt::Key_Escape: 0131 case Qt::Key_Print: 0132 case Qt::Key_ScrollLock: 0133 case Qt::Key_Pause: 0134 case Qt::Key_PageUp: 0135 case Qt::Key_PageDown: 0136 case Qt::Key_Insert: 0137 case Qt::Key_Delete: 0138 case Qt::Key_Home: 0139 case Qt::Key_End: 0140 case Qt::Key_Up: 0141 case Qt::Key_Down: 0142 case Qt::Key_Left: 0143 case Qt::Key_Right: 0144 case Qt::Key_Enter: 0145 case Qt::Key_SysReq: 0146 case Qt::Key_CapsLock: 0147 case Qt::Key_NumLock: 0148 case Qt::Key_Help: 0149 case Qt::Key_Back: 0150 case Qt::Key_Forward: 0151 case Qt::Key_Stop: 0152 case Qt::Key_Refresh: 0153 case Qt::Key_Favorites: 0154 case Qt::Key_LaunchMedia: 0155 case Qt::Key_OpenUrl: 0156 case Qt::Key_HomePage: 0157 case Qt::Key_Search: 0158 case Qt::Key_VolumeDown: 0159 case Qt::Key_VolumeMute: 0160 case Qt::Key_VolumeUp: 0161 case Qt::Key_BassBoost: 0162 case Qt::Key_BassUp: 0163 case Qt::Key_BassDown: 0164 case Qt::Key_TrebleUp: 0165 case Qt::Key_TrebleDown: 0166 case Qt::Key_MediaPlay: 0167 case Qt::Key_MediaStop: 0168 case Qt::Key_MediaPrevious: 0169 case Qt::Key_MediaNext: 0170 case Qt::Key_MediaRecord: 0171 case Qt::Key_MediaPause: 0172 case Qt::Key_MediaTogglePlayPause: 0173 case Qt::Key_LaunchMail: 0174 case Qt::Key_Calculator: 0175 case Qt::Key_Memo: 0176 case Qt::Key_ToDoList: 0177 case Qt::Key_Calendar: 0178 case Qt::Key_PowerDown: 0179 case Qt::Key_ContrastAdjust: 0180 case Qt::Key_Standby: 0181 case Qt::Key_MonBrightnessUp: 0182 case Qt::Key_MonBrightnessDown: 0183 case Qt::Key_KeyboardLightOnOff: 0184 case Qt::Key_KeyboardBrightnessUp: 0185 case Qt::Key_KeyboardBrightnessDown: 0186 case Qt::Key_PowerOff: 0187 case Qt::Key_WakeUp: 0188 case Qt::Key_Eject: 0189 case Qt::Key_ScreenSaver: 0190 case Qt::Key_WWW: 0191 case Qt::Key_Sleep: 0192 case Qt::Key_LightBulb: 0193 case Qt::Key_Shop: 0194 case Qt::Key_History: 0195 case Qt::Key_AddFavorite: 0196 case Qt::Key_HotLinks: 0197 case Qt::Key_BrightnessAdjust: 0198 case Qt::Key_Finance: 0199 case Qt::Key_Community: 0200 case Qt::Key_AudioRewind: 0201 case Qt::Key_BackForward: 0202 case Qt::Key_ApplicationLeft: 0203 case Qt::Key_ApplicationRight: 0204 case Qt::Key_Book: 0205 case Qt::Key_CD: 0206 case Qt::Key_Clear: 0207 case Qt::Key_ClearGrab: 0208 case Qt::Key_Close: 0209 case Qt::Key_Copy: 0210 case Qt::Key_Cut: 0211 case Qt::Key_Display: 0212 case Qt::Key_DOS: 0213 case Qt::Key_Documents: 0214 case Qt::Key_Excel: 0215 case Qt::Key_Explorer: 0216 case Qt::Key_Game: 0217 case Qt::Key_Go: 0218 case Qt::Key_iTouch: 0219 case Qt::Key_LogOff: 0220 case Qt::Key_Market: 0221 case Qt::Key_Meeting: 0222 case Qt::Key_MenuKB: 0223 case Qt::Key_MenuPB: 0224 case Qt::Key_MySites: 0225 case Qt::Key_News: 0226 case Qt::Key_OfficeHome: 0227 case Qt::Key_Option: 0228 case Qt::Key_Paste: 0229 case Qt::Key_Phone: 0230 case Qt::Key_Reply: 0231 case Qt::Key_Reload: 0232 case Qt::Key_RotateWindows: 0233 case Qt::Key_RotationPB: 0234 case Qt::Key_RotationKB: 0235 case Qt::Key_Save: 0236 case Qt::Key_Send: 0237 case Qt::Key_Spell: 0238 case Qt::Key_SplitScreen: 0239 case Qt::Key_Support: 0240 case Qt::Key_TaskPane: 0241 case Qt::Key_Terminal: 0242 case Qt::Key_Tools: 0243 case Qt::Key_Travel: 0244 case Qt::Key_Video: 0245 case Qt::Key_Word: 0246 case Qt::Key_Xfer: 0247 case Qt::Key_ZoomIn: 0248 case Qt::Key_ZoomOut: 0249 case Qt::Key_Away: 0250 case Qt::Key_Messenger: 0251 case Qt::Key_WebCam: 0252 case Qt::Key_MailForward: 0253 case Qt::Key_Pictures: 0254 case Qt::Key_Music: 0255 case Qt::Key_Battery: 0256 case Qt::Key_Bluetooth: 0257 case Qt::Key_WLAN: 0258 case Qt::Key_UWB: 0259 case Qt::Key_AudioForward: 0260 case Qt::Key_AudioRepeat: 0261 case Qt::Key_AudioRandomPlay: 0262 case Qt::Key_Subtitle: 0263 case Qt::Key_AudioCycleTrack: 0264 case Qt::Key_Time: 0265 case Qt::Key_Select: 0266 case Qt::Key_View: 0267 case Qt::Key_TopMenu: 0268 case Qt::Key_Suspend: 0269 case Qt::Key_Hibernate: 0270 case Qt::Key_Launch0: 0271 case Qt::Key_Launch1: 0272 case Qt::Key_Launch2: 0273 case Qt::Key_Launch3: 0274 case Qt::Key_Launch4: 0275 case Qt::Key_Launch5: 0276 case Qt::Key_Launch6: 0277 case Qt::Key_Launch7: 0278 case Qt::Key_Launch8: 0279 case Qt::Key_Launch9: 0280 case Qt::Key_LaunchA: 0281 case Qt::Key_LaunchB: 0282 case Qt::Key_LaunchC: 0283 case Qt::Key_LaunchD: 0284 case Qt::Key_LaunchE: 0285 case Qt::Key_LaunchF: 0286 return true; 0287 0288 default: 0289 return false; 0290 } 0291 } 0292 0293 // #define KKEYSERVER_DEBUG 1 0294 0295 //--------------------------------------------------------------------- 0296 // Data Structures 0297 //--------------------------------------------------------------------- 0298 0299 struct Mod { 0300 int m_mod; 0301 }; 0302 0303 //--------------------------------------------------------------------- 0304 // Array Structures 0305 //--------------------------------------------------------------------- 0306 0307 struct X11ModInfo { 0308 int modQt; 0309 int modX; 0310 }; 0311 0312 struct SymVariation { 0313 uint sym, symVariation; 0314 bool bActive; 0315 }; 0316 0317 struct SymName { 0318 uint sym; 0319 const char *psName; 0320 }; 0321 0322 struct TransKey { 0323 int keySymQt; 0324 uint keySymX; 0325 }; 0326 0327 //--------------------------------------------------------------------- 0328 // Arrays 0329 //--------------------------------------------------------------------- 0330 // clang-format off 0331 0332 static X11ModInfo g_rgX11ModInfo[4] = { 0333 { Qt::SHIFT, X11_ONLY(ShiftMask) }, 0334 { Qt::CTRL, X11_ONLY(ControlMask) }, 0335 { Qt::ALT, X11_ONLY(Mod1Mask) }, 0336 { Qt::META, X11_ONLY(Mod4Mask) } 0337 }; 0338 0339 // These are the X equivalents to the Qt keycodes 0x1000 - 0x1026 0340 static const TransKey g_rgQtToSymX[] = { 0341 { Qt::Key_Escape, XK_Escape }, 0342 { Qt::Key_Tab, XK_Tab }, 0343 { Qt::Key_Backtab, XK_ISO_Left_Tab }, 0344 { Qt::Key_Backspace, XK_BackSpace }, 0345 { Qt::Key_Return, XK_Return }, 0346 { Qt::Key_Insert, XK_Insert }, 0347 { Qt::Key_Delete, XK_Delete }, 0348 { Qt::Key_Pause, XK_Pause }, 0349 #ifdef sun 0350 { Qt::Key_Print, XK_F22 }, 0351 #else 0352 { Qt::Key_Print, XK_Print }, 0353 #endif 0354 { Qt::Key_SysReq, XK_Sys_Req }, 0355 { Qt::Key_Home, XK_Home }, 0356 { Qt::Key_End, XK_End }, 0357 { Qt::Key_Left, XK_Left }, 0358 { Qt::Key_Up, XK_Up }, 0359 { Qt::Key_Right, XK_Right }, 0360 { Qt::Key_Down, XK_Down }, 0361 { Qt::Key_PageUp, XK_Prior }, 0362 { Qt::Key_PageDown, XK_Next }, 0363 //{ Qt::Key_Shift, 0 }, 0364 //{ Qt::Key_Control, 0 }, 0365 //{ Qt::Key_Meta, 0 }, 0366 //{ Qt::Key_Alt, 0 }, 0367 { Qt::Key_CapsLock, XK_Caps_Lock }, 0368 { Qt::Key_NumLock, XK_Num_Lock }, 0369 { Qt::Key_ScrollLock, XK_Scroll_Lock }, 0370 { Qt::Key_F1, XK_F1 }, 0371 { Qt::Key_F2, XK_F2 }, 0372 { Qt::Key_F3, XK_F3 }, 0373 { Qt::Key_F4, XK_F4 }, 0374 { Qt::Key_F5, XK_F5 }, 0375 { Qt::Key_F6, XK_F6 }, 0376 { Qt::Key_F7, XK_F7 }, 0377 { Qt::Key_F8, XK_F8 }, 0378 { Qt::Key_F9, XK_F9 }, 0379 { Qt::Key_F10, XK_F10 }, 0380 { Qt::Key_F11, XK_F11 }, 0381 { Qt::Key_F12, XK_F12 }, 0382 { Qt::Key_F13, XK_F13 }, 0383 { Qt::Key_F14, XK_F14 }, 0384 { Qt::Key_F15, XK_F15 }, 0385 { Qt::Key_F16, XK_F16 }, 0386 { Qt::Key_F17, XK_F17 }, 0387 { Qt::Key_F18, XK_F18 }, 0388 { Qt::Key_F19, XK_F19 }, 0389 { Qt::Key_F20, XK_F20 }, 0390 { Qt::Key_F21, XK_F21 }, 0391 { Qt::Key_F22, XK_F22 }, 0392 { Qt::Key_F23, XK_F23 }, 0393 { Qt::Key_F24, XK_F24 }, 0394 { Qt::Key_F25, XK_F25 }, 0395 { Qt::Key_F26, XK_F26 }, 0396 { Qt::Key_F27, XK_F27 }, 0397 { Qt::Key_F28, XK_F28 }, 0398 { Qt::Key_F29, XK_F29 }, 0399 { Qt::Key_F30, XK_F30 }, 0400 { Qt::Key_F31, XK_F31 }, 0401 { Qt::Key_F32, XK_F32 }, 0402 { Qt::Key_F33, XK_F33 }, 0403 { Qt::Key_F34, XK_F34 }, 0404 { Qt::Key_F35, XK_F35 }, 0405 { Qt::Key_Super_L, XK_Super_L }, 0406 { Qt::Key_Super_R, XK_Super_R }, 0407 { Qt::Key_Menu, XK_Menu }, 0408 { Qt::Key_Hyper_L, XK_Hyper_L }, 0409 { Qt::Key_Hyper_R, XK_Hyper_R }, 0410 { Qt::Key_Help, XK_Help }, 0411 //{ Qt::Key_Direction_L, XK_Direction_L }, These keys don't exist in X11 0412 //{ Qt::Key_Direction_R, XK_Direction_R }, 0413 0414 { Qt::Key_Space, XK_KP_Space }, 0415 { Qt::Key_Tab, XK_KP_Tab }, 0416 { Qt::Key_Enter, XK_KP_Enter }, 0417 { Qt::Key_Home, XK_KP_Home }, 0418 { Qt::Key_Left, XK_KP_Left }, 0419 { Qt::Key_Up, XK_KP_Up }, 0420 { Qt::Key_Right, XK_KP_Right }, 0421 { Qt::Key_Down, XK_KP_Down }, 0422 { Qt::Key_PageUp, XK_KP_Prior }, 0423 { Qt::Key_PageDown, XK_KP_Next }, 0424 { Qt::Key_End, XK_KP_End }, 0425 { Qt::Key_Clear, XK_KP_Begin }, 0426 { Qt::Key_Insert, XK_KP_Insert }, 0427 { Qt::Key_Delete, XK_KP_Delete }, 0428 { Qt::Key_Equal, XK_KP_Equal }, 0429 { Qt::Key_Asterisk, XK_KP_Multiply }, 0430 { Qt::Key_Plus, XK_KP_Add }, 0431 { Qt::Key_Comma, XK_KP_Separator }, 0432 { Qt::Key_Minus, XK_KP_Subtract }, 0433 { Qt::Key_Period, XK_KP_Decimal }, 0434 { Qt::Key_Slash, XK_KP_Divide }, 0435 0436 // the next lines are taken on 01/2024 from X.org (X11/XF86keysym.h), defining some special 0437 // multimedia keys. They are included here as not every system has them. 0438 #define XF86XK_ModeLock 0x1008ff01 /* Mode Switch Lock */ 0439 0440 /* Backlight controls. */ 0441 #define XF86XK_MonBrightnessUp 0x1008ff02 /* Monitor/panel brightness */ 0442 #define XF86XK_MonBrightnessDown 0x1008ff03 /* Monitor/panel brightness */ 0443 #define XF86XK_KbdLightOnOff 0x1008ff04 /* Keyboards may be lit */ 0444 #define XF86XK_KbdBrightnessUp 0x1008ff05 /* Keyboards may be lit */ 0445 #define XF86XK_KbdBrightnessDown 0x1008ff06 /* Keyboards may be lit */ 0446 #define XF86XK_MonBrightnessCycle 0x1008ff07 /* Monitor/panel brightness */ 0447 0448 /* 0449 * Keys found on some "Internet" keyboards. 0450 */ 0451 #define XF86XK_Standby 0x1008ff10 /* System into standby mode */ 0452 #define XF86XK_AudioLowerVolume 0x1008ff11 /* Volume control down */ 0453 #define XF86XK_AudioMute 0x1008ff12 /* Mute sound from the system */ 0454 #define XF86XK_AudioRaiseVolume 0x1008ff13 /* Volume control up */ 0455 #define XF86XK_AudioPlay 0x1008ff14 /* Start playing of audio > */ 0456 #define XF86XK_AudioStop 0x1008ff15 /* Stop playing audio */ 0457 #define XF86XK_AudioPrev 0x1008ff16 /* Previous track */ 0458 #define XF86XK_AudioNext 0x1008ff17 /* Next track */ 0459 #define XF86XK_HomePage 0x1008ff18 /* Display user's home page */ 0460 #define XF86XK_Mail 0x1008ff19 /* Invoke user's mail program */ 0461 #define XF86XK_Start 0x1008ff1a /* Start application */ 0462 #define XF86XK_Search 0x1008ff1b /* Search */ 0463 #define XF86XK_AudioRecord 0x1008ff1c /* Record audio application */ 0464 0465 /* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */ 0466 #define XF86XK_Calculator 0x1008ff1d /* Invoke calculator program */ 0467 #define XF86XK_Memo 0x1008ff1e /* Invoke Memo taking program */ 0468 #define XF86XK_ToDoList 0x1008ff1f /* Invoke To Do List program */ 0469 #define XF86XK_Calendar 0x1008ff20 /* Invoke Calendar program */ 0470 #define XF86XK_PowerDown 0x1008ff21 /* Deep sleep the system */ 0471 #define XF86XK_ContrastAdjust 0x1008ff22 /* Adjust screen contrast */ 0472 #define XF86XK_RockerUp 0x1008ff23 /* Rocker switches exist up */ 0473 #define XF86XK_RockerDown 0x1008ff24 /* and down */ 0474 #define XF86XK_RockerEnter 0x1008ff25 /* and let you press them */ 0475 0476 /* Some more "Internet" keyboard symbols */ 0477 #define XF86XK_Back 0x1008ff26 /* Like back on a browser */ 0478 #define XF86XK_Forward 0x1008ff27 /* Like forward on a browser */ 0479 #define XF86XK_Stop 0x1008ff28 /* Stop current operation */ 0480 #define XF86XK_Refresh 0x1008ff29 /* Refresh the page */ 0481 #define XF86XK_PowerOff 0x1008ff2a /* Power off system entirely */ 0482 #define XF86XK_WakeUp 0x1008ff2b /* Wake up system from sleep */ 0483 #define XF86XK_Eject 0x1008ff2c /* Eject device (e.g. DVD) */ 0484 #define XF86XK_ScreenSaver 0x1008ff2d /* Invoke screensaver */ 0485 #define XF86XK_WWW 0x1008ff2e /* Invoke web browser */ 0486 #define XF86XK_Sleep 0x1008ff2f /* Put system to sleep */ 0487 #define XF86XK_Favorites 0x1008ff30 /* Show favorite locations */ 0488 #define XF86XK_AudioPause 0x1008ff31 /* Pause audio playing */ 0489 #define XF86XK_AudioMedia 0x1008ff32 /* Launch media collection app */ 0490 #define XF86XK_MyComputer 0x1008ff33 /* Display "My Computer" window */ 0491 #define XF86XK_VendorHome 0x1008ff34 /* Display vendor home web site */ 0492 #define XF86XK_LightBulb 0x1008ff35 /* Light bulb keys exist */ 0493 #define XF86XK_Shop 0x1008ff36 /* Display shopping web site */ 0494 #define XF86XK_History 0x1008ff37 /* Show history of web surfing */ 0495 #define XF86XK_OpenURL 0x1008ff38 /* Open selected URL */ 0496 #define XF86XK_AddFavorite 0x1008ff39 /* Add URL to favorites list */ 0497 #define XF86XK_HotLinks 0x1008ff3a /* Show "hot" links */ 0498 #define XF86XK_BrightnessAdjust 0x1008ff3b /* Invoke brightness adj. UI */ 0499 #define XF86XK_Finance 0x1008ff3c /* Display financial site */ 0500 #define XF86XK_Community 0x1008ff3d /* Display user's community */ 0501 #define XF86XK_AudioRewind 0x1008ff3e /* "rewind" audio track */ 0502 #define XF86XK_BackForward 0x1008ff3f /* ??? */ 0503 #define XF86XK_Launch0 0x1008ff40 /* Launch Application */ 0504 #define XF86XK_Launch1 0x1008ff41 /* Launch Application */ 0505 #define XF86XK_Launch2 0x1008ff42 /* Launch Application */ 0506 #define XF86XK_Launch3 0x1008ff43 /* Launch Application */ 0507 #define XF86XK_Launch4 0x1008ff44 /* Launch Application */ 0508 #define XF86XK_Launch5 0x1008ff45 /* Launch Application */ 0509 #define XF86XK_Launch6 0x1008ff46 /* Launch Application */ 0510 #define XF86XK_Launch7 0x1008ff47 /* Launch Application */ 0511 #define XF86XK_Launch8 0x1008ff48 /* Launch Application */ 0512 #define XF86XK_Launch9 0x1008ff49 /* Launch Application */ 0513 #define XF86XK_LaunchA 0x1008ff4a /* Launch Application */ 0514 #define XF86XK_LaunchB 0x1008ff4b /* Launch Application */ 0515 #define XF86XK_LaunchC 0x1008ff4c /* Launch Application */ 0516 #define XF86XK_LaunchD 0x1008ff4d /* Launch Application */ 0517 #define XF86XK_LaunchE 0x1008ff4e /* Launch Application */ 0518 #define XF86XK_LaunchF 0x1008ff4f /* Launch Application */ 0519 0520 #define XF86XK_ApplicationLeft 0x1008ff50 /* switch to application, left */ 0521 #define XF86XK_ApplicationRight 0x1008ff51 /* switch to application, right*/ 0522 #define XF86XK_Book 0x1008ff52 /* Launch bookreader */ 0523 #define XF86XK_CD 0x1008ff53 /* Launch CD/DVD player */ 0524 #define XF86XK_Calculater 0x1008ff54 /* Launch Calculater */ 0525 #define XF86XK_Clear 0x1008ff55 /* Clear window, screen */ 0526 #define XF86XK_Close 0x1008ff56 /* Close window */ 0527 #define XF86XK_Copy 0x1008ff57 /* Copy selection */ 0528 #define XF86XK_Cut 0x1008ff58 /* Cut selection */ 0529 #define XF86XK_Display 0x1008ff59 /* Output switch key */ 0530 #define XF86XK_DOS 0x1008ff5a /* Launch DOS (emulation) */ 0531 #define XF86XK_Documents 0x1008ff5b /* Open documents window */ 0532 #define XF86XK_Excel 0x1008ff5c /* Launch spread sheet */ 0533 #define XF86XK_Explorer 0x1008ff5d /* Launch file explorer */ 0534 #define XF86XK_Game 0x1008ff5e /* Launch game */ 0535 #define XF86XK_Go 0x1008ff5f /* Go to URL */ 0536 #define XF86XK_iTouch 0x1008ff60 /* Logitech iTouch- don't use */ 0537 #define XF86XK_LogOff 0x1008ff61 /* Log off system */ 0538 #define XF86XK_Market 0x1008ff62 /* ?? */ 0539 #define XF86XK_Meeting 0x1008ff63 /* enter meeting in calendar */ 0540 #define XF86XK_MenuKB 0x1008ff65 /* distinguish keyboard from PB */ 0541 #define XF86XK_MenuPB 0x1008ff66 /* distinguish PB from keyboard */ 0542 #define XF86XK_MySites 0x1008ff67 /* Favourites */ 0543 #define XF86XK_New 0x1008ff68 /* New (folder, document... */ 0544 #define XF86XK_News 0x1008ff69 /* News */ 0545 #define XF86XK_OfficeHome 0x1008ff6a /* Office home (old Staroffice)*/ 0546 #define XF86XK_Open 0x1008ff6b /* Open */ 0547 #define XF86XK_Option 0x1008ff6c /* ?? */ 0548 #define XF86XK_Paste 0x1008ff6d /* Paste */ 0549 #define XF86XK_Phone 0x1008ff6e /* Launch phone; dial number */ 0550 #define XF86XK_Q 0x1008ff70 /* Compaq's Q - don't use */ 0551 #define XF86XK_Reply 0x1008ff72 /* Reply e.g., mail */ 0552 #define XF86XK_Reload 0x1008ff73 /* Reload web page, file, etc. */ 0553 #define XF86XK_RotateWindows 0x1008ff74 /* Rotate windows e.g. xrandr */ 0554 #define XF86XK_RotationPB 0x1008ff75 /* don't use */ 0555 #define XF86XK_RotationKB 0x1008ff76 /* don't use */ 0556 #define XF86XK_Save 0x1008ff77 /* Save (file, document, state */ 0557 #define XF86XK_ScrollUp 0x1008ff78 /* Scroll window/contents up */ 0558 #define XF86XK_ScrollDown 0x1008ff79 /* Scrool window/contentd down */ 0559 #define XF86XK_ScrollClick 0x1008ff7a /* Use XKB mousekeys instead */ 0560 #define XF86XK_Send 0x1008ff7b /* Send mail, file, object */ 0561 #define XF86XK_Spell 0x1008ff7c /* Spell checker */ 0562 #define XF86XK_SplitScreen 0x1008ff7d /* Split window or screen */ 0563 #define XF86XK_Support 0x1008ff7e /* Get support (??) */ 0564 #define XF86XK_TaskPane 0x1008ff7f /* Show tasks */ 0565 #define XF86XK_Terminal 0x1008ff80 /* Launch terminal emulator */ 0566 #define XF86XK_Tools 0x1008ff81 /* toolbox of desktop/app. */ 0567 #define XF86XK_Travel 0x1008ff82 /* ?? */ 0568 #define XF86XK_UserPB 0x1008ff84 /* ?? */ 0569 #define XF86XK_User1KB 0x1008ff85 /* ?? */ 0570 #define XF86XK_User2KB 0x1008ff86 /* ?? */ 0571 #define XF86XK_Video 0x1008ff87 /* Launch video player */ 0572 #define XF86XK_WheelButton 0x1008ff88 /* button from a mouse wheel */ 0573 #define XF86XK_Word 0x1008ff89 /* Launch word processor */ 0574 #define XF86XK_Xfer 0x1008ff8a 0575 #define XF86XK_ZoomIn 0x1008ff8b /* zoom in view, map, etc. */ 0576 #define XF86XK_ZoomOut 0x1008ff8c /* zoom out view, map, etc. */ 0577 0578 #define XF86XK_Away 0x1008ff8d /* mark yourself as away */ 0579 #define XF86XK_Messenger 0x1008ff8e /* as in instant messaging */ 0580 #define XF86XK_WebCam 0x1008ff8f /* Launch web camera app. */ 0581 #define XF86XK_MailForward 0x1008ff90 /* Forward in mail */ 0582 #define XF86XK_Pictures 0x1008ff91 /* Show pictures */ 0583 #define XF86XK_Music 0x1008ff92 /* Launch music application */ 0584 0585 #define XF86XK_Battery 0x1008ff93 /* Display battery information */ 0586 #define XF86XK_Bluetooth 0x1008ff94 /* Enable/disable Bluetooth */ 0587 #define XF86XK_WLAN 0x1008ff95 /* Enable/disable WLAN */ 0588 #define XF86XK_UWB 0x1008ff96 /* Enable/disable UWB */ 0589 0590 #define XF86XK_AudioForward 0x1008ff97 /* fast-forward audio track */ 0591 #define XF86XK_AudioRepeat 0x1008ff98 /* toggle repeat mode */ 0592 #define XF86XK_AudioRandomPlay 0x1008ff99 /* toggle shuffle mode */ 0593 #define XF86XK_Subtitle 0x1008ff9a /* cycle through subtitle */ 0594 #define XF86XK_AudioCycleTrack 0x1008ff9b /* cycle through audio tracks */ 0595 #define XF86XK_CycleAngle 0x1008ff9c /* cycle through angles */ 0596 #define XF86XK_FrameBack 0x1008ff9d /* video: go one frame back */ 0597 #define XF86XK_FrameForward 0x1008ff9e /* video: go one frame forward */ 0598 #define XF86XK_Time 0x1008ff9f /* display, or shows an entry for time seeking */ 0599 #define XF86XK_Select 0x1008ffa0 /* Select button on joypads and remotes */ 0600 #define XF86XK_View 0x1008ffa1 /* Show a view options/properties */ 0601 #define XF86XK_TopMenu 0x1008ffa2 /* Go to a top-level menu in a video */ 0602 0603 #define XF86XK_Red 0x1008ffa3 /* Red button */ 0604 #define XF86XK_Green 0x1008ffa4 /* Green button */ 0605 #define XF86XK_Yellow 0x1008ffa5 /* Yellow button */ 0606 #define XF86XK_Blue 0x1008ffa6 /* Blue button */ 0607 0608 #define XF86XK_Suspend 0x1008ffa7 /* Sleep to RAM */ 0609 #define XF86XK_Hibernate 0x1008ffa8 /* Sleep to disk */ 0610 #define XF86XK_TouchpadToggle 0x1008ffa9 /* Toggle between touchpad/trackstick */ 0611 #define XF86XK_TouchpadOn 0x1008ffb0 /* The touchpad got switched on */ 0612 #define XF86XK_TouchpadOff 0x1008ffb1 /* The touchpad got switched off */ 0613 0614 #define XF86XK_AudioMicMute 0x1008ffb2 /* Mute the Mic from the system */ 0615 0616 #define XF86XK_Keyboard 0x1008ffb3 /* User defined keyboard related action */ 0617 0618 #define XF86XK_WWAN 0x1008ffb4 /* Toggle WWAN (LTE, UMTS, etc.) radio */ 0619 #define XF86XK_RFKill 0x1008ffb5 /* Toggle radios on/off */ 0620 0621 #define XF86XK_AudioPreset 0x1008ffb6 /* Select equalizer preset, e.g. theatre-mode */ 0622 0623 #define XF86XK_RotationLockToggle 0x1008ffb7 /* Toggle screen rotation lock on/off */ 0624 0625 #define XF86XK_FullScreen 0x1008ffb8 /* Toggle fullscreen */ 0626 0627 /* Keys for special action keys (hot keys) */ 0628 /* Virtual terminals on some operating systems */ 0629 #define XF86XK_Switch_VT_1 0x1008fe01 0630 #define XF86XK_Switch_VT_2 0x1008fe02 0631 #define XF86XK_Switch_VT_3 0x1008fe03 0632 #define XF86XK_Switch_VT_4 0x1008fe04 0633 #define XF86XK_Switch_VT_5 0x1008fe05 0634 #define XF86XK_Switch_VT_6 0x1008fe06 0635 #define XF86XK_Switch_VT_7 0x1008fe07 0636 #define XF86XK_Switch_VT_8 0x1008fe08 0637 #define XF86XK_Switch_VT_9 0x1008fe09 0638 #define XF86XK_Switch_VT_10 0x1008fe0a 0639 #define XF86XK_Switch_VT_11 0x1008fe0b 0640 #define XF86XK_Switch_VT_12 0x1008fe0c 0641 0642 #define XF86XK_Ungrab 0x1008fe20 /* force ungrab */ 0643 #define XF86XK_ClearGrab 0x1008fe21 /* kill application with grab */ 0644 #define XF86XK_Next_VMode 0x1008fe22 /* next video mode available */ 0645 #define XF86XK_Prev_VMode 0x1008fe23 /* prev. video mode available */ 0646 #define XF86XK_LogWindowTree 0x1008fe24 /* print window tree to log */ 0647 #define XF86XK_LogGrabInfo 0x1008fe25 /* print all active grabs to log */ 0648 0649 0650 /* 0651 * Reserved range for evdev symbols: 0x10081000-0x10081FFF 0652 * 0653 * Key syms within this range must match the Linux kernel 0654 * input-event-codes.h file in the format: 0655 * XF86XK_CamelCaseKernelName _EVDEVK(kernel value) 0656 * For example, the kernel 0657 * #define KEY_MACRO_RECORD_START 0x2b0 0658 * effectively ends up as: 0659 * #define XF86XK_MacroRecordStart 0x100812b0 0660 * 0661 * For historical reasons, some keysyms within the reserved range will be 0662 * missing, most notably all "normal" keys that are mapped through default 0663 * XKB layouts (e.g. KEY_Q). 0664 * 0665 * CamelCasing is done with a human control as last authority, e.g. see VOD 0666 * instead of Vod for the Video on Demand key. 0667 * 0668 * The format for #defines is strict: 0669 * 0670 * #define XF86XK_FOO<tab...>_EVDEVK(0xABC)<tab><tab> |* kver KEY_FOO *| 0671 * 0672 * Where 0673 * - alignment by tabs 0674 * - the _EVDEVK macro must be used 0675 * - the hex code must be in uppercase hex 0676 * - the kernel version (kver) is in the form v5.10 0677 * - kver and key name are within a slash-star comment (a pipe is used in 0678 * this example for technical reasons) 0679 * These #defines are parsed by scripts. Do not stray from the given format. 0680 * 0681 * Where the evdev keycode is mapped to a different symbol, please add a 0682 * comment line starting with Use: but otherwise the same format, e.g. 0683 * Use: XF86XK_RotationLockToggle _EVDEVK(0x231) v4.16 KEY_ROTATE_LOCK_TOGGLE 0684 * 0685 */ 0686 #define _EVDEVK(_v) (0x10081000 + _v) 0687 /* Use: XF86XK_Eject _EVDEVK(0x0a2) KEY_EJECTCLOSECD */ 0688 /* Use: XF86XK_New _EVDEVK(0x0b5) v2.6.14 KEY_NEW */ 0689 /* Use: XK_Redo _EVDEVK(0x0b6) v2.6.14 KEY_REDO */ 0690 /* KEY_DASHBOARD has been mapped to LaunchB in xkeyboard-config since 2011 */ 0691 /* Use: XF86XK_LaunchB _EVDEVK(0x0cc) v2.6.28 KEY_DASHBOARD */ 0692 /* Use: XF86XK_Display _EVDEVK(0x0e3) v2.6.12 KEY_SWITCHVIDEOMODE */ 0693 /* Use: XF86XK_KbdLightOnOff _EVDEVK(0x0e4) v2.6.12 KEY_KBDILLUMTOGGLE */ 0694 /* Use: XF86XK_KbdBrightnessDown _EVDEVK(0x0e5) v2.6.12 KEY_KBDILLUMDOWN */ 0695 /* Use: XF86XK_KbdBrightnessUp _EVDEVK(0x0e6) v2.6.12 KEY_KBDILLUMUP */ 0696 /* Use: XF86XK_Send _EVDEVK(0x0e7) v2.6.14 KEY_SEND */ 0697 /* Use: XF86XK_Reply _EVDEVK(0x0e8) v2.6.14 KEY_REPLY */ 0698 /* Use: XF86XK_MailForward _EVDEVK(0x0e9) v2.6.14 KEY_FORWARDMAIL */ 0699 /* Use: XF86XK_Save _EVDEVK(0x0ea) v2.6.14 KEY_SAVE */ 0700 /* Use: XF86XK_Documents _EVDEVK(0x0eb) v2.6.14 KEY_DOCUMENTS */ 0701 /* Use: XF86XK_Battery _EVDEVK(0x0ec) v2.6.17 KEY_BATTERY */ 0702 /* Use: XF86XK_Bluetooth _EVDEVK(0x0ed) v2.6.19 KEY_BLUETOOTH */ 0703 /* Use: XF86XK_WLAN _EVDEVK(0x0ee) v2.6.19 KEY_WLAN */ 0704 /* Use: XF86XK_UWB _EVDEVK(0x0ef) v2.6.24 KEY_UWB */ 0705 /* Use: XF86XK_Next_VMode _EVDEVK(0x0f1) v2.6.23 KEY_VIDEO_NEXT */ 0706 /* Use: XF86XK_Prev_VMode _EVDEVK(0x0f2) v2.6.23 KEY_VIDEO_PREV */ 0707 /* Use: XF86XK_MonBrightnessCycle _EVDEVK(0x0f3) v2.6.23 KEY_BRIGHTNESS_CYCLE */ 0708 #define XF86XK_BrightnessAuto _EVDEVK(0x0f4) /* v3.16 KEY_BRIGHTNESS_AUTO */ 0709 #define XF86XK_DisplayOff _EVDEVK(0x0f5) /* v2.6.23 KEY_DISPLAY_OFF */ 0710 /* Use: XF86XK_WWAN _EVDEVK(0x0f6) v3.13 KEY_WWAN */ 0711 /* Use: XF86XK_RFKill _EVDEVK(0x0f7) v2.6.33 KEY_RFKILL */ 0712 /* Use: XF86XK_AudioMicMute _EVDEVK(0x0f8) v3.1 KEY_MICMUTE */ 0713 #define XF86XK_Info _EVDEVK(0x166) /* KEY_INFO */ 0714 /* Use: XF86XK_CycleAngle _EVDEVK(0x173) KEY_ANGLE */ 0715 /* Use: XF86XK_FullScreen _EVDEVK(0x174) v5.1 KEY_FULL_SCREEN */ 0716 #define XF86XK_AspectRatio _EVDEVK(0x177) /* v5.1 KEY_ASPECT_RATIO */ 0717 #define XF86XK_DVD _EVDEVK(0x185) /* KEY_DVD */ 0718 #define XF86XK_Audio _EVDEVK(0x188) /* KEY_AUDIO */ 0719 /* Use: XF86XK_Video _EVDEVK(0x189) KEY_VIDEO */ 0720 /* Use: XF86XK_Calendar _EVDEVK(0x18d) KEY_CALENDAR */ 0721 #define XF86XK_ChannelUp _EVDEVK(0x192) /* KEY_CHANNELUP */ 0722 #define XF86XK_ChannelDown _EVDEVK(0x193) /* KEY_CHANNELDOWN */ 0723 /* Use: XF86XK_AudioRandomPlay _EVDEVK(0x19a) KEY_SHUFFLE */ 0724 #define XF86XK_Break _EVDEVK(0x19b) /* KEY_BREAK */ 0725 #define XF86XK_VideoPhone _EVDEVK(0x1a0) /* v2.6.20 KEY_VIDEOPHONE */ 0726 /* Use: XF86XK_Game _EVDEVK(0x1a1) v2.6.20 KEY_GAMES */ 0727 /* Use: XF86XK_ZoomIn _EVDEVK(0x1a2) v2.6.20 KEY_ZOOMIN */ 0728 /* Use: XF86XK_ZoomOut _EVDEVK(0x1a3) v2.6.20 KEY_ZOOMOUT */ 0729 #define XF86XK_ZoomReset _EVDEVK(0x1a4) /* v2.6.20 KEY_ZOOMRESET */ 0730 /* Use: XF86XK_Word _EVDEVK(0x1a5) v2.6.20 KEY_WORDPROCESSOR */ 0731 #define XF86XK_Editor _EVDEVK(0x1a6) /* v2.6.20 KEY_EDITOR */ 0732 /* Use: XF86XK_Excel _EVDEVK(0x1a7) v2.6.20 KEY_SPREADSHEET */ 0733 #define XF86XK_GraphicsEditor _EVDEVK(0x1a8) /* v2.6.20 KEY_GRAPHICSEDITOR */ 0734 #define XF86XK_Presentation _EVDEVK(0x1a9) /* v2.6.20 KEY_PRESENTATION */ 0735 #define XF86XK_Database _EVDEVK(0x1aa) /* v2.6.20 KEY_DATABASE */ 0736 /* Use: XF86XK_News _EVDEVK(0x1ab) v2.6.20 KEY_NEWS */ 0737 #define XF86XK_Voicemail _EVDEVK(0x1ac) /* v2.6.20 KEY_VOICEMAIL */ 0738 #define XF86XK_Addressbook _EVDEVK(0x1ad) /* v2.6.20 KEY_ADDRESSBOOK */ 0739 /* Use: XF86XK_Messenger _EVDEVK(0x1ae) v2.6.20 KEY_MESSENGER */ 0740 #define XF86XK_DisplayToggle _EVDEVK(0x1af) /* v2.6.20 KEY_DISPLAYTOGGLE */ 0741 #define XF86XK_SpellCheck _EVDEVK(0x1b0) /* v2.6.24 KEY_SPELLCHECK */ 0742 /* Use: XF86XK_LogOff _EVDEVK(0x1b1) v2.6.24 KEY_LOGOFF */ 0743 /* Use: XK_dollar _EVDEVK(0x1b2) v2.6.24 KEY_DOLLAR */ 0744 /* Use: XK_EuroSign _EVDEVK(0x1b3) v2.6.24 KEY_EURO */ 0745 /* Use: XF86XK_FrameBack _EVDEVK(0x1b4) v2.6.24 KEY_FRAMEBACK */ 0746 /* Use: XF86XK_FrameForward _EVDEVK(0x1b5) v2.6.24 KEY_FRAMEFORWARD */ 0747 #define XF86XK_ContextMenu _EVDEVK(0x1b6) /* v2.6.24 KEY_CONTEXT_MENU */ 0748 #define XF86XK_MediaRepeat _EVDEVK(0x1b7) /* v2.6.26 KEY_MEDIA_REPEAT */ 0749 #define XF86XK_10ChannelsUp _EVDEVK(0x1b8) /* v2.6.38 KEY_10CHANNELSUP */ 0750 #define XF86XK_10ChannelsDown _EVDEVK(0x1b9) /* v2.6.38 KEY_10CHANNELSDOWN */ 0751 #define XF86XK_Images _EVDEVK(0x1ba) /* v2.6.39 KEY_IMAGES */ 0752 #define XF86XK_NotificationCenter _EVDEVK(0x1bc) /* v5.10 KEY_NOTIFICATION_CENTER */ 0753 #define XF86XK_PickupPhone _EVDEVK(0x1bd) /* v5.10 KEY_PICKUP_PHONE */ 0754 #define XF86XK_HangupPhone _EVDEVK(0x1be) /* v5.10 KEY_HANGUP_PHONE */ 0755 #define XF86XK_Fn _EVDEVK(0x1d0) /* KEY_FN */ 0756 #define XF86XK_Fn_Esc _EVDEVK(0x1d1) /* KEY_FN_ESC */ 0757 #define XF86XK_FnRightShift _EVDEVK(0x1e5) /* v5.10 KEY_FN_RIGHT_SHIFT */ 0758 /* Use: XK_braille_dot_1 _EVDEVK(0x1f1) v2.6.17 KEY_BRL_DOT1 */ 0759 /* Use: XK_braille_dot_2 _EVDEVK(0x1f2) v2.6.17 KEY_BRL_DOT2 */ 0760 /* Use: XK_braille_dot_3 _EVDEVK(0x1f3) v2.6.17 KEY_BRL_DOT3 */ 0761 /* Use: XK_braille_dot_4 _EVDEVK(0x1f4) v2.6.17 KEY_BRL_DOT4 */ 0762 /* Use: XK_braille_dot_5 _EVDEVK(0x1f5) v2.6.17 KEY_BRL_DOT5 */ 0763 /* Use: XK_braille_dot_6 _EVDEVK(0x1f6) v2.6.17 KEY_BRL_DOT6 */ 0764 /* Use: XK_braille_dot_7 _EVDEVK(0x1f7) v2.6.17 KEY_BRL_DOT7 */ 0765 /* Use: XK_braille_dot_8 _EVDEVK(0x1f8) v2.6.17 KEY_BRL_DOT8 */ 0766 /* Use: XK_braille_dot_9 _EVDEVK(0x1f9) v2.6.23 KEY_BRL_DOT9 */ 0767 /* Use: XK_braille_dot_1 _EVDEVK(0x1fa) v2.6.23 KEY_BRL_DOT10 */ 0768 #define XF86XK_Numeric0 _EVDEVK(0x200) /* v2.6.28 KEY_NUMERIC_0 */ 0769 #define XF86XK_Numeric1 _EVDEVK(0x201) /* v2.6.28 KEY_NUMERIC_1 */ 0770 #define XF86XK_Numeric2 _EVDEVK(0x202) /* v2.6.28 KEY_NUMERIC_2 */ 0771 #define XF86XK_Numeric3 _EVDEVK(0x203) /* v2.6.28 KEY_NUMERIC_3 */ 0772 #define XF86XK_Numeric4 _EVDEVK(0x204) /* v2.6.28 KEY_NUMERIC_4 */ 0773 #define XF86XK_Numeric5 _EVDEVK(0x205) /* v2.6.28 KEY_NUMERIC_5 */ 0774 #define XF86XK_Numeric6 _EVDEVK(0x206) /* v2.6.28 KEY_NUMERIC_6 */ 0775 #define XF86XK_Numeric7 _EVDEVK(0x207) /* v2.6.28 KEY_NUMERIC_7 */ 0776 #define XF86XK_Numeric8 _EVDEVK(0x208) /* v2.6.28 KEY_NUMERIC_8 */ 0777 #define XF86XK_Numeric9 _EVDEVK(0x209) /* v2.6.28 KEY_NUMERIC_9 */ 0778 #define XF86XK_NumericStar _EVDEVK(0x20a) /* v2.6.28 KEY_NUMERIC_STAR */ 0779 #define XF86XK_NumericPound _EVDEVK(0x20b) /* v2.6.28 KEY_NUMERIC_POUND */ 0780 #define XF86XK_NumericA _EVDEVK(0x20c) /* v4.1 KEY_NUMERIC_A */ 0781 #define XF86XK_NumericB _EVDEVK(0x20d) /* v4.1 KEY_NUMERIC_B */ 0782 #define XF86XK_NumericC _EVDEVK(0x20e) /* v4.1 KEY_NUMERIC_C */ 0783 #define XF86XK_NumericD _EVDEVK(0x20f) /* v4.1 KEY_NUMERIC_D */ 0784 #define XF86XK_CameraFocus _EVDEVK(0x210) /* v2.6.33 KEY_CAMERA_FOCUS */ 0785 #define XF86XK_WPSButton _EVDEVK(0x211) /* v2.6.34 KEY_WPS_BUTTON */ 0786 /* Use: XF86XK_TouchpadToggle _EVDEVK(0x212) v2.6.37 KEY_TOUCHPAD_TOGGLE */ 0787 /* Use: XF86XK_TouchpadOn _EVDEVK(0x213) v2.6.37 KEY_TOUCHPAD_ON */ 0788 /* Use: XF86XK_TouchpadOff _EVDEVK(0x214) v2.6.37 KEY_TOUCHPAD_OFF */ 0789 #define XF86XK_CameraZoomIn _EVDEVK(0x215) /* v2.6.39 KEY_CAMERA_ZOOMIN */ 0790 #define XF86XK_CameraZoomOut _EVDEVK(0x216) /* v2.6.39 KEY_CAMERA_ZOOMOUT */ 0791 #define XF86XK_CameraUp _EVDEVK(0x217) /* v2.6.39 KEY_CAMERA_UP */ 0792 #define XF86XK_CameraDown _EVDEVK(0x218) /* v2.6.39 KEY_CAMERA_DOWN */ 0793 #define XF86XK_CameraLeft _EVDEVK(0x219) /* v2.6.39 KEY_CAMERA_LEFT */ 0794 #define XF86XK_CameraRight _EVDEVK(0x21a) /* v2.6.39 KEY_CAMERA_RIGHT */ 0795 #define XF86XK_AttendantOn _EVDEVK(0x21b) /* v3.10 KEY_ATTENDANT_ON */ 0796 #define XF86XK_AttendantOff _EVDEVK(0x21c) /* v3.10 KEY_ATTENDANT_OFF */ 0797 #define XF86XK_AttendantToggle _EVDEVK(0x21d) /* v3.10 KEY_ATTENDANT_TOGGLE */ 0798 #define XF86XK_LightsToggle _EVDEVK(0x21e) /* v3.10 KEY_LIGHTS_TOGGLE */ 0799 #define XF86XK_ALSToggle _EVDEVK(0x230) /* v3.13 KEY_ALS_TOGGLE */ 0800 /* Use: XF86XK_RotationLockToggle _EVDEVK(0x231) v4.16 KEY_ROTATE_LOCK_TOGGLE */ 0801 #define XF86XK_Buttonconfig _EVDEVK(0x240) /* v3.16 KEY_BUTTONCONFIG */ 0802 #define XF86XK_Taskmanager _EVDEVK(0x241) /* v3.16 KEY_TASKMANAGER */ 0803 #define XF86XK_Journal _EVDEVK(0x242) /* v3.16 KEY_JOURNAL */ 0804 #define XF86XK_ControlPanel _EVDEVK(0x243) /* v3.16 KEY_CONTROLPANEL */ 0805 #define XF86XK_AppSelect _EVDEVK(0x244) /* v3.16 KEY_APPSELECT */ 0806 #define XF86XK_Screensaver _EVDEVK(0x245) /* v3.16 KEY_SCREENSAVER */ 0807 #define XF86XK_VoiceCommand _EVDEVK(0x246) /* v3.16 KEY_VOICECOMMAND */ 0808 #define XF86XK_Assistant _EVDEVK(0x247) /* v4.13 KEY_ASSISTANT */ 0809 /* Use: XK_ISO_Next_Group _EVDEVK(0x248) v5.2 KEY_KBD_LAYOUT_NEXT */ 0810 #define XF86XK_EmojiPicker _EVDEVK(0x249) /* v5.13 KEY_EMOJI_PICKER */ 0811 #define XF86XK_Dictate _EVDEVK(0x24a) /* v5.17 KEY_DICTATE */ 0812 #define XF86XK_CameraAccessEnable _EVDEVK(0x24b) /* v6.2 KEY_CAMERA_ACCESS_ENABLE */ 0813 #define XF86XK_CameraAccessDisable _EVDEVK(0x24c) /* v6.2 KEY_CAMERA_ACCESS_DISABLE */ 0814 #define XF86XK_CameraAccessToggle _EVDEVK(0x24d) /* v6.2 KEY_CAMERA_ACCESS_TOGGLE */ 0815 #define XF86XK_BrightnessMin _EVDEVK(0x250) /* v3.16 KEY_BRIGHTNESS_MIN */ 0816 #define XF86XK_BrightnessMax _EVDEVK(0x251) /* v3.16 KEY_BRIGHTNESS_MAX */ 0817 #define XF86XK_KbdInputAssistPrev _EVDEVK(0x260) /* v3.18 KEY_KBDINPUTASSIST_PREV */ 0818 #define XF86XK_KbdInputAssistNext _EVDEVK(0x261) /* v3.18 KEY_KBDINPUTASSIST_NEXT */ 0819 #define XF86XK_KbdInputAssistPrevgroup _EVDEVK(0x262) /* v3.18 KEY_KBDINPUTASSIST_PREVGROUP */ 0820 #define XF86XK_KbdInputAssistNextgroup _EVDEVK(0x263) /* v3.18 KEY_KBDINPUTASSIST_NEXTGROUP */ 0821 #define XF86XK_KbdInputAssistAccept _EVDEVK(0x264) /* v3.18 KEY_KBDINPUTASSIST_ACCEPT */ 0822 #define XF86XK_KbdInputAssistCancel _EVDEVK(0x265) /* v3.18 KEY_KBDINPUTASSIST_CANCEL */ 0823 #define XF86XK_RightUp _EVDEVK(0x266) /* v4.7 KEY_RIGHT_UP */ 0824 #define XF86XK_RightDown _EVDEVK(0x267) /* v4.7 KEY_RIGHT_DOWN */ 0825 #define XF86XK_LeftUp _EVDEVK(0x268) /* v4.7 KEY_LEFT_UP */ 0826 #define XF86XK_LeftDown _EVDEVK(0x269) /* v4.7 KEY_LEFT_DOWN */ 0827 #define XF86XK_RootMenu _EVDEVK(0x26a) /* v4.7 KEY_ROOT_MENU */ 0828 #define XF86XK_MediaTopMenu _EVDEVK(0x26b) /* v4.7 KEY_MEDIA_TOP_MENU */ 0829 #define XF86XK_Numeric11 _EVDEVK(0x26c) /* v4.7 KEY_NUMERIC_11 */ 0830 #define XF86XK_Numeric12 _EVDEVK(0x26d) /* v4.7 KEY_NUMERIC_12 */ 0831 #define XF86XK_AudioDesc _EVDEVK(0x26e) /* v4.7 KEY_AUDIO_DESC */ 0832 #define XF86XK_3DMode _EVDEVK(0x26f) /* v4.7 KEY_3D_MODE */ 0833 #define XF86XK_NextFavorite _EVDEVK(0x270) /* v4.7 KEY_NEXT_FAVORITE */ 0834 #define XF86XK_StopRecord _EVDEVK(0x271) /* v4.7 KEY_STOP_RECORD */ 0835 #define XF86XK_PauseRecord _EVDEVK(0x272) /* v4.7 KEY_PAUSE_RECORD */ 0836 #define XF86XK_VOD _EVDEVK(0x273) /* v4.7 KEY_VOD */ 0837 #define XF86XK_Unmute _EVDEVK(0x274) /* v4.7 KEY_UNMUTE */ 0838 #define XF86XK_FastReverse _EVDEVK(0x275) /* v4.7 KEY_FASTREVERSE */ 0839 #define XF86XK_SlowReverse _EVDEVK(0x276) /* v4.7 KEY_SLOWREVERSE */ 0840 #define XF86XK_Data _EVDEVK(0x277) /* v4.7 KEY_DATA */ 0841 #define XF86XK_OnScreenKeyboard _EVDEVK(0x278) /* v4.12 KEY_ONSCREEN_KEYBOARD */ 0842 #define XF86XK_PrivacyScreenToggle _EVDEVK(0x279) /* v5.5 KEY_PRIVACY_SCREEN_TOGGLE */ 0843 #define XF86XK_SelectiveScreenshot _EVDEVK(0x27a) /* v5.6 KEY_SELECTIVE_SCREENSHOT */ 0844 #define XF86XK_NextElement _EVDEVK(0x27b) /* v5.18 KEY_NEXT_ELEMENT */ 0845 #define XF86XK_PreviousElement _EVDEVK(0x27c) /* v5.18 KEY_PREVIOUS_ELEMENT */ 0846 #define XF86XK_AutopilotEngageToggle _EVDEVK(0x27d) /* v5.18 KEY_AUTOPILOT_ENGAGE_TOGGLE */ 0847 #define XF86XK_MarkWaypoint _EVDEVK(0x27e) /* v5.18 KEY_MARK_WAYPOINT */ 0848 #define XF86XK_Sos _EVDEVK(0x27f) /* v5.18 KEY_SOS */ 0849 #define XF86XK_NavChart _EVDEVK(0x280) /* v5.18 KEY_NAV_CHART */ 0850 #define XF86XK_FishingChart _EVDEVK(0x281) /* v5.18 KEY_FISHING_CHART */ 0851 #define XF86XK_SingleRangeRadar _EVDEVK(0x282) /* v5.18 KEY_SINGLE_RANGE_RADAR */ 0852 #define XF86XK_DualRangeRadar _EVDEVK(0x283) /* v5.18 KEY_DUAL_RANGE_RADAR */ 0853 #define XF86XK_RadarOverlay _EVDEVK(0x284) /* v5.18 KEY_RADAR_OVERLAY */ 0854 #define XF86XK_TraditionalSonar _EVDEVK(0x285) /* v5.18 KEY_TRADITIONAL_SONAR */ 0855 #define XF86XK_ClearvuSonar _EVDEVK(0x286) /* v5.18 KEY_CLEARVU_SONAR */ 0856 #define XF86XK_SidevuSonar _EVDEVK(0x287) /* v5.18 KEY_SIDEVU_SONAR */ 0857 #define XF86XK_NavInfo _EVDEVK(0x288) /* v5.18 KEY_NAV_INFO */ 0858 /* Use: XF86XK_BrightnessAdjust _EVDEVK(0x289) v5.18 KEY_BRIGHTNESS_MENU */ 0859 #define XF86XK_Macro1 _EVDEVK(0x290) /* v5.5 KEY_MACRO1 */ 0860 #define XF86XK_Macro2 _EVDEVK(0x291) /* v5.5 KEY_MACRO2 */ 0861 #define XF86XK_Macro3 _EVDEVK(0x292) /* v5.5 KEY_MACRO3 */ 0862 #define XF86XK_Macro4 _EVDEVK(0x293) /* v5.5 KEY_MACRO4 */ 0863 #define XF86XK_Macro5 _EVDEVK(0x294) /* v5.5 KEY_MACRO5 */ 0864 #define XF86XK_Macro6 _EVDEVK(0x295) /* v5.5 KEY_MACRO6 */ 0865 #define XF86XK_Macro7 _EVDEVK(0x296) /* v5.5 KEY_MACRO7 */ 0866 #define XF86XK_Macro8 _EVDEVK(0x297) /* v5.5 KEY_MACRO8 */ 0867 #define XF86XK_Macro9 _EVDEVK(0x298) /* v5.5 KEY_MACRO9 */ 0868 #define XF86XK_Macro10 _EVDEVK(0x299) /* v5.5 KEY_MACRO10 */ 0869 #define XF86XK_Macro11 _EVDEVK(0x29a) /* v5.5 KEY_MACRO11 */ 0870 #define XF86XK_Macro12 _EVDEVK(0x29b) /* v5.5 KEY_MACRO12 */ 0871 #define XF86XK_Macro13 _EVDEVK(0x29c) /* v5.5 KEY_MACRO13 */ 0872 #define XF86XK_Macro14 _EVDEVK(0x29d) /* v5.5 KEY_MACRO14 */ 0873 #define XF86XK_Macro15 _EVDEVK(0x29e) /* v5.5 KEY_MACRO15 */ 0874 #define XF86XK_Macro16 _EVDEVK(0x29f) /* v5.5 KEY_MACRO16 */ 0875 #define XF86XK_Macro17 _EVDEVK(0x2a0) /* v5.5 KEY_MACRO17 */ 0876 #define XF86XK_Macro18 _EVDEVK(0x2a1) /* v5.5 KEY_MACRO18 */ 0877 #define XF86XK_Macro19 _EVDEVK(0x2a2) /* v5.5 KEY_MACRO19 */ 0878 #define XF86XK_Macro20 _EVDEVK(0x2a3) /* v5.5 KEY_MACRO20 */ 0879 #define XF86XK_Macro21 _EVDEVK(0x2a4) /* v5.5 KEY_MACRO21 */ 0880 #define XF86XK_Macro22 _EVDEVK(0x2a5) /* v5.5 KEY_MACRO22 */ 0881 #define XF86XK_Macro23 _EVDEVK(0x2a6) /* v5.5 KEY_MACRO23 */ 0882 #define XF86XK_Macro24 _EVDEVK(0x2a7) /* v5.5 KEY_MACRO24 */ 0883 #define XF86XK_Macro25 _EVDEVK(0x2a8) /* v5.5 KEY_MACRO25 */ 0884 #define XF86XK_Macro26 _EVDEVK(0x2a9) /* v5.5 KEY_MACRO26 */ 0885 #define XF86XK_Macro27 _EVDEVK(0x2aa) /* v5.5 KEY_MACRO27 */ 0886 #define XF86XK_Macro28 _EVDEVK(0x2ab) /* v5.5 KEY_MACRO28 */ 0887 #define XF86XK_Macro29 _EVDEVK(0x2ac) /* v5.5 KEY_MACRO29 */ 0888 #define XF86XK_Macro30 _EVDEVK(0x2ad) /* v5.5 KEY_MACRO30 */ 0889 #define XF86XK_MacroRecordStart _EVDEVK(0x2b0) /* v5.5 KEY_MACRO_RECORD_START */ 0890 #define XF86XK_MacroRecordStop _EVDEVK(0x2b1) /* v5.5 KEY_MACRO_RECORD_STOP */ 0891 #define XF86XK_MacroPresetCycle _EVDEVK(0x2b2) /* v5.5 KEY_MACRO_PRESET_CYCLE */ 0892 #define XF86XK_MacroPreset1 _EVDEVK(0x2b3) /* v5.5 KEY_MACRO_PRESET1 */ 0893 #define XF86XK_MacroPreset2 _EVDEVK(0x2b4) /* v5.5 KEY_MACRO_PRESET2 */ 0894 #define XF86XK_MacroPreset3 _EVDEVK(0x2b5) /* v5.5 KEY_MACRO_PRESET3 */ 0895 #define XF86XK_KbdLcdMenu1 _EVDEVK(0x2b8) /* v5.5 KEY_KBD_LCD_MENU1 */ 0896 #define XF86XK_KbdLcdMenu2 _EVDEVK(0x2b9) /* v5.5 KEY_KBD_LCD_MENU2 */ 0897 #define XF86XK_KbdLcdMenu3 _EVDEVK(0x2ba) /* v5.5 KEY_KBD_LCD_MENU3 */ 0898 #define XF86XK_KbdLcdMenu4 _EVDEVK(0x2bb) /* v5.5 KEY_KBD_LCD_MENU4 */ 0899 #define XF86XK_KbdLcdMenu5 _EVDEVK(0x2bc) /* v5.5 KEY_KBD_LCD_MENU5 */ 0900 #undef _EVDEVK 0901 // end of XF86keysyms.h 0902 0903 // All of the stuff below really has to match qxcbcommon.cpp in Qt! 0904 { Qt::Key_Back, XF86XK_Back }, 0905 { Qt::Key_Forward, XF86XK_Forward }, 0906 { Qt::Key_Stop, XF86XK_Stop }, 0907 { Qt::Key_Refresh, XF86XK_Refresh }, 0908 { Qt::Key_Favorites, XF86XK_Favorites }, 0909 { Qt::Key_LaunchMedia, XF86XK_AudioMedia }, 0910 { Qt::Key_OpenUrl, XF86XK_OpenURL }, 0911 { Qt::Key_HomePage, XF86XK_HomePage }, 0912 { Qt::Key_Search, XF86XK_Search }, 0913 { Qt::Key_VolumeDown, XF86XK_AudioLowerVolume }, 0914 { Qt::Key_VolumeMute, XF86XK_AudioMute }, 0915 { Qt::Key_VolumeUp, XF86XK_AudioRaiseVolume }, 0916 { Qt::Key_MediaPlay, XF86XK_AudioPlay }, 0917 { Qt::Key_MediaStop, XF86XK_AudioStop }, 0918 { Qt::Key_MediaPrevious, XF86XK_AudioPrev }, 0919 { Qt::Key_MediaNext, XF86XK_AudioNext }, 0920 { Qt::Key_MediaRecord, XF86XK_AudioRecord }, 0921 { Qt::Key_MediaPause, XF86XK_AudioPause }, 0922 { Qt::Key_LaunchMail, XF86XK_Mail }, 0923 { Qt::Key_LaunchMedia, XF86XK_MyComputer }, 0924 { Qt::Key_Memo, XF86XK_Memo }, 0925 { Qt::Key_ToDoList, XF86XK_ToDoList }, 0926 { Qt::Key_Calendar, XF86XK_Calendar }, 0927 { Qt::Key_PowerDown, XF86XK_PowerDown }, 0928 { Qt::Key_ContrastAdjust, XF86XK_ContrastAdjust }, 0929 { Qt::Key_Standby, XF86XK_Standby }, 0930 { Qt::Key_MonBrightnessUp, XF86XK_MonBrightnessUp }, 0931 { Qt::Key_MonBrightnessDown, XF86XK_MonBrightnessDown }, 0932 { Qt::Key_KeyboardLightOnOff, XF86XK_KbdLightOnOff }, 0933 { Qt::Key_KeyboardBrightnessUp, XF86XK_KbdBrightnessUp }, 0934 { Qt::Key_KeyboardBrightnessDown,XF86XK_KbdBrightnessDown }, 0935 { Qt::Key_PowerOff, XF86XK_PowerOff }, 0936 { Qt::Key_WakeUp, XF86XK_WakeUp }, 0937 { Qt::Key_Eject, XF86XK_Eject }, 0938 { Qt::Key_ScreenSaver, XF86XK_ScreenSaver }, 0939 { Qt::Key_WWW, XF86XK_WWW }, 0940 { Qt::Key_Sleep, XF86XK_Sleep }, 0941 { Qt::Key_LightBulb, XF86XK_LightBulb }, 0942 { Qt::Key_Shop, XF86XK_Shop }, 0943 { Qt::Key_History, XF86XK_History }, 0944 { Qt::Key_AddFavorite, XF86XK_AddFavorite }, 0945 { Qt::Key_HotLinks, XF86XK_HotLinks }, 0946 { Qt::Key_BrightnessAdjust, XF86XK_BrightnessAdjust }, 0947 { Qt::Key_Finance, XF86XK_Finance }, 0948 { Qt::Key_Community, XF86XK_Community }, 0949 { Qt::Key_AudioRewind, XF86XK_AudioRewind }, 0950 { Qt::Key_BackForward, XF86XK_BackForward }, 0951 { Qt::Key_ApplicationLeft, XF86XK_ApplicationLeft }, 0952 { Qt::Key_ApplicationRight, XF86XK_ApplicationRight }, 0953 { Qt::Key_Book, XF86XK_Book }, 0954 { Qt::Key_CD, XF86XK_CD }, 0955 { Qt::Key_Calculator, XF86XK_Calculater }, 0956 { Qt::Key_Calculator, XF86XK_Calculator }, 0957 { Qt::Key_Clear, XF86XK_Clear }, 0958 { Qt::Key_ClearGrab, XF86XK_ClearGrab }, 0959 { Qt::Key_Close, XF86XK_Close }, 0960 { Qt::Key_Copy, XF86XK_Copy }, 0961 { Qt::Key_Cut, XF86XK_Cut }, 0962 { Qt::Key_Display, XF86XK_Display }, 0963 { Qt::Key_DOS, XF86XK_DOS }, 0964 { Qt::Key_Documents, XF86XK_Documents }, 0965 { Qt::Key_Excel, XF86XK_Excel }, 0966 { Qt::Key_Explorer, XF86XK_Explorer }, 0967 { Qt::Key_Game, XF86XK_Game }, 0968 { Qt::Key_Go, XF86XK_Go }, 0969 { Qt::Key_iTouch, XF86XK_iTouch }, 0970 { Qt::Key_LogOff, XF86XK_LogOff }, 0971 { Qt::Key_Market, XF86XK_Market }, 0972 { Qt::Key_Meeting, XF86XK_Meeting }, 0973 { Qt::Key_MenuKB, XF86XK_MenuKB }, 0974 { Qt::Key_MenuPB, XF86XK_MenuPB }, 0975 { Qt::Key_MySites, XF86XK_MySites }, 0976 { Qt::Key_New, XF86XK_New }, 0977 { Qt::Key_News, XF86XK_News }, 0978 { Qt::Key_OfficeHome, XF86XK_OfficeHome }, 0979 { Qt::Key_Open, XF86XK_Open }, 0980 { Qt::Key_Option, XF86XK_Option }, 0981 { Qt::Key_Paste, XF86XK_Paste }, 0982 { Qt::Key_Phone, XF86XK_Phone }, 0983 { Qt::Key_Reply, XF86XK_Reply }, 0984 { Qt::Key_Reload, XF86XK_Reload }, 0985 { Qt::Key_RotateWindows, XF86XK_RotateWindows }, 0986 { Qt::Key_RotationPB, XF86XK_RotationPB }, 0987 { Qt::Key_RotationKB, XF86XK_RotationKB }, 0988 { Qt::Key_Save, XF86XK_Save }, 0989 { Qt::Key_Send, XF86XK_Send }, 0990 { Qt::Key_Spell, XF86XK_Spell }, 0991 { Qt::Key_SplitScreen, XF86XK_SplitScreen }, 0992 { Qt::Key_Support, XF86XK_Support }, 0993 { Qt::Key_TaskPane, XF86XK_TaskPane }, 0994 { Qt::Key_Terminal, XF86XK_Terminal }, 0995 { Qt::Key_Tools, XF86XK_Tools }, 0996 { Qt::Key_Travel, XF86XK_Travel }, 0997 { Qt::Key_Video, XF86XK_Video }, 0998 { Qt::Key_Word, XF86XK_Word }, 0999 { Qt::Key_Xfer, XF86XK_Xfer }, 1000 { Qt::Key_ZoomIn, XF86XK_ZoomIn }, 1001 { Qt::Key_ZoomOut, XF86XK_ZoomOut }, 1002 { Qt::Key_Away, XF86XK_Away }, 1003 { Qt::Key_Messenger, XF86XK_Messenger }, 1004 { Qt::Key_WebCam, XF86XK_WebCam }, 1005 { Qt::Key_MailForward, XF86XK_MailForward }, 1006 { Qt::Key_Pictures, XF86XK_Pictures }, 1007 { Qt::Key_Music, XF86XK_Music }, 1008 { Qt::Key_Battery, XF86XK_Battery }, 1009 { Qt::Key_Bluetooth, XF86XK_Bluetooth }, 1010 { Qt::Key_WLAN, XF86XK_WLAN }, 1011 { Qt::Key_UWB, XF86XK_UWB }, 1012 { Qt::Key_AudioForward, XF86XK_AudioForward }, 1013 { Qt::Key_AudioRepeat, XF86XK_AudioRepeat }, 1014 { Qt::Key_AudioRandomPlay, XF86XK_AudioRandomPlay }, 1015 { Qt::Key_Subtitle, XF86XK_Subtitle }, 1016 { Qt::Key_AudioCycleTrack, XF86XK_AudioCycleTrack }, 1017 { Qt::Key_Time, XF86XK_Time }, 1018 { Qt::Key_Select, XF86XK_Select }, 1019 { Qt::Key_View, XF86XK_View }, 1020 { Qt::Key_TopMenu, XF86XK_TopMenu }, 1021 { Qt::Key_Red, XF86XK_Red }, 1022 { Qt::Key_Green, XF86XK_Green }, 1023 { Qt::Key_Yellow, XF86XK_Yellow }, 1024 { Qt::Key_Blue, XF86XK_Blue }, 1025 { Qt::Key_Bluetooth, XF86XK_Bluetooth }, 1026 { Qt::Key_Suspend, XF86XK_Suspend }, 1027 { Qt::Key_Hibernate, XF86XK_Hibernate }, 1028 { Qt::Key_TouchpadToggle, XF86XK_TouchpadToggle }, 1029 { Qt::Key_TouchpadOn, XF86XK_TouchpadOn }, 1030 { Qt::Key_TouchpadOff, XF86XK_TouchpadOff }, 1031 { Qt::Key_MicMute, XF86XK_AudioMicMute }, 1032 { Qt::Key_Launch0, XF86XK_Launch0 }, 1033 { Qt::Key_Launch1, XF86XK_Launch1 }, 1034 { Qt::Key_Launch2, XF86XK_Launch2 }, 1035 { Qt::Key_Launch3, XF86XK_Launch3 }, 1036 { Qt::Key_Launch4, XF86XK_Launch4 }, 1037 { Qt::Key_Launch5, XF86XK_Launch5 }, 1038 { Qt::Key_Launch6, XF86XK_Launch6 }, 1039 { Qt::Key_Launch7, XF86XK_Launch7 }, 1040 { Qt::Key_Launch8, XF86XK_Launch8 }, 1041 { Qt::Key_Launch9, XF86XK_Launch9 }, 1042 { Qt::Key_LaunchA, XF86XK_LaunchA }, 1043 { Qt::Key_LaunchB, XF86XK_LaunchB }, 1044 { Qt::Key_LaunchC, XF86XK_LaunchC }, 1045 { Qt::Key_LaunchD, XF86XK_LaunchD }, 1046 { Qt::Key_LaunchE, XF86XK_LaunchE }, 1047 { Qt::Key_LaunchF, XF86XK_LaunchF }, 1048 }; 1049 // clang-format on 1050 1051 //--------------------------------------------------------------------- 1052 // Debugging 1053 //--------------------------------------------------------------------- 1054 #ifndef NDEBUG 1055 inline void checkDisplay() 1056 { 1057 // Some non-GUI apps might try to use us. 1058 if (!QX11Info::display()) { 1059 qCCritical(LOG_KKEYSERVER_X11) << "QX11Info::display() returns 0. I'm probably going to crash now."; 1060 qCCritical(LOG_KKEYSERVER_X11) << "If this is a KApplication initialized without GUI stuff, change it to be " 1061 "initialized with GUI stuff."; 1062 } 1063 } 1064 #else // NDEBUG 1065 #define checkDisplay() 1066 #endif 1067 1068 //--------------------------------------------------------------------- 1069 // Initialization 1070 //--------------------------------------------------------------------- 1071 1072 static bool g_bInitializedMods; 1073 static uint g_modXNumLock, g_modXScrollLock, g_modXModeSwitch, g_alt_mask, g_meta_mask, g_super_mask, g_hyper_mask; 1074 1075 bool initializeMods() 1076 { 1077 // Reinitialize the masks 1078 g_modXNumLock = 0; 1079 g_modXScrollLock = 0; 1080 g_modXModeSwitch = 0; 1081 g_alt_mask = 0; 1082 g_meta_mask = 0; 1083 g_super_mask = 0; 1084 g_hyper_mask = 0; 1085 1086 if (!QX11Info::isPlatformX11()) { 1087 qCWarning(LOG_KKEYSERVER_X11) << "X11 implementation of KKeyServer accessed from non-X11 platform! This is an application bug."; 1088 g_bInitializedMods = true; 1089 return false; 1090 } 1091 1092 checkDisplay(); 1093 xcb_key_symbols_t *symbols = xcb_key_symbols_alloc(QX11Info::connection()); 1094 XModifierKeymap *xmk = XGetModifierMapping(QX11Info::display()); 1095 1096 int min_keycode; 1097 int max_keycode; 1098 int keysyms_per_keycode = 0; 1099 1100 XDisplayKeycodes(QX11Info::display(), &min_keycode, &max_keycode); 1101 XFree(XGetKeyboardMapping(QX11Info::display(), min_keycode, 1, &keysyms_per_keycode)); 1102 1103 for (int i = Mod1MapIndex; i < 8; i++) { 1104 uint mask = (1 << i); 1105 uint keySymX = NoSymbol; 1106 1107 // This used to be only XKeycodeToKeysym( ... , 0 ), but that fails with XFree4.3.99 1108 // and X.org R6.7 , where for some reason only ( ... , 1 ) works. I have absolutely no 1109 // idea what the problem is, but searching all possibilities until something valid is 1110 // found fixes the problem. 1111 for (int j = 0; j < xmk->max_keypermod; ++j) { 1112 for (int k = 0; k < keysyms_per_keycode; ++k) { 1113 keySymX = xcb_key_symbols_get_keysym(symbols, xmk->modifiermap[xmk->max_keypermod * i + j], k); 1114 1115 switch (keySymX) { 1116 case XK_Alt_L: 1117 case XK_Alt_R: 1118 g_alt_mask |= mask; 1119 break; 1120 1121 case XK_Super_L: 1122 case XK_Super_R: 1123 g_super_mask |= mask; 1124 break; 1125 1126 case XK_Hyper_L: 1127 case XK_Hyper_R: 1128 g_hyper_mask |= mask; 1129 break; 1130 1131 case XK_Meta_L: 1132 case XK_Meta_R: 1133 g_meta_mask |= mask; 1134 break; 1135 1136 case XK_Num_Lock: 1137 g_modXNumLock |= mask; 1138 break; 1139 case XK_Scroll_Lock: 1140 g_modXScrollLock |= mask; 1141 break; 1142 case XK_Mode_switch: 1143 g_modXModeSwitch |= mask; 1144 break; 1145 } 1146 } 1147 } 1148 } 1149 1150 #ifdef KKEYSERVER_DEBUG 1151 qCDebug(LOG_KKEYSERVER_X11) << "Alt:" << g_alt_mask; 1152 qCDebug(LOG_KKEYSERVER_X11) << "Meta:" << g_meta_mask; 1153 qCDebug(LOG_KKEYSERVER_X11) << "Super:" << g_super_mask; 1154 qCDebug(LOG_KKEYSERVER_X11) << "Hyper:" << g_hyper_mask; 1155 qCDebug(LOG_KKEYSERVER_X11) << "NumLock:" << g_modXNumLock; 1156 qCDebug(LOG_KKEYSERVER_X11) << "ScrollLock:" << g_modXScrollLock; 1157 qCDebug(LOG_KKEYSERVER_X11) << "ModeSwitch:" << g_modXModeSwitch; 1158 #endif 1159 1160 // Check if hyper overlaps with super or meta or alt 1161 if (g_hyper_mask & (g_super_mask | g_meta_mask | g_alt_mask)) { 1162 #ifdef KKEYSERVER_DEBUG 1163 qCDebug(LOG_KKEYSERVER_X11) << "Hyper conflicts with super, meta or alt."; 1164 #endif 1165 // Remove the conflicting masks 1166 g_hyper_mask &= ~(g_super_mask | g_meta_mask | g_alt_mask); 1167 } 1168 1169 // Check if super overlaps with meta or alt 1170 if (g_super_mask & (g_meta_mask | g_alt_mask)) { 1171 #ifdef KKEYSERVER_DEBUG 1172 qCDebug(LOG_KKEYSERVER_X11) << "Super conflicts with meta or alt."; 1173 #endif 1174 // Remove the conflicting masks 1175 g_super_mask &= ~(g_meta_mask | g_alt_mask); 1176 } 1177 1178 // Check if meta overlaps with alt 1179 if (g_meta_mask | g_alt_mask) { 1180 #ifdef KKEYSERVER_DEBUG 1181 qCDebug(LOG_KKEYSERVER_X11) << "Meta conflicts with alt."; 1182 #endif 1183 // Remove the conflicting masks 1184 g_meta_mask &= ~(g_alt_mask); 1185 } 1186 1187 if (!g_meta_mask) { 1188 #ifdef KKEYSERVER_DEBUG 1189 qCDebug(LOG_KKEYSERVER_X11) << "Meta is not set or conflicted with alt."; 1190 #endif 1191 if (g_super_mask) { 1192 #ifdef KKEYSERVER_DEBUG 1193 qCDebug(LOG_KKEYSERVER_X11) << "Using super for meta"; 1194 #endif 1195 // Use Super 1196 g_meta_mask = g_super_mask; 1197 } else if (g_hyper_mask) { 1198 #ifdef KKEYSERVER_DEBUG 1199 qCDebug(LOG_KKEYSERVER_X11) << "Using hyper for meta"; 1200 #endif 1201 // User Hyper 1202 g_meta_mask = g_hyper_mask; 1203 } else { 1204 // ???? Nothing left 1205 g_meta_mask = 0; 1206 } 1207 } 1208 1209 #ifdef KKEYSERVER_DEBUG 1210 qCDebug(LOG_KKEYSERVER_X11) << "Alt:" << g_alt_mask; 1211 qCDebug(LOG_KKEYSERVER_X11) << "Meta:" << g_meta_mask; 1212 qCDebug(LOG_KKEYSERVER_X11) << "Super:" << g_super_mask; 1213 qCDebug(LOG_KKEYSERVER_X11) << "Hyper:" << g_hyper_mask; 1214 qCDebug(LOG_KKEYSERVER_X11) << "NumLock:" << g_modXNumLock; 1215 qCDebug(LOG_KKEYSERVER_X11) << "ScrollLock:" << g_modXScrollLock; 1216 qCDebug(LOG_KKEYSERVER_X11) << "ModeSwitch:" << g_modXModeSwitch; 1217 #endif 1218 1219 if (!g_meta_mask) { 1220 qCWarning(LOG_KKEYSERVER_X11) << "Your keyboard setup doesn't provide a key to use for meta. See 'xmodmap -pm' or 'xkbcomp $DISPLAY'"; 1221 } 1222 1223 g_rgX11ModInfo[2].modX = g_alt_mask; 1224 g_rgX11ModInfo[3].modX = g_meta_mask; 1225 1226 xcb_key_symbols_free(symbols); 1227 XFreeModifiermap(xmk); 1228 g_bInitializedMods = true; 1229 1230 return true; 1231 } 1232 1233 //--------------------------------------------------------------------- 1234 // Helper functions 1235 //--------------------------------------------------------------------- 1236 1237 static bool is_keypad_key(xcb_keysym_t keysym) 1238 { 1239 return keysym >= XK_KP_Space && keysym <= XK_KP_9; 1240 } 1241 1242 //--------------------------------------------------------------------- 1243 // Public functions 1244 //--------------------------------------------------------------------- 1245 1246 uint modXShift() 1247 { 1248 return ShiftMask; 1249 } 1250 uint modXCtrl() 1251 { 1252 return ControlMask; 1253 } 1254 uint modXAlt() 1255 { 1256 if (!g_bInitializedMods) { 1257 initializeMods(); 1258 } 1259 return g_alt_mask; 1260 } 1261 uint modXMeta() 1262 { 1263 if (!g_bInitializedMods) { 1264 initializeMods(); 1265 } 1266 return g_meta_mask; 1267 } 1268 1269 uint modXNumLock() 1270 { 1271 if (!g_bInitializedMods) { 1272 initializeMods(); 1273 } 1274 return g_modXNumLock; 1275 } 1276 uint modXLock() 1277 { 1278 return LockMask; 1279 } 1280 uint modXScrollLock() 1281 { 1282 if (!g_bInitializedMods) { 1283 initializeMods(); 1284 } 1285 return g_modXScrollLock; 1286 } 1287 uint modXModeSwitch() 1288 { 1289 if (!g_bInitializedMods) { 1290 initializeMods(); 1291 } 1292 return g_modXModeSwitch; 1293 } 1294 1295 bool keyboardHasMetaKey() 1296 { 1297 return modXMeta() != 0; 1298 } 1299 1300 uint getModsRequired(uint sym) 1301 { 1302 if (!QX11Info::isPlatformX11()) { 1303 qCWarning(LOG_KKEYSERVER_X11) << "X11 implementation of KKeyServer accessed from non-X11 platform! This is an application bug."; 1304 return 0; 1305 } 1306 uint mod = 0; 1307 1308 // FIXME: This might not be true on all keyboard layouts! 1309 if (sym == XK_Sys_Req) { 1310 return Qt::ALT; 1311 } 1312 if (sym == XK_Break) { 1313 return Qt::CTRL; 1314 } 1315 1316 if (sym < 0x3000) { 1317 QChar c(sym); 1318 if (c.isLetter() && c.toLower() != c.toUpper() && sym == c.toUpper().unicode()) { 1319 return Qt::SHIFT; 1320 } 1321 } 1322 1323 uchar code = XKeysymToKeycode(QX11Info::display(), sym); 1324 if (code) { 1325 // need to check index 0 before the others, so that a null-mod 1326 // can take precedence over the others, in case the modified 1327 // key produces the same symbol. 1328 if (sym == XKeycodeToKeysym(QX11Info::display(), code, 0)) { 1329 ; 1330 } else if (sym == XKeycodeToKeysym(QX11Info::display(), code, 1)) { 1331 mod = Qt::SHIFT; 1332 } else if (sym == XKeycodeToKeysym(QX11Info::display(), code, 2)) { 1333 mod = MODE_SWITCH; 1334 } else if (sym == XKeycodeToKeysym(QX11Info::display(), code, 3)) { 1335 mod = Qt::SHIFT | MODE_SWITCH; 1336 } 1337 } 1338 return mod; 1339 } 1340 1341 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(6, 0) 1342 bool keyQtToCodeX(int keyQt, int *keyCode) 1343 { 1344 if (!QX11Info::isPlatformX11()) { 1345 qCWarning(LOG_KKEYSERVER_X11) << "X11 implementation of KKeyServer accessed from non-X11 platform! This is an application bug."; 1346 return false; 1347 } 1348 int sym; 1349 uint mod; 1350 keyQtToSymX(keyQt, &sym); 1351 keyQtToModX(keyQt, &mod); 1352 1353 // Get any extra mods required by the sym. 1354 // E.g., XK_Plus requires SHIFT on the en layout. 1355 uint modExtra = getModsRequired(sym); 1356 // Get the X modifier equivalent. 1357 if (!sym || !keyQtToModX((keyQt & Qt::KeyboardModifierMask) | modExtra, &mod)) { 1358 *keyCode = 0; 1359 return false; 1360 } 1361 1362 *keyCode = XKeysymToKeycode(QX11Info::display(), sym); 1363 return true; 1364 } 1365 #endif 1366 1367 QList<int> keyQtToCodeXs(int keyQt) 1368 { 1369 QList<int> keyCodes; 1370 if (!QX11Info::isPlatformX11()) { 1371 qCWarning(LOG_KKEYSERVER_X11) << "X11 implementation of KKeyServer accessed from non-X11 platform! This is an application bug."; 1372 return keyCodes; 1373 } 1374 uint mod; 1375 const QList<int> syms(keyQtToSymXs(keyQt)); 1376 keyQtToModX(keyQt, &mod); 1377 1378 for (int sym : syms) { 1379 // Get any extra mods required by the sym. 1380 // E.g., XK_Plus requires SHIFT on the en layout. 1381 uint modExtra = getModsRequired(sym); 1382 // Get the X modifier equivalent. 1383 if (!sym || !keyQtToModX((keyQt & Qt::KeyboardModifierMask) | modExtra, &mod)) { 1384 continue; 1385 } 1386 1387 keyCodes.append(XKeysymToKeycode(QX11Info::display(), sym)); 1388 } 1389 return keyCodes; 1390 } 1391 1392 #if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(6, 0) 1393 bool keyQtToSymX(int keyQt, int *keySym) 1394 { 1395 int symQt = keyQt & ~Qt::KeyboardModifierMask; 1396 1397 if (keyQt & Qt::KeypadModifier) { 1398 if (symQt >= Qt::Key_0 && symQt <= Qt::Key_9) { 1399 *keySym = XK_KP_0 + (symQt - Qt::Key_0); 1400 return true; 1401 } 1402 } else { 1403 if (symQt < 0x1000) { 1404 *keySym = QChar(symQt).toUpper().unicode(); 1405 return true; 1406 } 1407 } 1408 1409 for (const TransKey &tk : g_rgQtToSymX) { 1410 if (tk.keySymQt == symQt) { 1411 if ((keyQt & Qt::KeypadModifier) && !is_keypad_key(tk.keySymX)) { 1412 continue; 1413 } 1414 *keySym = tk.keySymX; 1415 return true; 1416 } 1417 } 1418 1419 *keySym = 0; 1420 if (symQt != Qt::Key_Shift && symQt != Qt::Key_Control && symQt != Qt::Key_Alt && symQt != Qt::Key_Meta && symQt != Qt::Key_Direction_L 1421 && symQt != Qt::Key_Direction_R) { 1422 // qCDebug(LOG_KKEYSERVER_X11) << "Sym::initQt( " << QString::number(keyQt,16) << " ): failed to convert key."; 1423 } 1424 return false; 1425 } 1426 #endif 1427 1428 QList<int> keyQtToSymXs(int keyQt) 1429 { 1430 int symQt = keyQt & ~Qt::KeyboardModifierMask; 1431 QList<int> syms; 1432 1433 if (keyQt & Qt::KeypadModifier) { 1434 if (symQt >= Qt::Key_0 && symQt <= Qt::Key_9) { 1435 syms.append(XK_KP_0 + (symQt - Qt::Key_0)); 1436 return syms; 1437 } 1438 } else { 1439 if (symQt < 0x1000) { 1440 syms.append(QChar(symQt).toUpper().unicode()); 1441 return syms; 1442 } 1443 } 1444 1445 for (const TransKey &tk : g_rgQtToSymX) { 1446 if (tk.keySymQt == symQt) { 1447 if ((keyQt & Qt::KeypadModifier) && !is_keypad_key(tk.keySymX)) { 1448 continue; 1449 } 1450 syms.append(tk.keySymX); 1451 } 1452 } 1453 return syms; 1454 } 1455 1456 bool symXModXToKeyQt(uint32_t keySym, uint16_t modX, int *keyQt) 1457 { 1458 int keyModQt = 0; 1459 *keyQt = Qt::Key_unknown; 1460 1461 if (keySym >= XK_KP_0 && keySym <= XK_KP_9) { 1462 // numeric keypad keys 1463 *keyQt = Qt::Key_0 + ((int)keySym - XK_KP_0); 1464 } else if (keySym < 0x1000) { 1465 if (keySym >= 'a' && keySym <= 'z') { 1466 *keyQt = QChar(keySym).toUpper().unicode(); 1467 } else { 1468 *keyQt = keySym; 1469 } 1470 } 1471 1472 else if (keySym < 0x3000) { 1473 *keyQt = keySym; 1474 } 1475 1476 else { 1477 for (const TransKey &tk : g_rgQtToSymX) { 1478 if (tk.keySymX == keySym) { 1479 *keyQt = tk.keySymQt; 1480 break; 1481 } 1482 } 1483 } 1484 1485 if (*keyQt == Qt::Key_unknown) { 1486 return false; 1487 } 1488 1489 if (modXToQt(modX, &keyModQt)) { 1490 *keyQt |= keyModQt; 1491 if (is_keypad_key(keySym)) { 1492 *keyQt |= Qt::KeypadModifier; 1493 } 1494 return true; 1495 } 1496 return false; 1497 } 1498 1499 bool keyQtToModX(int modQt, uint *modX) 1500 { 1501 if (!g_bInitializedMods) { 1502 initializeMods(); 1503 } 1504 1505 *modX = 0; 1506 for (int i = 0; i < 4; i++) { 1507 if (modQt & g_rgX11ModInfo[i].modQt) { 1508 if (g_rgX11ModInfo[i].modX) { 1509 *modX |= g_rgX11ModInfo[i].modX; 1510 } else { 1511 // The qt modifier has no x equivalent. Return false 1512 return false; 1513 } 1514 } 1515 } 1516 return true; 1517 } 1518 1519 bool modXToQt(uint modX, int *modQt) 1520 { 1521 if (!g_bInitializedMods) { 1522 initializeMods(); 1523 } 1524 1525 *modQt = 0; 1526 for (int i = 0; i < 4; i++) { 1527 if (modX & g_rgX11ModInfo[i].modX) { 1528 *modQt |= g_rgX11ModInfo[i].modQt; 1529 continue; 1530 } 1531 } 1532 return true; 1533 } 1534 1535 bool codeXToSym(uchar codeX, uint modX, uint *sym) 1536 { 1537 if (!QX11Info::isPlatformX11()) { 1538 qCWarning(LOG_KKEYSERVER_X11) << "X11 implementation of KKeyServer accessed from non-X11 platform! This is an application bug."; 1539 return false; 1540 } 1541 KeySym keySym; 1542 XKeyPressedEvent event; 1543 1544 checkDisplay(); 1545 1546 event.type = KeyPress; 1547 event.display = QX11Info::display(); 1548 event.state = modX; 1549 event.keycode = codeX; 1550 1551 XLookupString(&event, nullptr, 0, &keySym, nullptr); 1552 *sym = (uint)keySym; 1553 return true; 1554 } 1555 1556 uint accelModMaskX() 1557 { 1558 return modXShift() | modXCtrl() | modXAlt() | modXMeta(); 1559 } 1560 1561 bool xEventToQt(XEvent *e, int *keyQt) 1562 { 1563 Q_ASSERT(e->type == KeyPress || e->type == KeyRelease); 1564 1565 uchar keyCodeX = e->xkey.keycode; 1566 uint keyModX = e->xkey.state & (accelModMaskX() | MODE_SWITCH); 1567 1568 KeySym keySym; 1569 char buffer[16]; 1570 XLookupString((XKeyEvent *)e, buffer, 15, &keySym, nullptr); 1571 uint keySymX = (uint)keySym; 1572 1573 // If numlock is active and a keypad key is pressed, XOR the SHIFT state. 1574 // e.g., KP_4 => Shift+KP_Left, and Shift+KP_4 => KP_Left. 1575 if (e->xkey.state & modXNumLock()) { 1576 uint sym = XKeycodeToKeysym(QX11Info::display(), keyCodeX, 0); 1577 // TODO: what's the xor operator in c++? 1578 // If this is a keypad key, 1579 if (sym >= XK_KP_Space && sym <= XK_KP_9) { 1580 switch (sym) { 1581 // Leave the following keys unaltered 1582 // FIXME: The proper solution is to see which keysyms don't change when shifted. 1583 case XK_KP_Multiply: 1584 case XK_KP_Add: 1585 case XK_KP_Subtract: 1586 case XK_KP_Divide: 1587 break; 1588 default: 1589 if (keyModX & modXShift()) { 1590 keyModX &= ~modXShift(); 1591 } else { 1592 keyModX |= modXShift(); 1593 } 1594 } 1595 } 1596 } 1597 1598 return KKeyServer::symXModXToKeyQt(keySymX, keyModX, keyQt); 1599 } 1600 1601 bool xcbKeyPressEventToQt(xcb_generic_event_t *e, int *keyQt) 1602 { 1603 if ((e->response_type & ~0x80) != XCB_KEY_PRESS && (e->response_type & ~0x80) != XCB_KEY_RELEASE) { 1604 return false; 1605 } 1606 return xcbKeyPressEventToQt(reinterpret_cast<xcb_key_press_event_t *>(e), keyQt); 1607 } 1608 1609 bool xcbKeyPressEventToQt(xcb_key_press_event_t *e, int *keyQt) 1610 { 1611 const uint16_t keyModX = e->state & (accelModMaskX() | MODE_SWITCH); 1612 1613 xcb_key_symbols_t *symbols = xcb_key_symbols_alloc(QX11Info::connection()); 1614 1615 // We might have to use 4,5 instead of 0,1 here when mode_switch is active, just not sure how to test that. 1616 const xcb_keysym_t keySym0 = xcb_key_press_lookup_keysym(symbols, e, 0); 1617 const xcb_keysym_t keySym1 = xcb_key_press_lookup_keysym(symbols, e, 1); 1618 xcb_keysym_t keySymX; 1619 1620 if ((e->state & KKeyServer::modXNumLock()) && is_keypad_key(keySym1)) { 1621 if ((e->state & XCB_MOD_MASK_SHIFT)) { 1622 keySymX = keySym0; 1623 } else { 1624 keySymX = keySym1; 1625 } 1626 } else { 1627 keySymX = keySym0; 1628 } 1629 1630 bool ok = KKeyServer::symXModXToKeyQt(keySymX, keyModX, keyQt); 1631 1632 if ((*keyQt & Qt::ShiftModifier) && !KKeyServer::isShiftAsModifierAllowed(*keyQt)) { 1633 if (*keyQt != Qt::Key_Tab) { // KKeySequenceWidget does not map shift+tab to backtab 1634 static const int FirstLevelShift = 1; 1635 keySymX = xcb_key_symbols_get_keysym(symbols, e->detail, FirstLevelShift); 1636 KKeyServer::symXModXToKeyQt(keySymX, keyModX, keyQt); 1637 } 1638 *keyQt &= ~Qt::ShiftModifier; 1639 } 1640 1641 xcb_key_symbols_free(symbols); 1642 return ok; 1643 } 1644 1645 } // end of namespace KKeyServer block