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 "tdeshortcut.h" 34 #include <tdeconfig.h> 36 #include <tdeglobal.h> 40 # define XK_MISCELLANY 43 # include <X11/Xlib.h> 44 # include <X11/Xutil.h> 45 # include <X11/XKBlib.h> 46 # include <X11/keysymdef.h> 47 # define X11_ONLY(arg) arg, //allows to omit an argument 50 # define X11_ONLY(arg) 51 # define XK_ISO_Left_Tab Qt::Key_Backtab 52 # define XK_BackSpace Qt::Key_Backspace 53 # define XK_Sys_Req Qt::Key_SysReq 54 # define XK_Caps_Lock Qt::Key_CapsLock 55 # define XK_Num_Lock Qt::Key_NumLock 56 # define XK_Scroll_Lock Qt::Key_ScrollLock 57 # define XK_Prior Qt::Key_Prior 58 # define XK_Next Qt::Key_Next 90 uint sym, symVariation;
109 static ModInfo g_rgModInfo[KKey::MOD_FLAG_COUNT] =
111 { KKey::SHIFT, Qt::SHIFT, X11_ONLY(ShiftMask) I18N_NOOP("Shift"), TQString() },
112 { KKey::CTRL, Qt::CTRL, X11_ONLY(ControlMask) I18N_NOOP("Ctrl"), TQString() },
113 { KKey::ALT, Qt::ALT, X11_ONLY(Mod1Mask) I18N_NOOP("Alt"), TQString() },
114 { KKey::WIN, KKey::QtWIN, X11_ONLY(Mod4Mask) I18N_NOOP("Win"), TQString() }
118 static const SymName g_rgSymNames[] = {
119 { XK_ISO_Left_Tab,
"Backtab" },
120 { XK_BackSpace, I18N_NOOP(
"Backspace") },
121 { XK_Sys_Req, I18N_NOOP(
"SysReq") },
122 { XK_Caps_Lock, I18N_NOOP(
"CapsLock") },
123 { XK_Num_Lock, I18N_NOOP(
"NumLock") },
124 { XK_Scroll_Lock, I18N_NOOP(
"ScrollLock") },
125 { XK_Prior, I18N_NOOP(
"PageUp") },
126 { XK_Next, I18N_NOOP(
"PageDown") },
128 { XK_F11, I18N_NOOP(
"Stop") },
129 { XK_F12, I18N_NOOP(
"Again") },
130 { XK_F13, I18N_NOOP(
"Props") },
131 { XK_F14, I18N_NOOP(
"Undo") },
132 { XK_F15, I18N_NOOP(
"Front") },
133 { XK_F16, I18N_NOOP(
"Copy") },
134 { XK_F17, I18N_NOOP(
"Open") },
135 { XK_F18, I18N_NOOP(
"Paste") },
136 { XK_F19, I18N_NOOP(
"Find") },
137 { XK_F20, I18N_NOOP(
"Cut") },
138 { XK_F22, I18N_NOOP(
"Print") },
144 static SymVariation g_rgSymVariation[] =
146 {
'/', XK_KP_Divide,
false },
147 {
'*', XK_KP_Multiply,
false },
148 {
'-', XK_KP_Subtract,
false },
149 {
'+', XK_KP_Add,
false },
150 { XK_Return, XK_KP_Enter,
false },
157 static const TransKey g_rgQtToSymX[] =
159 { Qt::Key_Escape, XK_Escape },
160 { Qt::Key_Tab, XK_Tab },
161 { Qt::Key_Backtab, XK_ISO_Left_Tab },
162 { Qt::Key_Backspace, XK_BackSpace },
163 { Qt::Key_Return, XK_Return },
164 { Qt::Key_Enter, XK_KP_Enter },
165 { Qt::Key_Insert, XK_Insert },
166 { Qt::Key_Delete, XK_Delete },
167 { Qt::Key_Pause, XK_Pause },
169 { Qt::Key_Print, XK_F22 },
171 { Qt::Key_Print, XK_Print },
173 { Qt::Key_SysReq, XK_Sys_Req },
174 { Qt::Key_Home, XK_Home },
175 { Qt::Key_End, XK_End },
176 { Qt::Key_Left, XK_Left },
177 { Qt::Key_Up, XK_Up },
178 { Qt::Key_Right, XK_Right },
179 { Qt::Key_Down, XK_Down },
180 { TQt::Key_Prior, XK_Prior },
181 { TQt::Key_Next, XK_Next },
186 { Qt::Key_CapsLock, XK_Caps_Lock },
187 { Qt::Key_NumLock, XK_Num_Lock },
188 { Qt::Key_ScrollLock, XK_Scroll_Lock },
189 { Qt::Key_F1, XK_F1 },
190 { Qt::Key_F2, XK_F2 },
191 { Qt::Key_F3, XK_F3 },
192 { Qt::Key_F4, XK_F4 },
193 { Qt::Key_F5, XK_F5 },
194 { Qt::Key_F6, XK_F6 },
195 { Qt::Key_F7, XK_F7 },
196 { Qt::Key_F8, XK_F8 },
197 { Qt::Key_F9, XK_F9 },
198 { Qt::Key_F10, XK_F10 },
199 { Qt::Key_F11, XK_F11 },
200 { Qt::Key_F12, XK_F12 },
201 { Qt::Key_F13, XK_F13 },
202 { Qt::Key_F14, XK_F14 },
203 { Qt::Key_F15, XK_F15 },
204 { Qt::Key_F16, XK_F16 },
205 { Qt::Key_F17, XK_F17 },
206 { Qt::Key_F18, XK_F18 },
207 { Qt::Key_F19, XK_F19 },
208 { Qt::Key_F20, XK_F20 },
209 { Qt::Key_F21, XK_F21 },
210 { Qt::Key_F22, XK_F22 },
211 { Qt::Key_F23, XK_F23 },
212 { Qt::Key_F24, XK_F24 },
213 { Qt::Key_F25, XK_F25 },
214 { Qt::Key_F26, XK_F26 },
215 { Qt::Key_F27, XK_F27 },
216 { Qt::Key_F28, XK_F28 },
217 { Qt::Key_F29, XK_F29 },
218 { Qt::Key_F30, XK_F30 },
219 { Qt::Key_F31, XK_F31 },
220 { Qt::Key_F32, XK_F32 },
221 { Qt::Key_F33, XK_F33 },
222 { Qt::Key_F34, XK_F34 },
223 { Qt::Key_F35, XK_F35 },
224 { Qt::Key_Super_L, XK_Super_L },
225 { Qt::Key_Super_R, XK_Super_R },
226 { Qt::Key_Menu, XK_Menu },
227 { Qt::Key_Hyper_L, XK_Hyper_L },
228 { Qt::Key_Hyper_R, XK_Hyper_R },
229 { Qt::Key_Help, XK_Help },
233 {
'/', XK_KP_Divide },
234 {
'*', XK_KP_Multiply },
235 {
'-', XK_KP_Subtract },
237 { Qt::Key_Return, XK_KP_Enter }
238 #if TQT_VERSION >= 0x030100 242 #define XF86XK_Standby 0x1008FF10 243 #define XF86XK_AudioLowerVolume 0x1008FF11 244 #define XF86XK_AudioMute 0x1008FF12 245 #define XF86XK_AudioRaiseVolume 0x1008FF13 246 #define XF86XK_AudioPlay 0x1008FF14 247 #define XF86XK_AudioStop 0x1008FF15 248 #define XF86XK_AudioPrev 0x1008FF16 249 #define XF86XK_AudioNext 0x1008FF17 250 #define XF86XK_HomePage 0x1008FF18 251 #define XF86XK_Calculator 0x1008FF1D 252 #define XF86XK_Mail 0x1008FF19 253 #define XF86XK_Start 0x1008FF1A 254 #define XF86XK_Search 0x1008FF1B 255 #define XF86XK_AudioRecord 0x1008FF1C 256 #define XF86XK_Back 0x1008FF26 257 #define XF86XK_Forward 0x1008FF27 258 #define XF86XK_Stop 0x1008FF28 259 #define XF86XK_Refresh 0x1008FF29 260 #define XF86XK_Favorites 0x1008FF30 261 #define XF86XK_AudioPause 0x1008FF31 262 #define XF86XK_AudioMedia 0x1008FF32 263 #define XF86XK_MyComputer 0x1008FF33 264 #define XF86XK_OpenURL 0x1008FF38 265 #define XF86XK_Launch0 0x1008FF40 266 #define XF86XK_Launch1 0x1008FF41 267 #define XF86XK_Launch2 0x1008FF42 268 #define XF86XK_Launch3 0x1008FF43 269 #define XF86XK_Launch4 0x1008FF44 270 #define XF86XK_Launch5 0x1008FF45 271 #define XF86XK_Launch6 0x1008FF46 272 #define XF86XK_Launch7 0x1008FF47 273 #define XF86XK_Launch8 0x1008FF48 274 #define XF86XK_Launch9 0x1008FF49 275 #define XF86XK_LaunchA 0x1008FF4A 276 #define XF86XK_LaunchB 0x1008FF4B 277 #define XF86XK_LaunchC 0x1008FF4C 278 #define XF86XK_LaunchD 0x1008FF4D 279 #define XF86XK_LaunchE 0x1008FF4E 280 #define XF86XK_LaunchF 0x1008FF4F 283 { Qt::Key_Standby, XF86XK_Standby },
284 { Qt::Key_VolumeDown, XF86XK_AudioLowerVolume },
285 { Qt::Key_VolumeMute, XF86XK_AudioMute },
286 { Qt::Key_VolumeUp, XF86XK_AudioRaiseVolume },
287 { Qt::Key_MediaPlay, XF86XK_AudioPlay },
288 { Qt::Key_MediaStop, XF86XK_AudioStop },
289 { TQt::Key_MediaPrev, XF86XK_AudioPrev },
290 { Qt::Key_MediaNext, XF86XK_AudioNext },
291 { Qt::Key_HomePage, XF86XK_HomePage },
292 { Qt::Key_LaunchMail, XF86XK_Mail },
293 { Qt::Key_Search, XF86XK_Search },
294 { Qt::Key_MediaRecord, XF86XK_AudioRecord },
295 { Qt::Key_LaunchMedia, XF86XK_AudioMedia },
296 { Qt::Key_Launch1, XF86XK_Calculator },
297 { Qt::Key_Back, XF86XK_Back },
298 { Qt::Key_Forward, XF86XK_Forward },
299 { Qt::Key_Stop, XF86XK_Stop },
300 { Qt::Key_Refresh, XF86XK_Refresh },
301 { Qt::Key_Favorites, XF86XK_Favorites },
302 { Qt::Key_Launch0, XF86XK_MyComputer },
303 { Qt::Key_OpenUrl, XF86XK_OpenURL },
304 { Qt::Key_Launch2, XF86XK_Launch0 },
305 { Qt::Key_Launch3, XF86XK_Launch1 },
306 { Qt::Key_Launch4, XF86XK_Launch2 },
307 { Qt::Key_Launch5, XF86XK_Launch3 },
308 { Qt::Key_Launch6, XF86XK_Launch4 },
309 { Qt::Key_Launch7, XF86XK_Launch5 },
310 { Qt::Key_Launch8, XF86XK_Launch6 },
311 { Qt::Key_Launch9, XF86XK_Launch7 },
312 { Qt::Key_LaunchA, XF86XK_Launch8 },
313 { Qt::Key_LaunchB, XF86XK_Launch9 },
314 { Qt::Key_LaunchC, XF86XK_LaunchA },
315 { Qt::Key_LaunchD, XF86XK_LaunchB },
316 { Qt::Key_LaunchE, XF86XK_LaunchC },
317 { Qt::Key_LaunchF, XF86XK_LaunchD },
325 static bool g_bInitializedMods, g_bInitializedVariations, g_bInitializedKKeyLabels;
326 static bool g_bMacLabels;
328 static uint g_modXNumLock, g_modXScrollLock, g_modXModeSwitch;
332 XModifierKeymap* xmk = XGetModifierMapping( tqt_xdisplay() );
334 g_rgModInfo[3].modX = g_modXNumLock = g_modXScrollLock = g_modXModeSwitch = 0;
336 int min_keycode, max_keycode;
337 int keysyms_per_keycode = 0;
338 XDisplayKeycodes( tqt_xdisplay(), &min_keycode, &max_keycode );
339 XFree( XGetKeyboardMapping( tqt_xdisplay(), min_keycode, 1, &keysyms_per_keycode ));
341 for(
int i = Mod2MapIndex; i < 8; i++ ) {
342 uint mask = (1 << i);
343 uint keySymX = NoSymbol;
348 for(
int j = 0; j < xmk->max_keypermod && keySymX == NoSymbol; ++j )
349 for(
int k = 0; k < keysyms_per_keycode && keySymX == NoSymbol; ++k )
350 keySymX = XkbKeycodeToKeysym( tqt_xdisplay(), xmk->modifiermap[xmk->max_keypermod * i + j], 0, k );
352 case XK_Num_Lock: g_modXNumLock = mask;
break;
354 case XK_Super_R: g_rgModInfo[3].modX = mask;
break;
356 case XK_Meta_R:
if( !g_rgModInfo[3].
modX ) g_rgModInfo[3].modX = mask;
break;
357 case XK_Scroll_Lock: g_modXScrollLock = mask;
break;
358 case XK_Mode_switch: g_modXModeSwitch = mask;
break;
362 XFreeModifiermap( xmk );
367 g_bInitializedMods =
true;
369 kdDebug(125) <<
"KKeyServer::initializeMods(): Win Mod = 0x" << TQString::number(g_rgModInfo[3].
modX, 16) <<
endl;
373 static void initializeVariations()
375 for(
int i = 0; g_rgSymVariation[i].sym != 0; i++ )
376 g_rgSymVariation[i].bActive = (XKeysymToKeycode( tqt_xdisplay(), g_rgSymVariation[i].symVariation ) != 0);
377 g_bInitializedVariations =
true;
381 static void intializeKKeyLabels()
388 g_bMacLabels = (g_rgModInfo[2].sLabel ==
"Command");
389 g_bInitializedKKeyLabels =
true;
407 int symQt = keyQt & 0xffff;
409 if( (keyQt & Qt::UNICODE_ACCEL) || symQt < 0x1000 ) {
410 m_sym = TQChar(symQt).lower().unicode();
417 #elif defined(Q_WS_X11) 418 for( uint i = 0; i <
sizeof(g_rgQtToSymX)/
sizeof(TransKey); i++ ) {
419 if( g_rgQtToSymX[i].keySymQt == symQt ) {
420 m_sym = g_rgQtToSymX[i].keySymX;
426 if( symQt != Qt::Key_Shift && symQt != Qt::Key_Control && symQt != Qt::Key_Alt &&
427 symQt != Qt::Key_Meta && symQt != Qt::Key_Direction_L && symQt != Qt::Key_Direction_R )
428 kdDebug(125) <<
"Sym::initQt( " << TQString::number(keyQt,16) <<
" ): failed to convert key." <<
endl;
430 #elif defined(Q_WS_MACX) 439 if( s.length() == 1 ) {
440 m_sym = s[0].lower().unicode();
445 for(
int i = 0; g_rgSymNames[i].sym != 0; i++ ) {
446 if( tqstricmp( s.latin1(), g_rgSymNames[i].psName ) == 0 ) {
447 m_sym = g_rgSymNames[i].sym;
454 for ( KKeys
const *pKey = kde_KKEYS; pKey->code != 0xffff; pKey++) {
455 if( tqstricmp( s.latin1(), pKey->name ) == 0 ) {
461 #elif defined(Q_WS_X11) 463 m_sym = XStringToKeysym( s.latin1() );
465 m_sym = XStringToKeysym( s.lower().latin1() );
468 s2[0] = s2[0].upper();
469 m_sym = XStringToKeysym( s2.latin1() );
478 if( m_sym < 0x1000 ) {
479 if( m_sym >=
'a' && m_sym <=
'z' )
480 return TQChar(m_sym).upper();
486 #elif defined(Q_WS_X11) 488 return m_sym | Qt::UNICODE_ACCEL;
490 for( uint i = 0; i <
sizeof(g_rgQtToSymX)/
sizeof(TransKey); i++ )
491 if( g_rgQtToSymX[i].keySymX == m_sym )
492 return g_rgQtToSymX[i].keySymQt;
494 return TQt::Key_unknown;
500 return TQString::null;
505 else if( m_sym < 0x1000 ) {
507 else if( m_sym < 0x3000 ) {
509 TQChar c = TQChar(m_sym).upper();
512 if( (c.latin1() && c.isLetterOrNumber())
513 || (bUserSpace && !c.isSpace()) ) {
519 for(
int i = 0; g_rgSymNames[i].sym != 0; i++ ) {
520 if( m_sym == g_rgSymNames[i].sym ) {
521 return bUserSpace ? i18n(g_rgSymNames[i].psName) : TQString(g_rgSymNames[i].psName);
527 s = TQKeySequence( m_sym );
528 #elif defined(Q_WS_X11) 530 s = XKeysymToString( m_sym );
532 capitalizeKeyname( s );
533 return bUserSpace ? i18n(
"TQAccel", s.latin1()) : s;
536 TQString Sym::toStringInternal()
const {
return toString(
false ); }
544 if( m_sym == XK_Sys_Req )
return KKey::ALT;
545 if( m_sym == XK_Break )
return KKey::CTRL;
547 if( m_sym < 0x3000 ) {
549 if( c.isLetter() && c.lower() != c.upper() && m_sym == c.upper().unicode() )
553 uchar code = XKeysymToKeycode( tqt_xdisplay(), m_sym );
558 if( m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 0 ) )
560 else if( m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 1 ) )
562 else if( m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 2 ) )
563 mod = KKeyServer::MODE_SWITCH;
564 else if( m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 3 ) )
565 mod = KKey::SHIFT | KKeyServer::MODE_SWITCH;
574 if( !g_bInitializedVariations )
575 initializeVariations();
576 for(
int i = 0; g_rgSymVariation[i].sym != 0; i++ )
577 if( g_rgSymVariation[i].sym == m_sym && g_rgSymVariation[i].bActive )
578 return g_rgSymVariation[i].symVariation;
583 void Sym::capitalizeKeyname( TQString& s )
586 int len = s.length();
587 if( s.endsWith(
"left" ) ) s[len-4] =
'L';
588 else if( s.endsWith(
"right" ) ) s[len-5] =
'R';
589 else if( s ==
"Sysreq" ) s[len-3] =
'R';
599 if( mod == KKey::WIN && !g_bInitializedMods )
602 for( uint i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
603 if( g_rgModInfo[i].mod == mod )
604 return g_rgModInfo[i].modX;
611 uint
modXLock() {
return LockMask; }
612 uint
modXCtrl() {
return ControlMask; }
613 uint
modXAlt() {
return Mod1Mask; }
621 if( !g_bInitializedMods )
623 return ShiftMask | ControlMask | Mod1Mask | g_rgModInfo[3].modX;
630 if( sym.initQt( keyQt ) ) {
641 if( keyQt & Qt::SHIFT ) mod |= KKey::SHIFT;
642 if( keyQt & Qt::CTRL ) mod |= KKey::CTRL;
643 if( keyQt & Qt::ALT ) mod |= KKey::ALT;
644 if( keyQt & Qt::META ) mod |= KKey::WIN;
653 return (keyQt != TQt::Key_unknown);
659 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
660 if( mod & g_rgModInfo[i].mod ) {
661 if( !g_rgModInfo[i].modQt ) {
665 modQt |= g_rgModInfo[i].modQt;
681 if (s & Qt::ShiftButton) modQt |= KKey::SHIFT;
682 if (s & Qt::ControlButton) modQt |= KKey::CTRL;
683 if (s & Qt::AltButton) modQt |= KKey::ALT;
692 #elif defined(Q_WS_MACX) 708 #elif defined(Q_WS_X11) 712 if( !g_bInitializedMods )
716 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
717 if( mod & g_rgModInfo[i].mod ) {
718 if( !g_rgModInfo[i].modX ) {
719 kdDebug(125) <<
"Invalid modifier flag." <<
endl;
723 modX |= g_rgModInfo[i].modX;
734 if( !g_bInitializedMods )
738 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
739 if( modX & g_rgModInfo[i].modX ) {
740 if( !g_rgModInfo[i].modQt ) {
744 modQt |= g_rgModInfo[i].modQt;
752 if( !g_bInitializedMods )
756 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
757 if( modX & g_rgModInfo[i].modX )
758 mod |= g_rgModInfo[i].mod;
763 bool codeXToSym( uchar codeX, uint modX, uint& sym )
766 XKeyPressedEvent
event;
768 event.type = KeyPress;
769 event.display = tqt_xdisplay();
771 event.keycode = codeX;
774 XLookupString( &event, buffer, 63, &keySym, NULL );
780 static TQString modToString( uint mod,
bool bUserSpace )
782 if( bUserSpace && !g_bInitializedKKeyLabels )
783 intializeKKeyLabels();
786 for(
int i = KKey::MOD_FLAG_COUNT-1; i >= 0; i-- ) {
787 if( mod & g_rgModInfo[i].mod ) {
791 ? g_rgModInfo[i].sLabel
792 : TQString(g_rgModInfo[i].psName);
798 TQString modToStringInternal( uint mod ) {
return modToString( mod,
false ); }
799 TQString
modToStringUser( uint mod ) {
return modToString( mod,
true ); }
803 if( !g_bInitializedKKeyLabels )
804 intializeKKeyLabels();
807 for(
int i = KKey::MOD_FLAG_COUNT-1; i >= 0; i-- ) {
808 if( mod.lower() == g_rgModInfo[i].sLabel.lower())
809 return g_rgModInfo[i].mod;
933 m_code = CODE_FOR_QT;
944 if( m_code == CODE_FOR_QT )
945 return KKey( keyCodeQt() );
947 #if defined(Q_WS_WIN) || defined(Q_WS_MACX) 952 return KKey( m_sym, mod );
959 m_code = key.
code(); m_mod = key.
mod(); m_sym = key.
sym();
965 if( m_code == CODE_FOR_QT )
966 return m_sym - b.m_sym;
967 if( m_sym != b.m_sym )
return m_sym - b.m_sym;
968 if( m_mod != b.m_mod )
return m_mod - b.m_mod;
969 return m_code - b.m_code;
977 void Variations::init(
const KKey& key,
bool bQt )
986 uint symVar = Sym(key.sym()).getSymVariation();
988 uint modReq = Sym(m_rgkey[0].sym()).getModsRequired();
989 uint modReqVar = Sym(symVar).getModsRequired();
992 if( (key.modFlags() & modReq) == (key.modFlags() & modReqVar) ) {
999 uint nVariations = 0;
1000 for( uint i = 0; i < m_nVariations; i++ ) {
1001 int keyQt =
KKeyNative( m_rgkey[i].code(), m_rgkey[i].mod(), m_rgkey[i].sym() ).
keyCodeQt();
1003 m_rgkey[nVariations++].setKeycodeQt( keyQt );
1006 m_nVariations = nVariations;
1010 for( uint i = 1; i < m_nVariations; i++ ) {
1011 for( uint j = 0; j < i; j++ ) {
1013 if( m_rgkey[i].keyCodeQt() == m_rgkey[j].keyCodeQt() ) {
1014 for( uint k = i; k < m_nVariations - 1; k++ ) {
1015 m_rgkey[k].setKeycodeQt( m_rgkey[k+1].keyCodeQt() );
1034 void KKey::simplify()
1037 if( m_sym == XK_Sys_Req ) {
1040 }
else if( m_sym == XK_ISO_Left_Tab ) {
1049 if( m_sym < 0x3000 && TQChar(m_sym).isLetter() ) {
1050 m_sym = TQChar(m_sym).lower().unicode();
1055 m_mod &= ~
KKeyServer::Sym(m_sym).getModsRequired();
1059 #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.
Helper class to facilitate working with TDEConfig / KSimpleConfig groups.
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.
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.
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.
static TDEConfig * config()
Returns the general config object.
kndbgstream & endl(kndbgstream &s)
Does nothing.
uint sym() const
The native symbol (KeySym) of the 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.
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).
bool keyQtToSym(int keyQt, uint &sym)
Extracts the symbol from the given Qt key and converts it to a symbol.