23 #include <tqnamespace.h>
24 #include <tqwindowdefs.h>
26 #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
28 #include "kkeynative.h"
29 #include "kkeyserver_x11.h"
32 #include <tqstringlist.h>
42 #include <X11/Xutil.h>
43 #include <X11/XKBlib.h>
44 #include <X11/keysymdef.h>
70 KKeyNative::~KKeyNative()
84 m_code = pEvent->xkey.keycode;
85 m_mod = pEvent->xkey.state;
86 XLookupString( (XKeyEvent*) pEvent, 0, 0, &keySym, 0 );
87 m_sym = (uint) keySym;
98 #elif !defined(Q_WS_WIN) && !defined(Q_WS_MACX)
114 if( m_sym == XK_Print && !(m_mod & Mod1Mask) &&
115 XkbKeycodeToKeysym( tqt_xdisplay(), 111, 0, 0 ) == XK_Print )
117 else if( m_sym == XK_Break || (m_sym == XK_Pause && (m_mod & ControlMask)) &&
118 XkbKeycodeToKeysym( tqt_xdisplay(), 114, 0, 0 ) == XK_Pause )
121 m_code = XKeysymToKeycode( tqt_xdisplay(), m_sym );
123 if( !m_code && m_sym )
124 kdDebug(125) <<
"Couldn't get code for sym" <<
endl;
127 if(
key.modFlags() && ( ( m_sym < XK_Home || m_sym > XK_Begin ) &&
128 m_sym != XK_Insert && m_sym != XK_Delete ))
153 if( m_sym !=
key.m_sym )
return m_sym -
key.m_sym;
154 if( m_mod !=
key.m_mod )
return m_mod -
key.m_mod;
155 if( m_code !=
key.m_code )
return m_code -
key.m_code;
171 return KKey( m_sym, m_mod );
175 return KKey( m_sym, modSpec );
187 return keyQt | modQt;
int compare(const KKeyNative &key) const
Compares this key with the given KKeyNative object.
uint code() const
The native keycode of the key.
uint modXModeSwitch()
Returns the X11 Mode_switch modifier mask/flag.
bool isNull() const
Returns true if the key is null (after clear() or empty constructor).
Representation of a key in the format native of the windowing system (eg.
bool modXToMod(uint modX, uint &mod)
Converts the mask of ORed X11 modifiers to a mask of ORed KKey::ModFlag modifiers.
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
uint accelModMaskX()
Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).
bool modToModX(uint mod, uint &modX)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed X11 modifiers.
kndbgstream & endl(kndbgstream &s)
Does nothing.
static KKeyNative & null()
Returns a null key.
KKeyNative()
Creates a new null KKey.
bool modXToModQt(uint modX, int &modQt)
Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.
uint mod() const
The native modifier flags of the key.
uint sym() const
The native symbol (KeySym) of the key.
uint modXNumLock()
Returns the X11 NumLock modifier mask/flag.
uint modXScrollLock()
Returns the X11 ScrollLock modifier mask/flag.
static bool keyboardHasWinKey()
Checks whether the keyboard has a Win key.
int keyCodeQt() const
Returns the qt key code.
int qt() const
Returns the qt key code of the symbol.
bool keyboardHasWinKey()
Returns true if the current keyboard layout supports the Win key.
void clear()
Clears the key.
bool codeXToSym(uchar codeX, uint modX, uint &symX)
Converts a X11 key code and a mask of ORed X11 modifiers into a X11 symbol.
uint getModsRequired() const
Returns the mods that are required for this symbol as ORed KKey::ModFlag's.
ModFlag
Flags to represent the modifiers.
KKey key() const
Returns the KKey representation of this key.
uint modXLock()
Returns the X11 Lock modifier mask/flag.
uint modX(KKey::ModFlag modFlag)
Returns the equivalent X modifier mask of the given modifier flag.
bool init(const KKey &key)
Creates a new native key for the given KKey code.