1diff -ru libqxt-old/src/gui/keymapper_x11.h libqxt/src/gui/keymapper_x11.h 2--- libqxt-old/src/gui/keymapper_x11.h 2010-04-21 15:17:56.000000000 +0100 3+++ libqxt/src/gui/keymapper_x11.h 2010-04-21 15:18:16.000000000 +0100 4@@ -0,0 +1,364 @@ 5+#ifndef KEYMAPPER_X11_H 6+#define KEYMAPPER_X11_H 7+ 8+// (davidsansome) Nicked from qkeymapper_x11.cpp 9+ 10+#include <Qt> 11+ 12+#define XK_MISCELLANY 13+#define XK_LATIN1 14+#define XK_KOREAN 15+#define XK_XKB_KEYS 16+#include <X11/keysymdef.h> 17+ 18+// 19+// Keyboard event translation 20+// 21+ 22+#ifndef XK_ISO_Left_Tab 23+#define XK_ISO_Left_Tab 0xFE20 24+#endif 25+ 26+#ifndef XK_dead_hook 27+#define XK_dead_hook 0xFE61 28+#endif 29+ 30+#ifndef XK_dead_horn 31+#define XK_dead_horn 0xFE62 32+#endif 33+ 34+#ifndef XK_Codeinput 35+#define XK_Codeinput 0xFF37 36+#endif 37+ 38+#ifndef XK_Kanji_Bangou 39+#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ 40+#endif 41+ 42+// Fix old X libraries 43+#ifndef XK_KP_Home 44+#define XK_KP_Home 0xFF95 45+#endif 46+#ifndef XK_KP_Left 47+#define XK_KP_Left 0xFF96 48+#endif 49+#ifndef XK_KP_Up 50+#define XK_KP_Up 0xFF97 51+#endif 52+#ifndef XK_KP_Right 53+#define XK_KP_Right 0xFF98 54+#endif 55+#ifndef XK_KP_Down 56+#define XK_KP_Down 0xFF99 57+#endif 58+#ifndef XK_KP_Prior 59+#define XK_KP_Prior 0xFF9A 60+#endif 61+#ifndef XK_KP_Next 62+#define XK_KP_Next 0xFF9B 63+#endif 64+#ifndef XK_KP_End 65+#define XK_KP_End 0xFF9C 66+#endif 67+#ifndef XK_KP_Insert 68+#define XK_KP_Insert 0xFF9E 69+#endif 70+#ifndef XK_KP_Delete 71+#define XK_KP_Delete 0xFF9F 72+#endif 73+ 74+// the next lines are taken from XFree > 4.0 (X11/XF86keysyms.h), defining some special 75+// multimedia keys. They are included here as not every system has them. 76+#define XF86XK_Standby 0x1008FF10 77+#define XF86XK_AudioLowerVolume 0x1008FF11 78+#define XF86XK_AudioMute 0x1008FF12 79+#define XF86XK_AudioRaiseVolume 0x1008FF13 80+#define XF86XK_AudioPlay 0x1008FF14 81+#define XF86XK_AudioStop 0x1008FF15 82+#define XF86XK_AudioPrev 0x1008FF16 83+#define XF86XK_AudioNext 0x1008FF17 84+#define XF86XK_HomePage 0x1008FF18 85+#define XF86XK_Calculator 0x1008FF1D 86+#define XF86XK_Mail 0x1008FF19 87+#define XF86XK_Start 0x1008FF1A 88+#define XF86XK_Search 0x1008FF1B 89+#define XF86XK_AudioRecord 0x1008FF1C 90+#define XF86XK_Back 0x1008FF26 91+#define XF86XK_Forward 0x1008FF27 92+#define XF86XK_Stop 0x1008FF28 93+#define XF86XK_Refresh 0x1008FF29 94+#define XF86XK_Favorites 0x1008FF30 95+#define XF86XK_AudioPause 0x1008FF31 96+#define XF86XK_AudioMedia 0x1008FF32 97+#define XF86XK_MyComputer 0x1008FF33 98+#define XF86XK_OpenURL 0x1008FF38 99+#define XF86XK_Launch0 0x1008FF40 100+#define XF86XK_Launch1 0x1008FF41 101+#define XF86XK_Launch2 0x1008FF42 102+#define XF86XK_Launch3 0x1008FF43 103+#define XF86XK_Launch4 0x1008FF44 104+#define XF86XK_Launch5 0x1008FF45 105+#define XF86XK_Launch6 0x1008FF46 106+#define XF86XK_Launch7 0x1008FF47 107+#define XF86XK_Launch8 0x1008FF48 108+#define XF86XK_Launch9 0x1008FF49 109+#define XF86XK_LaunchA 0x1008FF4A 110+#define XF86XK_LaunchB 0x1008FF4B 111+#define XF86XK_LaunchC 0x1008FF4C 112+#define XF86XK_LaunchD 0x1008FF4D 113+#define XF86XK_LaunchE 0x1008FF4E 114+#define XF86XK_LaunchF 0x1008FF4F 115+// end of XF86keysyms.h 116+ 117+// Special keys used by Qtopia, mapped into the X11 private keypad range. 118+#define QTOPIAXK_Select 0x11000601 119+#define QTOPIAXK_Yes 0x11000602 120+#define QTOPIAXK_No 0x11000603 121+#define QTOPIAXK_Cancel 0x11000604 122+#define QTOPIAXK_Printer 0x11000605 123+#define QTOPIAXK_Execute 0x11000606 124+#define QTOPIAXK_Sleep 0x11000607 125+#define QTOPIAXK_Play 0x11000608 126+#define QTOPIAXK_Zoom 0x11000609 127+#define QTOPIAXK_Context1 0x1100060A 128+#define QTOPIAXK_Context2 0x1100060B 129+#define QTOPIAXK_Context3 0x1100060C 130+#define QTOPIAXK_Context4 0x1100060D 131+#define QTOPIAXK_Call 0x1100060E 132+#define QTOPIAXK_Hangup 0x1100060F 133+#define QTOPIAXK_Flip 0x11000610 134+ 135+// keyboard mapping table 136+static const unsigned int KeyTbl[] = { 137+ 138+ // misc keys 139+ 140+ XK_Escape, Qt::Key_Escape, 141+ XK_Tab, Qt::Key_Tab, 142+ XK_ISO_Left_Tab, Qt::Key_Backtab, 143+ XK_BackSpace, Qt::Key_Backspace, 144+ XK_Return, Qt::Key_Return, 145+ XK_Insert, Qt::Key_Insert, 146+ XK_Delete, Qt::Key_Delete, 147+ XK_Clear, Qt::Key_Delete, 148+ XK_Pause, Qt::Key_Pause, 149+ XK_Print, Qt::Key_Print, 150+ 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq 151+ 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq 152+ 153+ // cursor movement 154+ 155+ XK_Home, Qt::Key_Home, 156+ XK_End, Qt::Key_End, 157+ XK_Left, Qt::Key_Left, 158+ XK_Up, Qt::Key_Up, 159+ XK_Right, Qt::Key_Right, 160+ XK_Down, Qt::Key_Down, 161+ XK_Prior, Qt::Key_PageUp, 162+ XK_Next, Qt::Key_PageDown, 163+ 164+ // modifiers 165+ 166+ XK_Shift_L, Qt::Key_Shift, 167+ XK_Shift_R, Qt::Key_Shift, 168+ XK_Shift_Lock, Qt::Key_Shift, 169+ XK_Control_L, Qt::Key_Control, 170+ XK_Control_R, Qt::Key_Control, 171+ XK_Meta_L, Qt::Key_Meta, 172+ XK_Meta_R, Qt::Key_Meta, 173+ XK_Alt_L, Qt::Key_Alt, 174+ XK_Alt_R, Qt::Key_Alt, 175+ XK_Caps_Lock, Qt::Key_CapsLock, 176+ XK_Num_Lock, Qt::Key_NumLock, 177+ XK_Scroll_Lock, Qt::Key_ScrollLock, 178+ XK_Super_L, Qt::Key_Super_L, 179+ XK_Super_R, Qt::Key_Super_R, 180+ XK_Menu, Qt::Key_Menu, 181+ XK_Hyper_L, Qt::Key_Hyper_L, 182+ XK_Hyper_R, Qt::Key_Hyper_R, 183+ XK_Help, Qt::Key_Help, 184+ 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab 185+ 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) 186+ 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) 187+ 188+ // numeric and function keypad keys 189+ 190+ XK_KP_Space, Qt::Key_Space, 191+ XK_KP_Tab, Qt::Key_Tab, 192+ XK_KP_Enter, Qt::Key_Enter, 193+ //XK_KP_F1, Qt::Key_F1, 194+ //XK_KP_F2, Qt::Key_F2, 195+ //XK_KP_F3, Qt::Key_F3, 196+ //XK_KP_F4, Qt::Key_F4, 197+ XK_KP_Home, Qt::Key_Home, 198+ XK_KP_Left, Qt::Key_Left, 199+ XK_KP_Up, Qt::Key_Up, 200+ XK_KP_Right, Qt::Key_Right, 201+ XK_KP_Down, Qt::Key_Down, 202+ XK_KP_Prior, Qt::Key_PageUp, 203+ XK_KP_Next, Qt::Key_PageDown, 204+ XK_KP_End, Qt::Key_End, 205+ XK_KP_Begin, Qt::Key_Clear, 206+ XK_KP_Insert, Qt::Key_Insert, 207+ XK_KP_Delete, Qt::Key_Delete, 208+ XK_KP_Equal, Qt::Key_Equal, 209+ XK_KP_Multiply, Qt::Key_Asterisk, 210+ XK_KP_Add, Qt::Key_Plus, 211+ XK_KP_Separator, Qt::Key_Comma, 212+ XK_KP_Subtract, Qt::Key_Minus, 213+ XK_KP_Decimal, Qt::Key_Period, 214+ XK_KP_Divide, Qt::Key_Slash, 215+ 216+ // International input method support keys 217+ 218+ // International & multi-key character composition 219+ XK_ISO_Level3_Shift, Qt::Key_AltGr, 220+ XK_Multi_key, Qt::Key_Multi_key, 221+ XK_Codeinput, Qt::Key_Codeinput, 222+ XK_SingleCandidate, Qt::Key_SingleCandidate, 223+ XK_MultipleCandidate, Qt::Key_MultipleCandidate, 224+ XK_PreviousCandidate, Qt::Key_PreviousCandidate, 225+ 226+ // Misc Functions 227+ XK_Mode_switch, Qt::Key_Mode_switch, 228+ XK_script_switch, Qt::Key_Mode_switch, 229+ 230+ // Japanese keyboard support 231+ XK_Kanji, Qt::Key_Kanji, 232+ XK_Muhenkan, Qt::Key_Muhenkan, 233+ //XK_Henkan_Mode, Qt::Key_Henkan_Mode, 234+ XK_Henkan_Mode, Qt::Key_Henkan, 235+ XK_Henkan, Qt::Key_Henkan, 236+ XK_Romaji, Qt::Key_Romaji, 237+ XK_Hiragana, Qt::Key_Hiragana, 238+ XK_Katakana, Qt::Key_Katakana, 239+ XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, 240+ XK_Zenkaku, Qt::Key_Zenkaku, 241+ XK_Hankaku, Qt::Key_Hankaku, 242+ XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, 243+ XK_Touroku, Qt::Key_Touroku, 244+ XK_Massyo, Qt::Key_Massyo, 245+ XK_Kana_Lock, Qt::Key_Kana_Lock, 246+ XK_Kana_Shift, Qt::Key_Kana_Shift, 247+ XK_Eisu_Shift, Qt::Key_Eisu_Shift, 248+ XK_Eisu_toggle, Qt::Key_Eisu_toggle, 249+ //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, 250+ //XK_Zen_Koho, Qt::Key_Zen_Koho, 251+ //XK_Mae_Koho, Qt::Key_Mae_Koho, 252+ XK_Kanji_Bangou, Qt::Key_Codeinput, 253+ XK_Zen_Koho, Qt::Key_MultipleCandidate, 254+ XK_Mae_Koho, Qt::Key_PreviousCandidate, 255+ 256+#ifdef XK_KOREAN 257+ // Korean keyboard support 258+ XK_Hangul, Qt::Key_Hangul, 259+ XK_Hangul_Start, Qt::Key_Hangul_Start, 260+ XK_Hangul_End, Qt::Key_Hangul_End, 261+ XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, 262+ XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, 263+ XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, 264+ //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, 265+ XK_Hangul_Codeinput, Qt::Key_Codeinput, 266+ XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, 267+ XK_Hangul_Banja, Qt::Key_Hangul_Banja, 268+ XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, 269+ XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, 270+ //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, 271+ //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, 272+ //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, 273+ XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, 274+ XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, 275+ XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, 276+ XK_Hangul_Special, Qt::Key_Hangul_Special, 277+ //XK_Hangul_switch, Qt::Key_Hangul_switch, 278+ XK_Hangul_switch, Qt::Key_Mode_switch, 279+#endif // XK_KOREAN 280+ 281+ // dead keys 282+ XK_dead_grave, Qt::Key_Dead_Grave, 283+ XK_dead_acute, Qt::Key_Dead_Acute, 284+ XK_dead_circumflex, Qt::Key_Dead_Circumflex, 285+ XK_dead_tilde, Qt::Key_Dead_Tilde, 286+ XK_dead_macron, Qt::Key_Dead_Macron, 287+ XK_dead_breve, Qt::Key_Dead_Breve, 288+ XK_dead_abovedot, Qt::Key_Dead_Abovedot, 289+ XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, 290+ XK_dead_abovering, Qt::Key_Dead_Abovering, 291+ XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, 292+ XK_dead_caron, Qt::Key_Dead_Caron, 293+ XK_dead_cedilla, Qt::Key_Dead_Cedilla, 294+ XK_dead_ogonek, Qt::Key_Dead_Ogonek, 295+ XK_dead_iota, Qt::Key_Dead_Iota, 296+ XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, 297+ XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, 298+ XK_dead_belowdot, Qt::Key_Dead_Belowdot, 299+ XK_dead_hook, Qt::Key_Dead_Hook, 300+ XK_dead_horn, Qt::Key_Dead_Horn, 301+ 302+ // Special multimedia keys 303+ // currently only tested with MS internet keyboard 304+ 305+ // browsing keys 306+ XF86XK_Back, Qt::Key_Back, 307+ XF86XK_Forward, Qt::Key_Forward, 308+ XF86XK_Stop, Qt::Key_Stop, 309+ XF86XK_Refresh, Qt::Key_Refresh, 310+ XF86XK_Favorites, Qt::Key_Favorites, 311+ XF86XK_AudioMedia, Qt::Key_LaunchMedia, 312+ XF86XK_OpenURL, Qt::Key_OpenUrl, 313+ XF86XK_HomePage, Qt::Key_HomePage, 314+ XF86XK_Search, Qt::Key_Search, 315+ 316+ // media keys 317+ XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, 318+ XF86XK_AudioMute, Qt::Key_VolumeMute, 319+ XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, 320+ XF86XK_AudioPlay, Qt::Key_MediaPlay, 321+ XF86XK_AudioStop, Qt::Key_MediaStop, 322+ XF86XK_AudioPrev, Qt::Key_MediaPrevious, 323+ XF86XK_AudioNext, Qt::Key_MediaNext, 324+ XF86XK_AudioRecord, Qt::Key_MediaRecord, 325+ 326+ // launch keys 327+ XF86XK_Mail, Qt::Key_LaunchMail, 328+ XF86XK_MyComputer, Qt::Key_Launch0, 329+ XF86XK_Calculator, Qt::Key_Launch1, 330+ XF86XK_Standby, Qt::Key_Standby, 331+ 332+ XF86XK_Launch0, Qt::Key_Launch2, 333+ XF86XK_Launch1, Qt::Key_Launch3, 334+ XF86XK_Launch2, Qt::Key_Launch4, 335+ XF86XK_Launch3, Qt::Key_Launch5, 336+ XF86XK_Launch4, Qt::Key_Launch6, 337+ XF86XK_Launch5, Qt::Key_Launch7, 338+ XF86XK_Launch6, Qt::Key_Launch8, 339+ XF86XK_Launch7, Qt::Key_Launch9, 340+ XF86XK_Launch8, Qt::Key_LaunchA, 341+ XF86XK_Launch9, Qt::Key_LaunchB, 342+ XF86XK_LaunchA, Qt::Key_LaunchC, 343+ XF86XK_LaunchB, Qt::Key_LaunchD, 344+ XF86XK_LaunchC, Qt::Key_LaunchE, 345+ XF86XK_LaunchD, Qt::Key_LaunchF, 346+ 347+ // Qtopia keys 348+ QTOPIAXK_Select, Qt::Key_Select, 349+ QTOPIAXK_Yes, Qt::Key_Yes, 350+ QTOPIAXK_No, Qt::Key_No, 351+ QTOPIAXK_Cancel, Qt::Key_Cancel, 352+ QTOPIAXK_Printer, Qt::Key_Printer, 353+ QTOPIAXK_Execute, Qt::Key_Execute, 354+ QTOPIAXK_Sleep, Qt::Key_Sleep, 355+ QTOPIAXK_Play, Qt::Key_Play, 356+ QTOPIAXK_Zoom, Qt::Key_Zoom, 357+ QTOPIAXK_Context1, Qt::Key_Context1, 358+ QTOPIAXK_Context2, Qt::Key_Context2, 359+ QTOPIAXK_Context3, Qt::Key_Context3, 360+ QTOPIAXK_Context4, Qt::Key_Context4, 361+ QTOPIAXK_Call, Qt::Key_Call, 362+ QTOPIAXK_Hangup, Qt::Key_Hangup, 363+ QTOPIAXK_Flip, Qt::Key_Flip, 364+ 365+ 0, 0 366+}; 367+ 368+#endif // KEYMAPPER_X11_H 369diff -ru libqxt-old/src/gui/qxtglobalshortcut_win.cpp libqxt/src/gui/qxtglobalshortcut_win.cpp 370--- libqxt-old/src/gui/qxtglobalshortcut_win.cpp 2010-04-21 15:17:56.000000000 +0100 371+++ libqxt/src/gui/qxtglobalshortcut_win.cpp 2010-04-21 15:18:16.000000000 +0100 372@@ -156,6 +156,21 @@ 373 case Qt::Key_Slash: 374 return VK_DIVIDE; 375 376+ case Qt::Key_MediaNext: 377+ return VK_MEDIA_NEXT_TRACK; 378+ case Qt::Key_MediaPrevious: 379+ return VK_MEDIA_PREV_TRACK; 380+ case Qt::Key_MediaStop: 381+ return VK_MEDIA_STOP; 382+ case Qt::Key_MediaPlay: 383+ return VK_MEDIA_PLAY_PAUSE; 384+ case Qt::Key_VolumeDown: 385+ return VK_VOLUME_DOWN; 386+ case Qt::Key_VolumeUp: 387+ return VK_VOLUME_UP; 388+ case Qt::Key_VolumeMute: 389+ return VK_VOLUME_MUTE; 390+ 391 // numbers 392 case Qt::Key_0: 393 case Qt::Key_1: 394diff -ru libqxt-old/src/gui/qxtglobalshortcut_x11.cpp libqxt/src/gui/qxtglobalshortcut_x11.cpp 395--- libqxt-old/src/gui/qxtglobalshortcut_x11.cpp 2010-04-21 15:17:56.000000000 +0100 396+++ libqxt/src/gui/qxtglobalshortcut_x11.cpp 2010-04-21 15:18:16.000000000 +0100 397@@ -26,6 +26,8 @@ 398 #include <QX11Info> 399 #include <X11/Xlib.h> 400 401+#include "keymapper_x11.h" 402+ 403 static int (*original_x_errhandler)(Display* display, XErrorEvent* event); 404 405 static int qxt_x_errhandler(Display* display, XErrorEvent *event) 406@@ -81,8 +83,25 @@ 407 408 quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key) 409 { 410+ // (davidsansome) Try the table from QKeyMapper first - this seems to be 411+ // the only way to get Keysyms for the media keys. 412+ unsigned int keysym = 0; 413+ int i = 0; 414+ while (KeyTbl[i]) { 415+ if (KeyTbl[i+1] == static_cast<uint>(key)) { 416+ keysym = KeyTbl[i]; 417+ break; 418+ } 419+ i += 2; 420+ } 421+ 422+ // If that didn't work then fall back on XStringToKeysym 423+ if (!keysym) { 424+ keysym = XStringToKeysym(QKeySequence(key).toString().toLatin1().data()); 425+ } 426+ 427 Display* display = QX11Info::display(); 428- return XKeysymToKeycode(display, XStringToKeysym(QKeySequence(key).toString().toLatin1().data())); 429+ return XKeysymToKeycode(display, keysym); 430 } 431 432 bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativeMods) 433