25 #include <tqnamespace.h>
26 #include <tqwindowdefs.h>
28 #if defined(TQ_WS_X11) || defined(TQ_WS_WIN) || defined(TQ_WS_MACX)
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,
50 # define X11_ONLY(arg)
51 # define XK_ISO_Left_Tab TQt::Key_Backtab
52 # define XK_BackSpace TQt::Key_Backspace
53 # define XK_Sys_Req TQt::Key_SysReq
54 # define XK_Caps_Lock TQt::Key_CapsLock
55 # define XK_Num_Lock TQt::Key_NumLock
56 # define XK_Scroll_Lock TQt::Key_ScrollLock
57 # define XK_Prior TQt::Key_Prior
58 # define XK_Next TQt::Key_Next
90 uint sym, symVariation;
109 static ModInfo g_rgModInfo[KKey::MOD_FLAG_COUNT] =
111 { KKey::SHIFT, TQt::SHIFT, X11_ONLY(ShiftMask) I18N_NOOP(
"Shift"), TQString() },
112 { KKey::CTRL, TQt::CTRL, X11_ONLY(ControlMask) I18N_NOOP(
"Ctrl"), TQString() },
113 { KKey::ALT, TQt::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 { TQt::Key_Escape, XK_Escape },
160 { TQt::Key_Tab, XK_Tab },
161 { TQt::Key_Backtab, XK_ISO_Left_Tab },
162 { TQt::Key_Backspace, XK_BackSpace },
163 { TQt::Key_Return, XK_Return },
164 { TQt::Key_Enter, XK_KP_Enter },
165 { TQt::Key_Insert, XK_Insert },
166 { TQt::Key_Delete, XK_Delete },
167 { TQt::Key_Pause, XK_Pause },
169 { TQt::Key_Print, XK_F22 },
171 { TQt::Key_Print, XK_Print },
173 { TQt::Key_SysReq, XK_Sys_Req },
174 { TQt::Key_Home, XK_Home },
175 { TQt::Key_End, XK_End },
176 { TQt::Key_Left, XK_Left },
177 { TQt::Key_Up, XK_Up },
178 { TQt::Key_Right, XK_Right },
179 { TQt::Key_Down, XK_Down },
180 { TQt::Key_Prior, XK_Prior },
181 { TQt::Key_Next, XK_Next },
186 { TQt::Key_CapsLock, XK_Caps_Lock },
187 { TQt::Key_NumLock, XK_Num_Lock },
188 { TQt::Key_ScrollLock, XK_Scroll_Lock },
189 { TQt::Key_F1, XK_F1 },
190 { TQt::Key_F2, XK_F2 },
191 { TQt::Key_F3, XK_F3 },
192 { TQt::Key_F4, XK_F4 },
193 { TQt::Key_F5, XK_F5 },
194 { TQt::Key_F6, XK_F6 },
195 { TQt::Key_F7, XK_F7 },
196 { TQt::Key_F8, XK_F8 },
197 { TQt::Key_F9, XK_F9 },
198 { TQt::Key_F10, XK_F10 },
199 { TQt::Key_F11, XK_F11 },
200 { TQt::Key_F12, XK_F12 },
201 { TQt::Key_F13, XK_F13 },
202 { TQt::Key_F14, XK_F14 },
203 { TQt::Key_F15, XK_F15 },
204 { TQt::Key_F16, XK_F16 },
205 { TQt::Key_F17, XK_F17 },
206 { TQt::Key_F18, XK_F18 },
207 { TQt::Key_F19, XK_F19 },
208 { TQt::Key_F20, XK_F20 },
209 { TQt::Key_F21, XK_F21 },
210 { TQt::Key_F22, XK_F22 },
211 { TQt::Key_F23, XK_F23 },
212 { TQt::Key_F24, XK_F24 },
213 { TQt::Key_F25, XK_F25 },
214 { TQt::Key_F26, XK_F26 },
215 { TQt::Key_F27, XK_F27 },
216 { TQt::Key_F28, XK_F28 },
217 { TQt::Key_F29, XK_F29 },
218 { TQt::Key_F30, XK_F30 },
219 { TQt::Key_F31, XK_F31 },
220 { TQt::Key_F32, XK_F32 },
221 { TQt::Key_F33, XK_F33 },
222 { TQt::Key_F34, XK_F34 },
223 { TQt::Key_F35, XK_F35 },
224 { TQt::Key_Super_L, XK_Super_L },
225 { TQt::Key_Super_R, XK_Super_R },
226 { TQt::Key_Menu, XK_Menu },
227 { TQt::Key_Hyper_L, XK_Hyper_L },
228 { TQt::Key_Hyper_R, XK_Hyper_R },
229 { TQt::Key_Help, XK_Help },
233 {
'/', XK_KP_Divide },
234 {
'*', XK_KP_Multiply },
235 {
'-', XK_KP_Subtract },
237 { TQt::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
281 #define XF86XK_MonBrightnessUp 0x1008FF02
282 #define XF86XK_MonBrightnessDown 0x1008FF03
283 #define XF86XK_KbdLightOnOff 0x1008FF04
284 #define XF86XK_KbdBrightnessUp 0x1008FF05
285 #define XF86XK_KbdBrightnessDown 0x1008FF06
288 { TQt::Key_Standby, XF86XK_Standby },
289 { TQt::Key_VolumeDown, XF86XK_AudioLowerVolume },
290 { TQt::Key_VolumeMute, XF86XK_AudioMute },
291 { TQt::Key_VolumeUp, XF86XK_AudioRaiseVolume },
292 { TQt::Key_MediaPlay, XF86XK_AudioPlay },
293 { TQt::Key_MediaStop, XF86XK_AudioStop },
294 { TQt::Key_MediaPrev, XF86XK_AudioPrev },
295 { TQt::Key_MediaNext, XF86XK_AudioNext },
296 { TQt::Key_HomePage, XF86XK_HomePage },
297 { TQt::Key_LaunchMail, XF86XK_Mail },
298 { TQt::Key_Search, XF86XK_Search },
299 { TQt::Key_MediaRecord, XF86XK_AudioRecord },
300 { TQt::Key_LaunchMedia, XF86XK_AudioMedia },
301 { TQt::Key_Launch1, XF86XK_Calculator },
302 { TQt::Key_Back, XF86XK_Back },
303 { TQt::Key_Forward, XF86XK_Forward },
304 { TQt::Key_Stop, XF86XK_Stop },
305 { TQt::Key_Refresh, XF86XK_Refresh },
306 { TQt::Key_Favorites, XF86XK_Favorites },
307 { TQt::Key_Launch0, XF86XK_MyComputer },
308 { TQt::Key_OpenUrl, XF86XK_OpenURL },
309 { TQt::Key_Launch2, XF86XK_Launch0 },
310 { TQt::Key_Launch3, XF86XK_Launch1 },
311 { TQt::Key_Launch4, XF86XK_Launch2 },
312 { TQt::Key_Launch5, XF86XK_Launch3 },
313 { TQt::Key_Launch6, XF86XK_Launch4 },
314 { TQt::Key_Launch7, XF86XK_Launch5 },
315 { TQt::Key_Launch8, XF86XK_Launch6 },
316 { TQt::Key_Launch9, XF86XK_Launch7 },
317 { TQt::Key_LaunchA, XF86XK_Launch8 },
318 { TQt::Key_LaunchB, XF86XK_Launch9 },
319 { TQt::Key_LaunchC, XF86XK_LaunchA },
320 { TQt::Key_LaunchD, XF86XK_LaunchB },
321 { TQt::Key_LaunchE, XF86XK_LaunchC },
322 { TQt::Key_LaunchF, XF86XK_LaunchD },
323 { TQt::Key_MonBrightnessUp, XF86XK_MonBrightnessUp },
324 { TQt::Key_MonBrightnessDown, XF86XK_MonBrightnessDown },
325 { TQt::Key_KeyboardLightOnOff, XF86XK_KbdLightOnOff },
326 { TQt::Key_KeyboardBrightnessUp, XF86XK_KbdBrightnessUp },
327 { TQt::Key_KeyboardBrightnessDown, XF86XK_KbdBrightnessDown },
335 static bool g_bInitializedMods, g_bInitializedVariations, g_bInitializedKKeyLabels;
336 static bool g_bMacLabels;
338 static uint g_modXNumLock, g_modXScrollLock, g_modXModeSwitch;
342 XModifierKeymap* xmk = XGetModifierMapping( tqt_xdisplay() );
344 g_rgModInfo[3].modX = g_modXNumLock = g_modXScrollLock = g_modXModeSwitch = 0;
346 int min_keycode, max_keycode;
347 int keysyms_per_keycode = 0;
348 XDisplayKeycodes( tqt_xdisplay(), &min_keycode, &max_keycode );
349 XFree( XGetKeyboardMapping( tqt_xdisplay(), min_keycode, 1, &keysyms_per_keycode ));
351 for(
int i = Mod2MapIndex; i < 8; i++ ) {
352 uint mask = (1 << i);
353 uint keySymX = NoSymbol;
358 for(
int j = 0; j < xmk->max_keypermod && keySymX == NoSymbol; ++j )
359 for(
int k = 0; k < keysyms_per_keycode && keySymX == NoSymbol; ++k )
360 keySymX = XkbKeycodeToKeysym( tqt_xdisplay(), xmk->modifiermap[xmk->max_keypermod * i + j], 0, k );
362 case XK_Num_Lock: g_modXNumLock = mask;
break;
364 case XK_Super_R: g_rgModInfo[3].modX = mask;
break;
366 case XK_Meta_R:
if( !g_rgModInfo[3].
modX ) g_rgModInfo[3].modX = mask;
break;
367 case XK_Scroll_Lock: g_modXScrollLock = mask;
break;
368 case XK_Mode_switch: g_modXModeSwitch = mask;
break;
372 XFreeModifiermap( xmk );
377 g_bInitializedMods =
true;
379 kdDebug(125) <<
"KKeyServer::initializeMods(): Win Mod = 0x" << TQString::number(g_rgModInfo[3].
modX, 16) <<
endl;
383 static void initializeVariations()
385 for(
int i = 0; g_rgSymVariation[i].sym != 0; i++ )
386 g_rgSymVariation[i].bActive = (XKeysymToKeycode( tqt_xdisplay(), g_rgSymVariation[i].symVariation ) != 0);
387 g_bInitializedVariations =
true;
391 static void intializeKKeyLabels()
398 g_bMacLabels = (g_rgModInfo[2].sLabel ==
"Command");
399 g_bInitializedKKeyLabels =
true;
417 int symQt = keyQt & 0xffff;
419 if( (keyQt & TQt::UNICODE_ACCEL) || symQt < 0x1000 ) {
420 m_sym = TQChar(symQt).lower().unicode();
427 #elif defined(TQ_WS_X11)
428 for( uint i = 0; i <
sizeof(g_rgQtToSymX)/
sizeof(TransKey); i++ ) {
429 if( g_rgQtToSymX[i].keySymQt == symQt ) {
430 m_sym = g_rgQtToSymX[i].keySymX;
436 if( symQt != TQt::Key_Shift && symQt != TQt::Key_Control && symQt != TQt::Key_Alt &&
437 symQt != TQt::Key_Meta && symQt != TQt::Key_Direction_L && symQt != TQt::Key_Direction_R )
438 kdDebug(125) <<
"Sym::initQt( " << TQString::number(keyQt,16) <<
" ): failed to convert key." <<
endl;
440 #elif defined(TQ_WS_MACX)
449 if( s.length() == 1 ) {
450 m_sym = s[0].lower().unicode();
455 for(
int i = 0; g_rgSymNames[i].sym != 0; i++ ) {
456 if( tqstricmp( s.latin1(), g_rgSymNames[i].psName ) == 0 ) {
457 m_sym = g_rgSymNames[i].sym;
464 for ( KKeys
const *pKey = kde_KKEYS; pKey->code != 0xffff; pKey++) {
465 if( tqstricmp( s.latin1(), pKey->name ) == 0 ) {
471 #elif defined(TQ_WS_X11)
473 m_sym = XStringToKeysym( s.latin1() );
475 m_sym = XStringToKeysym( s.lower().latin1() );
478 s2[0] = s2[0].upper();
479 m_sym = XStringToKeysym( s2.latin1() );
488 if(
m_sym < 0x1000 ) {
490 return TQChar(
m_sym).upper();
496 #elif defined(TQ_WS_X11)
498 return m_sym | TQt::UNICODE_ACCEL;
500 for( uint i = 0; i <
sizeof(g_rgQtToSymX)/
sizeof(TransKey); i++ )
501 if( g_rgQtToSymX[i].keySymX ==
m_sym )
502 return g_rgQtToSymX[i].keySymQt;
504 return TQt::Key_unknown;
510 return TQString::null;
515 else if(
m_sym < 0x1000 ) {
517 else if(
m_sym < 0x3000 ) {
519 TQChar c = TQChar(
m_sym).upper();
522 if( (c.latin1() && c.isLetterOrNumber())
523 || (bUserSpace && !c.isSpace()) ) {
529 for(
int i = 0; g_rgSymNames[i].sym != 0; i++ ) {
530 if(
m_sym == g_rgSymNames[i].sym ) {
531 return bUserSpace ? i18n(g_rgSymNames[i].psName) : TQString(g_rgSymNames[i].psName);
537 s = TQKeySequence(
m_sym );
538 #elif defined(TQ_WS_X11)
540 s = XKeysymToString(
m_sym );
542 capitalizeKeyname( s );
543 return bUserSpace ? i18n(
"TQAccel", s.latin1()) : s;
546 TQString Sym::toStringInternal()
const {
return toString(
false ); }
554 if(
m_sym == XK_Sys_Req )
return KKey::ALT;
555 if(
m_sym == XK_Break )
return KKey::CTRL;
557 if(
m_sym < 0x3000 ) {
559 if( c.isLetter() && c.lower() != c.upper() &&
m_sym == c.upper().unicode() )
563 uchar code = XKeysymToKeycode( tqt_xdisplay(),
m_sym );
568 if(
m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 0 ) )
570 else if(
m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 1 ) )
572 else if(
m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 2 ) )
573 mod = KKeyServer::MODE_SWITCH;
574 else if(
m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 3 ) )
575 mod = KKey::SHIFT | KKeyServer::MODE_SWITCH;
584 if( !g_bInitializedVariations )
585 initializeVariations();
586 for(
int i = 0; g_rgSymVariation[i].sym != 0; i++ )
587 if( g_rgSymVariation[i].sym ==
m_sym && g_rgSymVariation[i].bActive )
588 return g_rgSymVariation[i].symVariation;
593 void Sym::capitalizeKeyname( TQString& s )
596 int len = s.length();
597 if( s.endsWith(
"left" ) ) s[len-4] =
'L';
598 else if( s.endsWith(
"right" ) ) s[len-5] =
'R';
599 else if( s ==
"Sysreq" ) s[len-3] =
'R';
609 if( mod == KKey::WIN && !g_bInitializedMods )
612 for( uint i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
613 if( g_rgModInfo[i].mod == mod )
614 return g_rgModInfo[i].modX;
621 uint
modXLock() {
return LockMask; }
622 uint
modXCtrl() {
return ControlMask; }
623 uint
modXAlt() {
return Mod1Mask; }
631 if( !g_bInitializedMods )
633 return ShiftMask | ControlMask | Mod1Mask | g_rgModInfo[3].modX;
640 if( sym.initQt( keyQt ) ) {
651 if( keyQt & TQt::SHIFT ) mod |= KKey::SHIFT;
652 if( keyQt & TQt::CTRL ) mod |= KKey::CTRL;
653 if( keyQt & TQt::ALT ) mod |= KKey::ALT;
654 if( keyQt & TQt::META ) mod |= KKey::WIN;
663 return (keyQt != TQt::Key_unknown);
669 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
670 if( mod & g_rgModInfo[i].mod ) {
671 if( !g_rgModInfo[i].modQt ) {
675 modQt |= g_rgModInfo[i].modQt;
691 if (s & TQt::ShiftButton) modQt |= KKey::SHIFT;
692 if (s & TQt::ControlButton) modQt |= KKey::CTRL;
693 if (s & TQt::AltButton) modQt |= KKey::ALT;
702 #elif defined(TQ_WS_MACX)
718 #elif defined(TQ_WS_X11)
722 if( !g_bInitializedMods )
726 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
727 if( mod & g_rgModInfo[i].mod ) {
728 if( !g_rgModInfo[i].
modX ) {
729 kdDebug(125) <<
"Invalid modifier flag." <<
endl;
733 modX |= g_rgModInfo[i].modX;
744 if( !g_bInitializedMods )
748 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
750 if( !g_rgModInfo[i].modQt ) {
754 modQt |= g_rgModInfo[i].modQt;
762 if( !g_bInitializedMods )
766 for(
int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
768 mod |= g_rgModInfo[i].mod;
776 XKeyPressedEvent
event;
778 event.type = KeyPress;
779 event.display = tqt_xdisplay();
781 event.keycode = codeX;
784 XLookupString( &event, buffer, 63, &keySym, NULL );
790 static TQString modToString( uint mod,
bool bUserSpace )
792 if( bUserSpace && !g_bInitializedKKeyLabels )
793 intializeKKeyLabels();
796 for(
int i = KKey::MOD_FLAG_COUNT-1; i >= 0; i-- ) {
797 if( mod & g_rgModInfo[i].mod ) {
801 ? g_rgModInfo[i].sLabel
802 : TQString(g_rgModInfo[i].psName);
808 TQString modToStringInternal( uint mod ) {
return modToString( mod,
false ); }
809 TQString
modToStringUser( uint mod ) {
return modToString( mod,
true ); }
813 if( !g_bInitializedKKeyLabels )
814 intializeKKeyLabels();
817 for(
int i = KKey::MOD_FLAG_COUNT-1; i >= 0; i-- ) {
818 if( mod.lower() == g_rgModInfo[i].sLabel.lower())
819 return g_rgModInfo[i].mod;
943 m_code = CODE_FOR_QT;
954 if( m_code == CODE_FOR_QT )
955 return KKey( keyCodeQt() );
957 #if defined(TQ_WS_WIN) || defined(TQ_WS_MACX)
975 if( m_code == CODE_FOR_QT )
976 return m_sym - b.m_sym;
977 if(
m_sym != b.m_sym )
return m_sym - b.m_sym;
978 if( m_mod != b.m_mod )
return m_mod - b.m_mod;
979 return m_code - b.m_code;
987 void Variations::init(
const KKey& key,
bool bQt )
996 uint symVar =
Sym(
key.sym()).getSymVariation();
998 uint modReq =
Sym(m_rgkey[0].sym()).getModsRequired();
999 uint modReqVar =
Sym(symVar).getModsRequired();
1002 if( (
key.modFlags() & modReq) == (
key.modFlags() & modReqVar) ) {
1009 uint nVariations = 0;
1010 for( uint i = 0; i < m_nVariations; i++ ) {
1011 int keyQt =
KKeyNative( m_rgkey[i].code(), m_rgkey[i].mod(), m_rgkey[i].sym() ).
keyCodeQt();
1013 m_rgkey[nVariations++].setKeycodeQt( keyQt );
1016 m_nVariations = nVariations;
1020 for( uint i = 1; i < m_nVariations; i++ ) {
1021 for( uint j = 0; j < i; j++ ) {
1023 if( m_rgkey[i].keyCodeQt() == m_rgkey[j].keyCodeQt() ) {
1024 for( uint k = i; k < m_nVariations - 1; k++ ) {
1025 m_rgkey[k].setKeycodeQt( m_rgkey[k+1].keyCodeQt() );
1044 void KKey::simplify()
1047 if( m_sym == XK_Sys_Req ) {
1050 }
else if( m_sym == XK_ISO_Left_Tab ) {
1059 if( m_sym < 0x3000 && TQChar(m_sym).isLetter() ) {
1060 m_sym = TQChar(m_sym).lower().unicode();
1065 m_mod &= ~
KKeyServer::Sym(m_sym).getModsRequired();
Representation of a key in the format native of the windowing system (eg.
int keyCodeQt() const
Returns the qt key code.
uint sym() const
The native symbol (KeySym) of the key.
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
ModFlag
Flags to represent the modifiers.
TQString readEntry(const TQString &pKey, const TQString &aDefault=TQString::null) const
Reads the value of an entry specified by pKey in the current group.
Helper class to facilitate working with TDEConfig / KSimpleConfig groups.
static TDEConfig * config()
Returns the general config object.
kndbgstream & endl(kndbgstream &s)
Does nothing.
A collection of functions for the conversion of key presses and their modifiers from the window syste...
uint modXModeSwitch()
Returns the X11 Mode_switch modifier mask/flag.
uint modX(KKey::ModFlag modFlag)
Returns the equivalent X modifier mask of the given modifier flag.
int qtButtonStateToMod(TQt::ButtonState s)
Converts the Qt-compatible button state to x11 modifier.
uint modXShift()
Returns the X11 Shift modifier mask/flag.
uint modXNumLock()
Returns the X11 NumLock modifier mask/flag.
bool keyQtToSym(int keyQt, uint &sym)
Extracts the symbol from the given Qt key and converts it to a symbol.
bool modXToModQt(uint modX, int &modQt)
Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.
bool symToKeyQt(uint sym, int &keyQt)
Converts the given symbol to a Qt key code.
uint modXWin()
Returns the X11 Win (Mod3) modifier mask/flag.
uint modXLock()
Returns the X11 Lock modifier mask/flag.
uint stringUserToMod(const TQString &mod)
Converts the modifier given as user-readable string to KKey::ModFlag modifier, or 0.
bool keyboardHasWinKey()
Returns true if the current keyboard layout supports the Win key.
bool modToModX(uint mod, uint &modX)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed X11 modifiers.
bool codeXToSym(uchar codeX, uint modX, uint &symX)
Converts a X11 key code and a mask of ORed X11 modifiers into a X11 symbol.
bool modToModQt(uint mod, int &modQt)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed Qt key code modifiers.
TQString modToStringUser(uint mod)
Converts the mask of ORed KKey::ModFlag modifiers to a user-readable string.
bool modXToMod(uint modX, uint &mod)
Converts the mask of ORed X11 modifiers to a mask of ORed KKey::ModFlag modifiers.
uint accelModMaskX()
Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).
uint modXAlt()
Returns the X11 Alt (Mod1) modifier mask/flag.
uint modXScrollLock()
Returns the X11 ScrollLock modifier mask/flag.
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...
bool initializeMods()
TODO: please document.
uint modXCtrl()
Returns the X11 Ctrl modifier mask/flag.
int event(const TQString &message, const TQString &text=TQString::null) TDE_DEPRECATED
KKey key() const
Converts this Key to a KKey.
int compare(const Key &key) const
Compares this key with the given Key object.
Key & operator=(const KKeyNative &key)
Initializes this key with a KKeyNative.
bool init(const KKey &key, bool bQt)
Initializes the key with a KKey.
uint getSymVariation() const
TODO: please find out what this method does and document it.
int qt() const
Returns the qt key code of the symbol.
uint m_sym
the actual value of the symbol
bool initQt(int keyQt)
Initializes the symbol with the given Qt key code.
TQString toString() const
Returns the string representation of the symbol.
uint getModsRequired() const
Returns the mods that are required for this symbol as ORed KKey::ModFlag's.
bool init(const TQString &s)
Initializes the key with the given string description.
Sym()
Creates a null symbol.