• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdecore
 

kdecore

  • kdecore
kkeyserver_x11.cpp
1 /*
2  Copyright (C) 2001 Ellis Whitehead <ellis@kde.org>
3 
4  Win32 port:
5  Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #include <config.h>
24 
25 #include <tqnamespace.h>
26 #include <tqwindowdefs.h>
27 
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
29 
30 #include "kkeyserver_x11.h"
31 #include "kkeynative.h"
32 #include "kshortcut.h"
33 
34 #include <kconfig.h>
35 #include <kdebug.h>
36 #include <kglobal.h>
37 #include <klocale.h>
38 
39 #ifdef Q_WS_X11
40 # define XK_MISCELLANY
41 # define XK_XKB_KEYS
42 # include <X11/X.h>
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
47 #else
48 # include <kckey.h>
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
58 #endif
59 
60 namespace KKeyServer
61 {
62 
63 //---------------------------------------------------------------------
64 // Data Structures
65 //---------------------------------------------------------------------
66 
67 struct Mod
68 {
69  int m_mod;
70 };
71 
72 //---------------------------------------------------------------------
73 // Array Structures
74 //---------------------------------------------------------------------
75 
76 struct ModInfo
77 {
78  KKey::ModFlag mod;
79  int modQt;
80 #ifdef Q_WS_X11
81  uint modX;
82 #endif
83  const char* psName;
84  TQString sLabel;
85 };
86 
87 struct SymVariation
88 {
89  uint sym, symVariation;
90  bool bActive;
91 };
92 
93 struct SymName
94 {
95  uint sym;
96  const char* psName;
97 };
98 
99 struct TransKey {
100  int keySymQt;
101  uint keySymX;
102 };
103 
104 //---------------------------------------------------------------------
105 // Arrays
106 //---------------------------------------------------------------------
107 
108 static ModInfo g_rgModInfo[KKey::MOD_FLAG_COUNT] =
109 {
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() }
114 };
115 
116 // Special Names List
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") },
126 #ifdef sun
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") },
138 #endif
139  { 0, 0 }
140 };
141 
142 #ifdef Q_WS_X11
143 static SymVariation g_rgSymVariation[] =
144 {
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 },
150  { 0, 0, false }
151 };
152 
153 // TODO: Add Mac key names list: Key_Backspace => "Delete", Key_Delete => "Del"
154 
155 // These are the X equivalents to the Qt keycodes 0x1000 - 0x1026
156 static const TransKey g_rgQtToSymX[] =
157 {
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 },
167 #ifdef sun
168  { Qt::Key_Print, XK_F22 },
169 #else
170  { Qt::Key_Print, XK_Print },
171 #endif
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 },
181  //{ Qt::Key_Shift, 0 },
182  //{ Qt::Key_Control, 0 },
183  //{ Qt::Key_Meta, 0 },
184  //{ Qt::Key_Alt, 0 },
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 },
229  //{ Qt::Key_Direction_L, XK_Direction_L }, These keys don't exist in X11
230  //{ Qt::Key_Direction_R, XK_Direction_R },
231 
232  { '/', XK_KP_Divide },
233  { '*', XK_KP_Multiply },
234  { '-', XK_KP_Subtract },
235  { '+', XK_KP_Add },
236  { Qt::Key_Return, XK_KP_Enter }
237 #if QT_VERSION >= 0x030100
238 
239 // the next lines are taken from XFree > 4.0 (X11/XF86keysyms.h), defining some special
240 // multimedia keys. They are included here as not every system has them.
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 /* Monitor/panel brightness */
281 #define XF86XK_MonBrightnessDown 0x1008FF03 /* Monitor/panel brightness */
282 #define XF86XK_KbdLightOnOff 0x1008FF04 /* Keyboards may be lit */
283 #define XF86XK_KbdBrightnessUp 0x1008FF05 /* Keyboards may be lit */
284 #define XF86XK_KbdBrightnessDown 0x1008FF06 /* Keyboards may be lit */
285 // end of XF86keysyms.h
286  ,
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 },
327 #endif
328 };
329 #endif //Q_WS_X11
330 
331 //---------------------------------------------------------------------
332 // Initialization
333 //---------------------------------------------------------------------
334 static bool g_bInitializedMods, g_bInitializedVariations, g_bInitializedKKeyLabels;
335 static bool g_bMacLabels;
336 #ifdef Q_WS_X11
337 static uint g_modXNumLock, g_modXScrollLock, g_modXModeSwitch;
338 
339 bool initializeMods()
340 {
341  XModifierKeymap* xmk = XGetModifierMapping( qt_xdisplay() );
342 
343  g_rgModInfo[3].modX = g_modXNumLock = g_modXScrollLock = g_modXModeSwitch = 0;
344 
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 ));
349  // Qt assumes that Alt is always Mod1Mask, so start at Mod2Mask.
350  for( int i = Mod2MapIndex; i < 8; i++ ) {
351  uint mask = (1 << i);
352  uint keySymX = NoSymbol;
353  // This used to be only XKeycodeToKeysym( ... , 0 ), but that fails with XFree4.3.99
354  // and X.org R6.7 , where for some reason only ( ... , 1 ) works. I have absolutely no
355  // idea what the problem is, but searching all posibilities until something valid is
356  // found fixes the problem.
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 );
360  switch( keySymX ) {
361  case XK_Num_Lock: g_modXNumLock = mask; break; // Normally Mod2Mask
362  case XK_Super_L:
363  case XK_Super_R: g_rgModInfo[3].modX = mask; break; // Win key, Normally Mod4Mask
364  case XK_Meta_L:
365  case XK_Meta_R: if( !g_rgModInfo[3].modX ) g_rgModInfo[3].modX = mask; break; // Win alternate
366  case XK_Scroll_Lock: g_modXScrollLock = mask; break; // Normally Mod5Mask
367  case XK_Mode_switch: g_modXModeSwitch = mask; break;
368  }
369  }
370 
371  XFreeModifiermap( xmk );
372 
373  //KConfigGroupSaver cgs( KGlobal::config(), "Keyboard" );
374  // read in mod that win should be attached to
375 
376  g_bInitializedMods = true;
377 
378  kdDebug(125) << "KKeyServer::initializeMods(): Win Mod = 0x" << TQString::number(g_rgModInfo[3].modX, 16) << endl;
379  return true;
380 }
381 
382 static void initializeVariations()
383 {
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;
387 }
388 #endif //Q_WS_X11
389 
390 static void intializeKKeyLabels()
391 {
392  KConfigGroupSaver cgs( KGlobal::config(), "Keyboard" );
393  g_rgModInfo[0].sLabel = KGlobal::config()->readEntry( "Label Shift", i18n(g_rgModInfo[0].psName) );
394  g_rgModInfo[1].sLabel = KGlobal::config()->readEntry( "Label Ctrl", i18n(g_rgModInfo[1].psName) );
395  g_rgModInfo[2].sLabel = KGlobal::config()->readEntry( "Label Alt", i18n(g_rgModInfo[2].psName) );
396  g_rgModInfo[3].sLabel = KGlobal::config()->readEntry( "Label Win", i18n(g_rgModInfo[3].psName) );
397  g_bMacLabels = (g_rgModInfo[2].sLabel == "Command");
398  g_bInitializedKKeyLabels = true;
399 }
400 
401 //---------------------------------------------------------------------
402 // class Mod
403 //---------------------------------------------------------------------
404 
405 /*void Mod::init( const TQString& s )
406 {
407 
408 }*/
409 
410 //---------------------------------------------------------------------
411 // class Sym
412 //---------------------------------------------------------------------
413 
414 bool Sym::initQt( int keyQt )
415 {
416  int symQt = keyQt & 0xffff;
417 
418  if( (keyQt & Qt::UNICODE_ACCEL) || symQt < 0x1000 ) {
419  m_sym = TQChar(symQt).lower().unicode();
420  return true;
421  }
422 
423 #ifdef Q_WS_WIN
424  m_sym = symQt;
425  return true;
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;
430  return true;
431  }
432  }
433 
434  m_sym = 0;
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;
438  return false;
439 #elif defined(Q_WS_MACX)
440  m_sym = symQt;
441  return true;
442 #endif
443 }
444 
445 bool Sym::init( const TQString& s )
446 {
447  // If it's a single character, get unicode value.
448  if( s.length() == 1 ) {
449  m_sym = s[0].lower().unicode();
450  return true;
451  }
452 
453  // Look up in special names list
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;
457  return true;
458  }
459  }
460 
461 #ifdef Q_WS_WIN
462  // search for name in KKeys array
463  for ( KKeys const *pKey = kde_KKEYS; pKey->code != 0xffff; pKey++) {
464  if( qstricmp( s.latin1(), pKey->name ) == 0 ) {
465  m_sym = pKey->code;
466  return true;
467  }
468  }
469  m_sym = 0;
470 #elif defined(Q_WS_X11)
471  // search X list: 's' as is, all lower, first letter in caps
472  m_sym = XStringToKeysym( s.latin1() );
473  if( !m_sym ) {
474  m_sym = XStringToKeysym( s.lower().latin1() );
475  if( !m_sym ) {
476  TQString s2 = s;
477  s2[0] = s2[0].upper();
478  m_sym = XStringToKeysym( s2.latin1() );
479  }
480  }
481 #endif
482  return m_sym != 0;
483 }
484 
485 int Sym::qt() const
486 {
487  if( m_sym < 0x1000 ) {
488  if( m_sym >= 'a' && m_sym <= 'z' )
489  return TQChar(m_sym).upper();
490  return m_sym;
491  }
492 #ifdef Q_WS_WIN
493  if( m_sym < 0x3000 )
494  return m_sym;
495 #elif defined(Q_WS_X11)
496  if( m_sym < 0x3000 )
497  return m_sym | Qt::UNICODE_ACCEL;
498 
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;
502 #endif
503  return TQt::Key_unknown;
504 }
505 
506 TQString Sym::toString( bool bUserSpace ) const
507 {
508  if( m_sym == 0 ) {
509  return TQString::null;
510  }
511 
512  // If it's a unicode character,
513 #ifdef Q_WS_WIN
514  else if( m_sym < 0x1000 ) {
515 #else
516  else if( m_sym < 0x3000 ) {
517 #endif
518  TQChar c = TQChar(m_sym).upper();
519  // Print all non-space characters directly when output is user-visible.
520  // Otherwise only print alphanumeric latin1 characters directly (A,B,C,1,2,3).
521  if( (c.latin1() && c.isLetterOrNumber())
522  || (bUserSpace && !c.isSpace()) ) {
523  return c;
524  }
525  }
526 
527  // Look up in special names list
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);
531  }
532  }
533 
534  TQString s;
535 #ifdef Q_WS_WIN
536  s = TQKeySequence( m_sym );
537 #elif defined(Q_WS_X11)
538  // Get X-name
539  s = XKeysymToString( m_sym );
540 #endif
541  capitalizeKeyname( s );
542  return bUserSpace ? i18n(TQACCEL_OBJECT_NAME_STRING, s.latin1()) : s;
543 }
544 
545 TQString Sym::toStringInternal() const { return toString( false ); }
546 TQString Sym::toString() const { return toString( true ); }
547 
548 uint Sym::getModsRequired() const
549 {
550  uint mod = 0;
551 #ifdef Q_WS_X11
552  // FIXME: This might not be true on all keyboard layouts!
553  if( m_sym == XK_Sys_Req ) return KKey::ALT;
554  if( m_sym == XK_Break ) return KKey::CTRL;
555 
556  if( m_sym < 0x3000 ) {
557  TQChar c(m_sym);
558  if( c.isLetter() && c.lower() != c.upper() && m_sym == c.upper().unicode() )
559  return KKey::SHIFT;
560  }
561 
562  uchar code = XKeysymToKeycode( qt_xdisplay(), m_sym );
563  if( code ) {
564  // need to check index 0 before the others, so that a null-mod
565  // can take precedence over the others, in case the modified
566  // key produces the same symbol.
567  if( m_sym == XKeycodeToKeysym( qt_xdisplay(), code, 0 ) )
568  ;
569  else if( m_sym == XKeycodeToKeysym( qt_xdisplay(), code, 1 ) )
570  mod = KKey::SHIFT;
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;
575  }
576 #endif
577  return mod;
578 }
579 
580 uint Sym::getSymVariation() const
581 {
582 #ifdef Q_WS_X11
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;
588 #endif
589  return 0;
590 }
591 
592 void Sym::capitalizeKeyname( TQString& s )
593 {
594  s[0] = s[0].upper();
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';
599 }
600 
601 //---------------------------------------------------------------------
602 // Public functions
603 //---------------------------------------------------------------------
604 
605 #ifdef Q_WS_X11
606 uint modX( KKey::ModFlag mod )
607 {
608  if( mod == KKey::WIN && !g_bInitializedMods )
609  initializeMods();
610 
611  for( uint i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
612  if( g_rgModInfo[i].mod == mod )
613  return g_rgModInfo[i].modX;
614  }
615  return 0;
616 }
617 
618 bool keyboardHasWinKey() { if( !g_bInitializedMods ) { initializeMods(); } return g_rgModInfo[3].modX != 0; }
619 uint modXShift() { return ShiftMask; }
620 uint modXLock() { return LockMask; }
621 uint modXCtrl() { return ControlMask; }
622 uint modXAlt() { return Mod1Mask; }
623 uint modXNumLock() { if( !g_bInitializedMods ) { initializeMods(); } return g_modXNumLock; }
624 uint modXWin() { if( !g_bInitializedMods ) { initializeMods(); } return g_rgModInfo[3].modX; }
625 uint modXScrollLock() { if( !g_bInitializedMods ) { initializeMods(); } return g_modXScrollLock; }
626 uint modXModeSwitch() { if( !g_bInitializedMods ) { initializeMods(); } return g_modXModeSwitch; }
627 
628 uint accelModMaskX()
629 {
630  if( !g_bInitializedMods )
631  initializeMods();
632  return ShiftMask | ControlMask | Mod1Mask | g_rgModInfo[3].modX;
633 }
634 #endif //Q_WS_X11
635 
636 bool keyQtToSym( int keyQt, uint& keySym )
637 {
638  Sym sym;
639  if( sym.initQt( keyQt ) ) {
640  keySym = sym.m_sym;
641  return true;
642  } else
643  return false;
644 }
645 
646 bool keyQtToMod( int keyQt, uint& mod )
647 {
648  mod = 0;
649 
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;
654 
655  return true;
656 }
657 
658 bool symToKeyQt( uint keySym, int& keyQt )
659 {
660  Sym sym( keySym );
661  keyQt = sym.qt();
662  return (keyQt != TQt::Key_unknown);
663 }
664 
665 bool modToModQt( uint mod, int& modQt )
666 {
667  modQt = 0;
668  for( int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
669  if( mod & g_rgModInfo[i].mod ) {
670  if( !g_rgModInfo[i].modQt ) {
671  modQt = 0;
672  return false;
673  }
674  modQt |= g_rgModInfo[i].modQt;
675  }
676  }
677  return true;
678 }
679 
680 #ifdef Q_WS_WIN
681 //wrapped
682 bool modXToModQt( uint modX, int& modQt )
683 {
684  return modToModQt( modX, modQt );
685 }
686 
687 KDECORE_EXPORT int qtButtonStateToMod( TQt::ButtonState s )
688 {
689  int modQt = 0;
690  if (s & Qt::ShiftButton) modQt |= KKey::SHIFT;
691  if (s & Qt::ControlButton) modQt |= KKey::CTRL;
692  if (s & Qt::AltButton) modQt |= KKey::ALT;
693  return modQt;
694 }
695 
696 bool keyboardHasWinKey() {
698  return true;
699 }
700 
701 #elif defined(Q_WS_MACX)
702 
703 bool modXToModQt(uint modX, int& modQt)
704 {
705  return modToModQt( modX, modQt );
706 }
707 
708 bool keyboardHasWinKey() {
710  return false;
711 }
712 
713 bool modXToMod( uint , uint& )
714 {
715  return false;
716 }
717 #elif defined(Q_WS_X11)
718 
719 bool modToModX( uint mod, uint& modX )
720 {
721  if( !g_bInitializedMods )
722  initializeMods();
723 
724  modX = 0;
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;
729  modX = 0;
730  return false;
731  }
732  modX |= g_rgModInfo[i].modX;
733  }
734  }
735  // TODO: document 0x2000 flag
736  if( mod & 0x2000 )
737  modX |= 0x2000;
738  return true;
739 }
740 
741 bool modXToModQt( uint modX, int& modQt )
742 {
743  if( !g_bInitializedMods )
744  initializeMods();
745 
746  modQt = 0;
747  for( int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
748  if( modX & g_rgModInfo[i].modX ) {
749  if( !g_rgModInfo[i].modQt ) {
750  modQt = 0;
751  return false;
752  }
753  modQt |= g_rgModInfo[i].modQt;
754  }
755  }
756  return true;
757 }
758 
759 bool modXToMod( uint modX, uint& mod )
760 {
761  if( !g_bInitializedMods )
762  initializeMods();
763 
764  mod = 0;
765  for( int i = 0; i < KKey::MOD_FLAG_COUNT; i++ ) {
766  if( modX & g_rgModInfo[i].modX )
767  mod |= g_rgModInfo[i].mod;
768  }
769  return true;
770 }
771 
772 bool codeXToSym( uchar codeX, uint modX, uint& sym )
773 {
774  KeySym keySym;
775  XKeyPressedEvent event;
776 
777  event.type = KeyPress;
778  event.display = qt_xdisplay();
779  event.state = modX;
780  event.keycode = codeX;
781 
782  char buffer[64];
783  XLookupString( &event, buffer, 63, &keySym, NULL );
784  sym = (uint) keySym;
785  return true;
786 }
787 #endif
788 
789 static TQString modToString( uint mod, bool bUserSpace )
790 {
791  if( bUserSpace && !g_bInitializedKKeyLabels )
792  intializeKKeyLabels();
793 
794  TQString s;
795  for( int i = KKey::MOD_FLAG_COUNT-1; i >= 0; i-- ) {
796  if( mod & g_rgModInfo[i].mod ) {
797  if( !s.isEmpty() )
798  s += '+';
799  s += (bUserSpace)
800  ? g_rgModInfo[i].sLabel
801  : TQString(g_rgModInfo[i].psName);
802  }
803  }
804  return s;
805 }
806 
807 TQString modToStringInternal( uint mod ) { return modToString( mod, false ); }
808 TQString modToStringUser( uint mod ) { return modToString( mod, true ); }
809 
810 uint stringUserToMod( const TQString& mod )
811 {
812  if( !g_bInitializedKKeyLabels )
813  intializeKKeyLabels();
814 
815  TQString s;
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;
819  }
820  return 0;
821 }
822 
823 /*void keySymModToKeyX( uint sym, uint mod, unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX )
824 {
825 ...
826  uint keySymQt;
827  uint keySymX = 0;
828  unsigned char keyCodeX = 0;
829  uint keyModX = 0;
830 
831  const char *psKeySym = 0;
832 
833  if( !g_bInitialized )
834  Initialize();
835 
836  // Get code of just the primary key
837  keySymQt = keyCombQt & 0xffff;
838 
839  // If unicode value beneath 0x1000 (special Qt codes begin thereafter),
840  if( keySymQt < 0x1000 ) {
841  // For reasons unbeknownst to me, Qt converts 'a-z' to 'A-Z'.
842  // So convert it back to lowercase if SHIFT isn't held down.
843  if( keySymQt >= Qt::Key_A && keySymQt <= Qt::Key_Z && !(keyCombQt & Qt::SHIFT) )
844  keySymQt = tolower( keySymQt );
845  keySymX = keySymQt;
846  }
847  // Else, special key (e.g. Delete, F1, etc.)
848  else {
849  for( int i = 0; i < NB_KEYS; i++ ) {
850  if( keySymQt == (uint) KKEYS[i].code ) {
851  psKeySym = KKEYS[i].name;
852  //kdDebug(125) << " symbol found: \"" << psKeySym << "\"" << endl;
853  break;
854  }
855  }
856 
857  // Get X key symbol. Only works if Qt name is same as X name.
858  if( psKeySym ) {
859  TQString sKeySym = psKeySym;
860 
861  // Check for lower-case equalent first because most
862  // X11 names are all lower-case.
863  keySymX = XStringToKeysym( sKeySym.lower().ascii() );
864  if( keySymX == 0 )
865  keySymX = XStringToKeysym( psKeySym );
866  }
867 
868  if( keySymX == 0 )
869  keySymX = getSymXEquiv( keySymQt );
870  }
871 
872  if( keySymX != 0 ) {
873  // Get X keyboard code
874  keyCodeX = XKeysymToKeycode( qt_xdisplay(), keySymX );
875  // Add ModeSwitch modifier bit, if necessary
876  keySymXMods( keySymX, 0, &keyModX );
877 
878  // Get X modifier flags
879  for( int i = 0; i < MOD_KEYS; i++ ) {
880  if( keyCombQt & g_aModKeys[i].keyModMaskQt ) {
881  if( g_aModKeys[i].keyModMaskX )
882  keyModX |= g_aModKeys[i].keyModMaskX;
883  // Qt key calls for a modifier which the current
884  // X modifier map doesn't support.
885  else {
886  keySymX = 0;
887  keyCodeX = 0;
888  keyModX = 0;
889  break;
890  }
891  }
892  }
893  }
894 
895  // Take care of complications:
896  // The following keys will not have been correctly interpreted,
897  // because their shifted values are not activated with the
898  // Shift key, but rather something else. They are also
899  // defined twice under different keycodes.
900  // keycode 111 & 92: Print Sys_Req -> Sys_Req = Alt+Print
901  // keycode 110 & 114: Pause Break -> Break = Ctrl+Pause
902  if( (keyCodeX == 92 || keyCodeX == 111) &&
903  XKeycodeToKeysym( qt_xdisplay(), 92, 0 ) == XK_Print &&
904  XKeycodeToKeysym( qt_xdisplay(), 111, 0 ) == XK_Print )
905  {
906  // If Alt is pressed, then we need keycode 92, keysym XK_Sys_Req
907  if( keyModX & keyModXAlt() ) {
908  keyCodeX = 92;
909  keySymX = XK_Sys_Req;
910  }
911  // Otherwise, keycode 111, keysym XK_Print
912  else {
913  keyCodeX = 111;
914  keySymX = XK_Print;
915  }
916  }
917  else if( (keyCodeX == 110 || keyCodeX == 114) &&
918  XKeycodeToKeysym( qt_xdisplay(), 110, 0 ) == XK_Pause &&
919  XKeycodeToKeysym( qt_xdisplay(), 114, 0 ) == XK_Pause )
920  {
921  if( keyModX & keyModXCtrl() ) {
922  keyCodeX = 114;
923  keySymX = XK_Break;
924  } else {
925  keyCodeX = 110;
926  keySymX = XK_Pause;
927  }
928  }
929 
930  if( pKeySymX ) *pKeySymX = keySymX;
931  if( pKeyCodeX ) *pKeyCodeX = keyCodeX;
932  if( pKeyModX ) *pKeyModX = keyModX;
933 }*/
934 
935 //---------------------------------------------------------------------
936 // Key
937 //---------------------------------------------------------------------
938 
939 bool Key::init( const KKey& key, bool bQt )
940 {
941  if( bQt ) {
942  m_code = CODE_FOR_QT;
943  m_sym = key.keyCodeQt();
944  } else {
945  KKeyNative keyNative( key );
946  *this = keyNative;
947  }
948  return true;
949 }
950 
951 KKey Key::key() const
952 {
953  if( m_code == CODE_FOR_QT )
954  return KKey( keyCodeQt() );
955  else {
956 #if defined(Q_WS_WIN) || defined(Q_WS_MACX)
957  return KKey();
958 #else
959  uint mod;
960  modXToMod( m_mod, mod );
961  return KKey( m_sym, mod );
962 #endif
963  }
964 }
965 
966 Key& Key::operator =( const KKeyNative& key )
967 {
968  m_code = key.code(); m_mod = key.mod(); m_sym = key.sym();
969  return *this;
970 }
971 
972 int Key::compare( const Key& b ) const
973 {
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;
979 }
980 
981 //---------------------------------------------------------------------
982 // Variations
983 //---------------------------------------------------------------------
984 
985 // TODO: allow for sym to have variations, such as Plus => { Plus, KP_Add }
986 void Variations::init( const KKey& key, bool bQt )
987 {
988  if( key.isNull() ) {
989  m_nVariations = 0;
990  return;
991  }
992 
993  m_nVariations = 1;
994  m_rgkey[0] = KKeyNative(key);
995  uint symVar = Sym(key.sym()).getSymVariation();
996  if( symVar ) {
997  uint modReq = Sym(m_rgkey[0].sym()).getModsRequired();
998  uint modReqVar = Sym(symVar).getModsRequired();
999  // If 'key' doesn't require any mods that are inherent in
1000  // the primary key but not required for the alternate,
1001  if( (key.modFlags() & modReq) == (key.modFlags() & modReqVar) ) {
1002  m_rgkey[1] = KKeyNative(KKey(symVar, key.modFlags()));
1003  m_nVariations = 2;
1004  }
1005  }
1006 
1007  if( bQt ) {
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();
1011  if( keyQt ) {
1012  m_rgkey[nVariations++].setKeycodeQt( keyQt );
1013  }
1014  }
1015  m_nVariations = nVariations;
1016 
1017  // Two different native codes may produce a single
1018  // Qt code. Search for duplicates.
1019  for( uint i = 1; i < m_nVariations; i++ ) {
1020  for( uint j = 0; j < i; j++ ) {
1021  // If key is already present in list, then remove it.
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() );
1025  }
1026  m_nVariations--;
1027  i--;
1028  break;
1029  }
1030  }
1031  }
1032  }
1033 }
1034 
1035 } // end of namespace KKeyServer block
1036 
1037 // FIXME: This needs to be moved to kshortcut.cpp, and create a
1038 // KKeyServer::method which it will call.
1039 // Alt+SysReq => Alt+Print
1040 // Ctrl+Shift+Plus => Ctrl+Plus (en)
1041 // Ctrl+Shift+Equal => Ctrl+Plus
1042 // Ctrl+Pause => Ctrl+Break
1043 void KKey::simplify()
1044 {
1045 #ifdef Q_WS_X11
1046  if( m_sym == XK_Sys_Req ) {
1047  m_sym = XK_Print;
1048  m_mod |= ALT;
1049  } else if( m_sym == XK_ISO_Left_Tab ) {
1050  m_sym = XK_Tab;
1051  m_mod |= SHIFT;
1052  } else {
1053  // Shift+Equal => Shift+Plus (en)
1054  m_sym = KKeyNative(*this).sym();
1055  }
1056 
1057  // If this is a letter, don't remove any modifiers.
1058  if( m_sym < 0x3000 && TQChar(m_sym).isLetter() ) {
1059  m_sym = TQChar(m_sym).lower().unicode();
1060  }
1061 
1062  // Remove modifers from modifier list which are implicit in the symbol.
1063  // Ex. Shift+Plus => Plus (en)
1064  m_mod &= ~KKeyServer::Sym(m_sym).getModsRequired();
1065 #endif
1066 }
1067 
1068 #endif //Q_WS_X11 || Q_WS_WIN
1069 
KKey::ModFlag
ModFlag
Flags to represent the modifiers.
Definition: kshortcut.h:53
KNotifyClient::event
int event(const TQString &message, const TQString &text=TQString::null) KDE_DEPRECATED
Definition: knotifyclient.cpp:112
KKeyServer::codeXToSym
bool codeXToSym(uchar codeX, uint modX, uint &symX)
Converts a X11 key code and a mask of ORed X11 modifiers into a X11 symbol.
KKeyNative::mod
uint mod() const
The native modifier flags of the key.
KKeyServer::Key::operator=
Key & operator=(const KKeyNative &key)
Initializes this key with a KKeyNative.
KKey::isNull
bool isNull() const
Returns true if the key is null (after clear() or empty constructor).
Definition: kshortcut.cpp:149
KKeyNative::keyCodeQt
int keyCodeQt() const
Returns the qt key code.
KKeyServer
A collection of functions for the conversion of key presses and their modifiers from the window syste...
Definition: kkeyserver_x11.h:34
KKeyServer::Sym::getModsRequired
uint getModsRequired() const
Returns the mods that are required for this symbol as ORed KKey::ModFlag&#39;s.
KKeyServer::symToKeyQt
bool symToKeyQt(uint sym, int &keyQt)
Converts the given symbol to a Qt key code.
KKeyServer::modXNumLock
uint modXNumLock()
Returns the X11 NumLock modifier mask/flag.
KKeyServer::modXScrollLock
uint modXScrollLock()
Returns the X11 ScrollLock modifier mask/flag.
KKeyServer::modXAlt
uint modXAlt()
Returns the X11 Alt (Mod1) modifier mask/flag.
KKeyServer::modXModeSwitch
uint modXModeSwitch()
Returns the X11 Mode_switch modifier mask/flag.
KKeyServer::modXShift
uint modXShift()
Returns the X11 Shift modifier mask/flag.
klocale.h
KKeyServer::keyboardHasWinKey
bool keyboardHasWinKey()
Returns true if the current keyboard layout supports the Win key.
KKeyServer::Sym::init
bool init(const TQString &s)
Initializes the key with the given string description.
KKeyServer::Key::key
KKey key() const
Converts this Key to a KKey.
KKeyServer::keyQtToMod
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...
KKeyNative::code
uint code() const
The native keycode of the key.
KKeyServer::initializeMods
bool initializeMods()
TODO: please document.
KKeyServer::modToModQt
bool modToModQt(uint mod, int &modQt)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed Qt key code modifiers.
KKeyServer::modX
uint modX(KKey::ModFlag modFlag)
Returns the equivalent X modifier mask of the given modifier flag.
KConfigGroupSaver
Helper class to facilitate working with KConfig / KSimpleConfig groups.
Definition: kconfigbase.h:2059
KKeyServer::modXToMod
bool modXToMod(uint modX, uint &mod)
Converts the mask of ORed X11 modifiers to a mask of ORed KKey::ModFlag modifiers.
KKeyServer::modXWin
uint modXWin()
Returns the X11 Win (Mod3) modifier mask/flag.
KKeyServer::Key::compare
int compare(const Key &key) const
Compares this key with the given Key object.
KKeyServer::modXLock
uint modXLock()
Returns the X11 Lock modifier mask/flag.
KKeyServer::qtButtonStateToMod
int qtButtonStateToMod(TQ_ButtonState s)
Converts the Qt-compatible button state to x11 modifier.
KKeyServer::modToModX
bool modToModX(uint mod, uint &modX)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed X11 modifiers.
KKeyNative
Representation of a key in the format native of the windowing system (eg.
Definition: kkeynative.h:37
KConfigBase::readEntry
TQString readEntry(const TQString &pKey, const TQString &aDefault=TQString::null) const
Reads the value of an entry specified by pKey in the current group.
Definition: kconfigbase.cpp:222
KKeyServer::Sym::initQt
bool initQt(int keyQt)
Initializes the symbol with the given Qt key code.
KKeyServer::Key::init
bool init(const KKey &key, bool bQt)
Initializes the key with a KKey.
KKeyServer::stringUserToMod
uint stringUserToMod(const TQString &mod)
Converts the modifier given as user-readable string to KKey::ModFlag modifier, or 0...
KKeyServer::modToStringUser
TQString modToStringUser(uint mod)
Converts the mask of ORed KKey::ModFlag modifiers to a user-readable string.
KKeyServer::Sym::toString
TQString toString() const
Returns the string representation of the symbol.
KKey
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
Definition: kshortcut.h:40
KKeyServer::modXToModQt
bool modXToModQt(uint modX, int &modQt)
Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.
KKeyServer::Sym::qt
int qt() const
Returns the qt key code of the symbol.
KKeyServer::Sym::getSymVariation
uint getSymVariation() const
TODO: please find out what this method does and document it.
KKeyServer::modXCtrl
uint modXCtrl()
Returns the X11 Ctrl modifier mask/flag.
KKeyNative::sym
uint sym() const
The native symbol (KeySym) of the key.
endl
kndbgstream & endl(kndbgstream &s)
Does nothing.
Definition: kdebug.h:583
KKeyServer::accelModMaskX
uint accelModMaskX()
Returns bitwise OR&#39;ed mask containing Shift, Ctrl, Alt, and Win (if available).
KGlobal::config
static KConfig * config()
Returns the general config object.
Definition: kglobal.cpp:61
KKey::keyCodeQt
int keyCodeQt() const
Returns the qt key code.
Definition: kshortcut.cpp:162
KKeyServer::keyQtToSym
bool keyQtToSym(int keyQt, uint &sym)
Extracts the symbol from the given Qt key and converts it to a symbol.

kdecore

Skip menu "kdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.8.13
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |