25 #include <tqnamespace.h> 26 #include <tqwindowdefs.h> 28 #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_MACX) // Only compile this module if we're compiling for X11, mac or win32 30 #include "kkeyserver_x11.h" 31 #include "kkeynative.h" 32 #include "kshortcut.h" 40 # define XK_MISCELLANY 43 # include <X11/Xlib.h> 44 # include <X11/Xutil.h> 45 # include <X11/keysymdef.h> 46 # define X11_ONLY(arg) arg, //allows to omit an argument 49 # define X11_ONLY(arg) 50 # define XK_ISO_Left_Tab Qt::Key_Backtab 51 # define XK_BackSpace Qt::Key_Backspace 52 # define XK_Sys_Req Qt::Key_SysReq 53 # define XK_Caps_Lock Qt::Key_CapsLock 54 # define XK_Num_Lock Qt::Key_NumLock 55 # define XK_Scroll_Lock Qt::Key_ScrollLock 56 # define XK_Prior Qt::Key_Prior 57 # define XK_Next Qt::Key_Next 89 uint sym, symVariation;
108 static ModInfo g_rgModInfo[KKey::MOD_FLAG_COUNT] =
110 { KKey::SHIFT, Qt::SHIFT, X11_ONLY(ShiftMask) I18N_NOOP("Shift"), TQString() },
111 { KKey::CTRL, Qt::CTRL, X11_ONLY(ControlMask) I18N_NOOP("Ctrl"), TQString() },
112 { KKey::ALT, Qt::ALT, X11_ONLY(Mod1Mask) I18N_NOOP("Alt"), TQString() },
113 { KKey::WIN, KKey::QtWIN, X11_ONLY(Mod4Mask) I18N_NOOP("Win"), TQString() }
117 static const SymName g_rgSymNames[] = {
118 { XK_ISO_Left_Tab,
"Backtab" },
119 { XK_BackSpace, I18N_NOOP(
"Backspace") },
120 { XK_Sys_Req, I18N_NOOP(
"SysReq") },
121 { XK_Caps_Lock, I18N_NOOP(
"CapsLock") },
122 { XK_Num_Lock, I18N_NOOP(
"NumLock") },
123 { XK_Scroll_Lock, I18N_NOOP(
"ScrollLock") },
124 { XK_Prior, I18N_NOOP(
"PageUp") },
125 { XK_Next, I18N_NOOP(
"PageDown") },
127 { XK_F11, I18N_NOOP(
"Stop") },
128 { XK_F12, I18N_NOOP(
"Again") },
129 { XK_F13, I18N_NOOP(
"Props") },
130 { XK_F14, I18N_NOOP(
"Undo") },
131 { XK_F15, I18N_NOOP(
"Front") },
132 { XK_F16, I18N_NOOP(
"Copy") },
133 { XK_F17, I18N_NOOP(
"Open") },
134 { XK_F18, I18N_NOOP(
"Paste") },
135 { XK_F19, I18N_NOOP(
"Find") },
136 { XK_F20, I18N_NOOP(
"Cut") },
137 { XK_F22, I18N_NOOP(
"Print") },
143 static SymVariation g_rgSymVariation[] =
145 {
'/', XK_KP_Divide,
false },
146 {
'*', XK_KP_Multiply,
false },
147 {
'-', XK_KP_Subtract,
false },
148 {
'+', XK_KP_Add,
false },
149 { XK_Return, XK_KP_Enter,
false },
156 static const TransKey g_rgQtToSymX[] =
158 { Qt::Key_Escape, XK_Escape },
159 { Qt::Key_Tab, XK_Tab },
160 { Qt::Key_Backtab, XK_ISO_Left_Tab },
161 { Qt::Key_Backspace, XK_BackSpace },
162 { Qt::Key_Return, XK_Return },
163 { Qt::Key_Enter, XK_KP_Enter },
164 { Qt::Key_Insert, XK_Insert },
165 { Qt::Key_Delete, XK_Delete },
166 { Qt::Key_Pause, XK_Pause },
168 { Qt::Key_Print, XK_F22 },
170 { Qt::Key_Print, XK_Print },
172 { Qt::Key_SysReq, XK_Sys_Req },
173 { Qt::Key_Home, XK_Home },
174 { Qt::Key_End, XK_End },
175 { Qt::Key_Left, XK_Left },
176 { Qt::Key_Up, XK_Up },
177 { Qt::Key_Right, XK_Right },
178 { Qt::Key_Down, XK_Down },
179 { TQt::Key_Prior, XK_Prior },
180 { TQt::Key_Next, XK_Next },
185 { Qt::Key_CapsLock, XK_Caps_Lock },
186 { Qt::Key_NumLock, XK_Num_Lock },
187 { Qt::Key_ScrollLock, XK_Scroll_Lock },
188 { Qt::Key_F1, XK_F1 },
189 { Qt::Key_F2, XK_F2 },
190 { Qt::Key_F3, XK_F3 },
191 { Qt::Key_F4, XK_F4 },
192 { Qt::Key_F5, XK_F5 },
193 { Qt::Key_F6, XK_F6 },
194 { Qt::Key_F7, XK_F7 },
195 { Qt::Key_F8, XK_F8 },
196 { Qt::Key_F9, XK_F9 },
197 { Qt::Key_F10, XK_F10 },
198 { Qt::Key_F11, XK_F11 },
199 { Qt::Key_F12, XK_F12 },
200 { Qt::Key_F13, XK_F13 },
201 { Qt::Key_F14, XK_F14 },
202 { Qt::Key_F15, XK_F15 },
203 { Qt::Key_F16, XK_F16 },
204 { Qt::Key_F17, XK_F17 },
205 { Qt::Key_F18, XK_F18 },
206 { Qt::Key_F19, XK_F19 },
207 { Qt::Key_F20, XK_F20 },
208 { Qt::Key_F21, XK_F21 },
209 { Qt::Key_F22, XK_F22 },
210 { Qt::Key_F23, XK_F23 },
211 { Qt::Key_F24, XK_F24 },
212 { Qt::Key_F25, XK_F25 },
213 { Qt::Key_F26, XK_F26 },
214 { Qt::Key_F27, XK_F27 },
215 { Qt::Key_F28, XK_F28 },
216 { Qt::Key_F29, XK_F29 },
217 { Qt::Key_F30, XK_F30 },
218 { Qt::Key_F31, XK_F31 },
219 { Qt::Key_F32, XK_F32 },
220 { Qt::Key_F33, XK_F33 },
221 { Qt::Key_F34, XK_F34 },
222 { Qt::Key_F35, XK_F35 },
223 { Qt::Key_Super_L, XK_Super_L },
224 { Qt::Key_Super_R, XK_Super_R },
225 { Qt::Key_Menu, XK_Menu },
226 { Qt::Key_Hyper_L, XK_Hyper_L },
227 { Qt::Key_Hyper_R, XK_Hyper_R },
228 { Qt::Key_Help, XK_Help },
232 {
'/', XK_KP_Divide },
233 {
'*', XK_KP_Multiply },
234 {
'-', XK_KP_Subtract },
236 { Qt::Key_Return, XK_KP_Enter }
237 #if QT_VERSION >= 0x030100 241 #define XF86XK_Standby 0x1008FF10 242 #define XF86XK_AudioLowerVolume 0x1008FF11 243 #define XF86XK_AudioMute 0x1008FF12 244 #define XF86XK_AudioRaiseVolume 0x1008FF13 245 #define XF86XK_AudioPlay 0x1008FF14 246 #define XF86XK_AudioStop 0x1008FF15 247 #define XF86XK_AudioPrev 0x1008FF16 248 #define XF86XK_AudioNext 0x1008FF17 249 #define XF86XK_HomePage 0x1008FF18 250 #define XF86XK_Calculator 0x1008FF1D 251 #define XF86XK_Mail 0x1008FF19 252 #define XF86XK_Start 0x1008FF1A 253 #define XF86XK_Search 0x1008FF1B 254 #define XF86XK_AudioRecord 0x1008FF1C 255 #define XF86XK_Back 0x1008FF26 256 #define XF86XK_Forward 0x1008FF27 257 #define XF86XK_Stop 0x1008FF28 258 #define XF86XK_Refresh 0x1008FF29 259 #define XF86XK_Favorites 0x1008FF30 260 #define XF86XK_AudioPause 0x1008FF31 261 #define XF86XK_AudioMedia 0x1008FF32 262 #define XF86XK_MyComputer 0x1008FF33 263 #define XF86XK_OpenURL 0x1008FF38 264 #define XF86XK_Launch0 0x1008FF40 265 #define XF86XK_Launch1 0x1008FF41 266 #define XF86XK_Launch2 0x1008FF42 267 #define XF86XK_Launch3 0x1008FF43 268 #define XF86XK_Launch4 0x1008FF44 269 #define XF86XK_Launch5 0x1008FF45 270 #define XF86XK_Launch6 0x1008FF46 271 #define XF86XK_Launch7 0x1008FF47 272 #define XF86XK_Launch8 0x1008FF48 273 #define XF86XK_Launch9 0x1008FF49 274 #define XF86XK_LaunchA 0x1008FF4A 275 #define XF86XK_LaunchB 0x1008FF4B 276 #define XF86XK_LaunchC 0x1008FF4C 277 #define XF86XK_LaunchD 0x1008FF4D 278 #define XF86XK_LaunchE 0x1008FF4E 279 #define XF86XK_LaunchF 0x1008FF4F 280 #define XF86XK_MonBrightnessUp 0x1008FF02 281 #define XF86XK_MonBrightnessDown 0x1008FF03 282 #define XF86XK_KbdLightOnOff 0x1008FF04 283 #define XF86XK_KbdBrightnessUp 0x1008FF05 284 #define XF86XK_KbdBrightnessDown 0x1008FF06 287 { Qt::Key_Standby, XF86XK_Standby },
288 { Qt::Key_VolumeDown, XF86XK_AudioLowerVolume },
289 { Qt::Key_VolumeMute, XF86XK_AudioMute },
290 { Qt::Key_VolumeUp, XF86XK_AudioRaiseVolume },
291 { Qt::Key_MediaPlay, XF86XK_AudioPlay },
292 { Qt::Key_MediaStop, XF86XK_AudioStop },
293 { TQt::Key_MediaPrev, XF86XK_AudioPrev },
294 { Qt::Key_MediaNext, XF86XK_AudioNext },
295 { Qt::Key_HomePage, XF86XK_HomePage },
296 { Qt::Key_LaunchMail, XF86XK_Mail },
297 { Qt::Key_Search, XF86XK_Search },
298 { Qt::Key_MediaRecord, XF86XK_AudioRecord },
299 { Qt::Key_LaunchMedia, XF86XK_AudioMedia },
300 { Qt::Key_Launch1, XF86XK_Calculator },
301 { Qt::Key_Back, XF86XK_Back },
302 { Qt::Key_Forward, XF86XK_Forward },
303 { Qt::Key_Stop, XF86XK_Stop },
304 { Qt::Key_Refresh, XF86XK_Refresh },
305 { Qt::Key_Favorites, XF86XK_Favorites },
306 { Qt::Key_Launch0, XF86XK_MyComputer },
307 { Qt::Key_OpenUrl, XF86XK_OpenURL },
308 { Qt::Key_Launch2, XF86XK_Launch0 },
309 { Qt::Key_Launch3, XF86XK_Launch1 },
310 { Qt::Key_Launch4, XF86XK_Launch2 },
311 { Qt::Key_Launch5, XF86XK_Launch3 },
312 { Qt::Key_Launch6, XF86XK_Launch4 },
313 { Qt::Key_Launch7, XF86XK_Launch5 },
314 { Qt::Key_Launch8, XF86XK_Launch6 },
315 { Qt::Key_Launch9, XF86XK_Launch7 },
316 { Qt::Key_LaunchA, XF86XK_Launch8 },
317 { Qt::Key_LaunchB, XF86XK_Launch9 },
318 { Qt::Key_LaunchC, XF86XK_LaunchA },
319 { Qt::Key_LaunchD, XF86XK_LaunchB },
320 { Qt::Key_LaunchE, XF86XK_LaunchC },
321 { Qt::Key_LaunchF, XF86XK_LaunchD },
322 { Qt::Key_MonBrightnessUp, XF86XK_MonBrightnessUp },
323 { Qt::Key_MonBrightnessDown, XF86XK_MonBrightnessDown },
324 { Qt::Key_KeyboardLightOnOff, XF86XK_KbdLightOnOff },
325 { Qt::Key_KeyboardBrightnessUp, XF86XK_KbdBrightnessUp },
326 { Qt::Key_KeyboardBrightnessDown, XF86XK_KbdBrightnessDown },
334 static bool g_bInitializedMods, g_bInitializedVariations, g_bInitializedKKeyLabels;
335 static bool g_bMacLabels;
337 static uint g_modXNumLock, g_modXScrollLock, g_modXModeSwitch;
341 XModifierKeymap* xmk = XGetModifierMapping( qt_xdisplay() );
343 g_rgModInfo[3].modX = g_modXNumLock = g_modXScrollLock = g_modXModeSwitch = 0;
345 int min_keycode, max_keycode;
346 int keysyms_per_keycode = 0;
347 XDisplayKeycodes( qt_xdisplay(), &min_keycode, &max_keycode );
348 XFree( XGetKeyboardMapping( qt_xdisplay(), min_keycode, 1, &keysyms_per_keycode ));
350 for(
int i = Mod2MapIndex; i < 8; i++ ) {
351 uint mask = (1 << i);
352 uint keySymX = NoSymbol;
357 for(
int j = 0; j < xmk->max_keypermod && keySymX == NoSymbol; ++j )
358 for(
int k = 0; k < keysyms_per_keycode && keySymX == NoSymbol; ++k )
359 keySymX = XKeycodeToKeysym( qt_xdisplay(), xmk->modifiermap[xmk->max_keypermod * i + j], k );
361 case XK_Num_Lock: g_modXNumLock = mask;
break;
363 case XK_Super_R: g_rgModInfo[3].modX = mask;
break;
365 case XK_Meta_R:
if( !g_rgModInfo[3].
modX ) g_rgModInfo[3].modX = mask;
break;
366 case XK_Scroll_Lock: g_modXScrollLock = mask;
break;
367 case XK_Mode_switch: g_modXModeSwitch = mask;
break;
371 XFreeModifiermap( xmk );
376 g_bInitializedMods =
true;
378 kdDebug(125) <<
"KKeyServer::initializeMods(): Win Mod = 0x" << TQString::number(g_rgModInfo[3].
modX, 16) <<
endl;
382 static void initializeVariations()
384 for(
int i = 0; g_rgSymVariation[i].sym != 0; i++ )
385 g_rgSymVariation[i].bActive = (XKeysymToKeycode( qt_xdisplay(), g_rgSymVariation[i].symVariation ) != 0);
386 g_bInitializedVariations =
true;
390 static void intializeKKeyLabels()
397 g_bMacLabels = (g_rgModInfo[2].sLabel ==
"Command");
398 g_bInitializedKKeyLabels =
true;
416 int symQt = keyQt & 0xffff;
418 if( (keyQt & Qt::UNICODE_ACCEL) || symQt < 0x1000 ) {
419 m_sym = TQChar(symQt).lower().unicode();
426 #elif defined(Q_WS_X11) 427 for( uint i = 0; i <
sizeof(g_rgQtToSymX)/
sizeof(TransKey); i++ ) {
428 if( g_rgQtToSymX[i].keySymQt == symQt ) {
429 m_sym = g_rgQtToSymX[i].keySymX;
435 if( symQt != Qt::Key_Shift && symQt != Qt::Key_Control && symQt != Qt::Key_Alt &&
436 symQt != Qt::Key_Meta && symQt != Qt::Key_Direction_L && symQt != Qt::Key_Direction_R )
437 kdDebug(125) <<
"Sym::initQt( " << TQString::number(keyQt,16) <<
" ): failed to convert key." <<
endl;
439 #elif defined(Q_WS_MACX) 448 if( s.length() == 1 ) {
449 m_sym = s[0].lower().unicode();
454 for(
int i = 0; g_rgSymNames[i].sym != 0; i++ ) {
455 if( qstricmp( s.latin1(), g_rgSymNames[i].psName ) == 0 ) {
456 m_sym = g_rgSymNames[i].sym;
463 for ( KKeys
const *pKey = kde_KKEYS; pKey->code != 0xffff; pKey++) {
464 if( qstricmp( s.latin1(), pKey->name ) == 0 ) {
470 #elif defined(Q_WS_X11) 472 m_sym = XStringToKeysym( s.latin1() );
474 m_sym = XStringToKeysym( s.lower().latin1() );
477 s2[0] = s2[0].upper();
478 m_sym = XStringToKeysym( s2.latin1() );
487 if( m_sym < 0x1000 ) {
488 if( m_sym >=
'a' && m_sym <=
'z' )
489 return TQChar(m_sym).upper();
495 #elif defined(Q_WS_X11) 497 return m_sym | Qt::UNICODE_ACCEL;
499 for( uint i = 0; i <
sizeof(g_rgQtToSymX)/
sizeof(TransKey); i++ )
500 if( g_rgQtToSymX[i].keySymX == m_sym )
501 return g_rgQtToSymX[i].keySymQt;
503 return TQt::Key_unknown;
509 return TQString::null;
514 else if( m_sym < 0x1000 ) {
516 else if( m_sym < 0x3000 ) {
518 TQChar c = TQChar(m_sym).upper();
521 if( (c.latin1() && c.isLetterOrNumber())
522 || (bUserSpace && !c.isSpace()) ) {
528 for(
int i = 0; g_rgSymNames[i].sym != 0; i++ ) {
529 if( m_sym == g_rgSymNames[i].sym ) {
530 return bUserSpace ? i18n(g_rgSymNames[i].psName) : TQString(g_rgSymNames[i].psName);
536 s = TQKeySequence( m_sym );
537 #elif defined(Q_WS_X11) 539 s = XKeysymToString( m_sym );
541 capitalizeKeyname( s );
542 return bUserSpace ? i18n(TQACCEL_OBJECT_NAME_STRING, s.latin1()) : s;
545 TQString Sym::toStringInternal()
const {
return toString(
false ); }
553 if( m_sym == XK_Sys_Req )
return KKey::ALT;
554 if( m_sym == XK_Break )
return KKey::CTRL;
556 if( m_sym < 0x3000 ) {
558 if( c.isLetter() && c.lower() != c.upper() && m_sym == c.upper().unicode() )
562 uchar code = XKeysymToKeycode( qt_xdisplay(), m_sym );
567 if( m_sym == XKeycodeToKeysym( qt_xdisplay(), code, 0 ) )
569 else if( m_sym == XKeycodeToKeysym( qt_xdisplay(), code, 1 ) )
571 else if( m_sym == XKeycodeToKeysym( qt_xdisplay(), code, 2 ) )
572 mod = KKeyServer::MODE_SWITCH;
573 else if( m_sym == XKeycodeToKeysym( qt_xdisplay(), code, 3 ) )
574 mod = KKey::SHIFT | KKeyServer::MODE_SWITCH;
583 if( !g_bInitializedVariations )
584 initializeVariations();
585 for(
int i = 0; g_rgSymVariation[i].sym != 0; i++ )
586 if( g_rgSymVariation[i].sym == m_sym && g_rgSymVariation[i].bActive )
587 return g_rgSymVariation[i].symVariation;
592 void Sym::capitalizeKeyname( TQString& s )
595 int len = s.length();
596 if( s.endsWith(
"left" ) ) s[len-4] =
'L';
597 else if( s.endsWith(
"right" ) ) s[len-5] =
'R';
598 else if( s ==
"Sysreq" ) s[len-3] =
'R';
608 if( mod == KKey::WIN && !g_bInitializedMods )
611 for( uint i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
612 if( g_rgModInfo[i].mod == mod )
613 return g_rgModInfo[i].modX;
620 uint
modXLock() {
return LockMask; }
621 uint
modXCtrl() {
return ControlMask; }
622 uint
modXAlt() {
return Mod1Mask; }
630 if( !g_bInitializedMods )
632 return ShiftMask | ControlMask | Mod1Mask | g_rgModInfo[3].modX;
639 if( sym.initQt( keyQt ) ) {
650 if( keyQt & Qt::SHIFT ) mod |= KKey::SHIFT;
651 if( keyQt & Qt::CTRL ) mod |= KKey::CTRL;
652 if( keyQt & Qt::ALT ) mod |= KKey::ALT;
653 if( keyQt & Qt::META ) mod |= KKey::WIN;
662 return (keyQt != TQt::Key_unknown);
668 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
669 if( mod & g_rgModInfo[i].mod ) {
670 if( !g_rgModInfo[i].modQt ) {
674 modQt |= g_rgModInfo[i].modQt;
690 if (s & Qt::ShiftButton) modQt |= KKey::SHIFT;
691 if (s & Qt::ControlButton) modQt |= KKey::CTRL;
692 if (s & Qt::AltButton) modQt |= KKey::ALT;
701 #elif defined(Q_WS_MACX) 717 #elif defined(Q_WS_X11) 721 if( !g_bInitializedMods )
725 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
726 if( mod & g_rgModInfo[i].mod ) {
727 if( !g_rgModInfo[i].modX ) {
728 kdDebug(125) <<
"Invalid modifier flag." <<
endl;
732 modX |= g_rgModInfo[i].modX;
743 if( !g_bInitializedMods )
747 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
748 if( modX & g_rgModInfo[i].modX ) {
749 if( !g_rgModInfo[i].modQt ) {
753 modQt |= g_rgModInfo[i].modQt;
761 if( !g_bInitializedMods )
765 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
766 if( modX & g_rgModInfo[i].modX )
767 mod |= g_rgModInfo[i].mod;
772 bool codeXToSym( uchar codeX, uint modX, uint& sym )
775 XKeyPressedEvent
event;
777 event.type = KeyPress;
778 event.display = qt_xdisplay();
780 event.keycode = codeX;
783 XLookupString( &event, buffer, 63, &keySym, NULL );
789 static TQString modToString( uint mod,
bool bUserSpace )
791 if( bUserSpace && !g_bInitializedKKeyLabels )
792 intializeKKeyLabels();
795 for(
int i = KKey::MOD_FLAG_COUNT-1; i >= 0; i-- ) {
796 if( mod & g_rgModInfo[i].mod ) {
800 ? g_rgModInfo[i].sLabel
801 : TQString(g_rgModInfo[i].psName);
807 TQString modToStringInternal( uint mod ) {
return modToString( mod,
false ); }
808 TQString
modToStringUser( uint mod ) {
return modToString( mod,
true ); }
812 if( !g_bInitializedKKeyLabels )
813 intializeKKeyLabels();
816 for(
int i = KKey::MOD_FLAG_COUNT-1; i >= 0; i-- ) {
817 if( mod.lower() == g_rgModInfo[i].sLabel.lower())
818 return g_rgModInfo[i].mod;
942 m_code = CODE_FOR_QT;
953 if( m_code == CODE_FOR_QT )
954 return KKey( keyCodeQt() );
956 #if defined(Q_WS_WIN) || defined(Q_WS_MACX) 961 return KKey( m_sym, mod );
968 m_code = key.
code(); m_mod = key.
mod(); m_sym = key.
sym();
974 if( m_code == CODE_FOR_QT )
975 return m_sym - b.m_sym;
976 if( m_sym != b.m_sym )
return m_sym - b.m_sym;
977 if( m_mod != b.m_mod )
return m_mod - b.m_mod;
978 return m_code - b.m_code;
986 void Variations::init(
const KKey& key,
bool bQt )
995 uint symVar = Sym(key.sym()).getSymVariation();
997 uint modReq = Sym(m_rgkey[0].sym()).getModsRequired();
998 uint modReqVar = Sym(symVar).getModsRequired();
1001 if( (key.modFlags() & modReq) == (key.modFlags() & modReqVar) ) {
1008 uint nVariations = 0;
1009 for( uint i = 0; i < m_nVariations; i++ ) {
1010 int keyQt =
KKeyNative( m_rgkey[i].code(), m_rgkey[i].mod(), m_rgkey[i].sym() ).
keyCodeQt();
1012 m_rgkey[nVariations++].setKeycodeQt( keyQt );
1015 m_nVariations = nVariations;
1019 for( uint i = 1; i < m_nVariations; i++ ) {
1020 for( uint j = 0; j < i; j++ ) {
1022 if( m_rgkey[i].keyCodeQt() == m_rgkey[j].keyCodeQt() ) {
1023 for( uint k = i; k < m_nVariations - 1; k++ ) {
1024 m_rgkey[k].setKeycodeQt( m_rgkey[k+1].keyCodeQt() );
1043 void KKey::simplify()
1046 if( m_sym == XK_Sys_Req ) {
1049 }
else if( m_sym == XK_ISO_Left_Tab ) {
1058 if( m_sym < 0x3000 && TQChar(m_sym).isLetter() ) {
1059 m_sym = TQChar(m_sym).lower().unicode();
1064 m_mod &= ~
KKeyServer::Sym(m_sym).getModsRequired();
1068 #endif //Q_WS_X11 || Q_WS_WIN ModFlag
Flags to represent the modifiers.
int event(const TQString &message, const TQString &text=TQString::null) KDE_DEPRECATED
bool codeXToSym(uchar codeX, uint modX, uint &symX)
Converts a X11 key code and a mask of ORed X11 modifiers into a X11 symbol.
KKey key() const
Converts this Key to a KKey.
Key & operator=(const KKeyNative &key)
Initializes this key with a KKeyNative.
uint getModsRequired() const
Returns the mods that are required for this symbol as ORed KKey::ModFlag's.
A collection of functions for the conversion of key presses and their modifiers from the window syste...
bool symToKeyQt(uint sym, int &keyQt)
Converts the given symbol to a Qt key code.
uint modXNumLock()
Returns the X11 NumLock modifier mask/flag.
uint modXScrollLock()
Returns the X11 ScrollLock modifier mask/flag.
uint modXAlt()
Returns the X11 Alt (Mod1) modifier mask/flag.
uint modXModeSwitch()
Returns the X11 Mode_switch modifier mask/flag.
uint modXShift()
Returns the X11 Shift modifier mask/flag.
TQString toString() const
Returns the string representation of the symbol.
bool isNull() const
Returns true if the key is null (after clear() or empty constructor).
bool keyboardHasWinKey()
Returns true if the current keyboard layout supports the Win key.
TQString readEntry(const TQString &pKey, const TQString &aDefault=TQString::null) const
Reads the value of an entry specified by pKey in the current group.
bool init(const TQString &s)
Initializes the key with the given string description.
bool keyQtToMod(int keyQt, uint &mod)
Extracts the modifiers from the given Qt key and converts them in a mask of ORed KKey::ModFlag modifi...
int keyCodeQt() const
Returns the qt key code.
uint mod() const
The native modifier flags of the key.
bool initializeMods()
TODO: please document.
uint code() const
The native keycode of the key.
bool modToModQt(uint mod, int &modQt)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed Qt key code modifiers.
uint modX(KKey::ModFlag modFlag)
Returns the equivalent X modifier mask of the given modifier flag.
Helper class to facilitate working with KConfig / KSimpleConfig groups.
bool modXToMod(uint modX, uint &mod)
Converts the mask of ORed X11 modifiers to a mask of ORed KKey::ModFlag modifiers.
uint modXWin()
Returns the X11 Win (Mod3) modifier mask/flag.
int qt() const
Returns the qt key code of the symbol.
uint modXLock()
Returns the X11 Lock modifier mask/flag.
int qtButtonStateToMod(TQ_ButtonState s)
Converts the Qt-compatible button state to x11 modifier.
bool modToModX(uint mod, uint &modX)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed X11 modifiers.
Representation of a key in the format native of the windowing system (eg.
bool initQt(int keyQt)
Initializes the symbol with the given Qt key code.
bool init(const KKey &key, bool bQt)
Initializes the key with a KKey.
uint stringUserToMod(const TQString &mod)
Converts the modifier given as user-readable string to KKey::ModFlag modifier, or 0...
TQString modToStringUser(uint mod)
Converts the mask of ORed KKey::ModFlag modifiers to a user-readable string.
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
int keyCodeQt() const
Returns the qt key code.
bool modXToModQt(uint modX, int &modQt)
Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.
uint modXCtrl()
Returns the X11 Ctrl modifier mask/flag.
kndbgstream & endl(kndbgstream &s)
Does nothing.
uint sym() const
The native symbol (KeySym) of the key.
uint getSymVariation() const
TODO: please find out what this method does and document it.
int compare(const Key &key) const
Compares this key with the given Key object.
uint accelModMaskX()
Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).
static KConfig * config()
Returns the general config object.
bool keyQtToSym(int keyQt, uint &sym)
Extracts the symbol from the given Qt key and converts it to a symbol.