23 #include <tqnamespace.h>
24 #include <tqwindowdefs.h>
26 #if defined(TQ_WS_X11) || defined(TQ_WS_WIN) || defined(TQ_WS_MACX)
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(TQ_WS_WIN) && !defined(TQ_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;
Representation of a key in the format native of the windowing system (eg.
void clear()
Clears the key.
int compare(const KKeyNative &key) const
Compares this key with the given KKeyNative object.
int keyCodeQt() const
Returns the qt key code.
bool isNull() const
Returns true if the key is null (after clear() or empty constructor).
KKey key() const
Returns the KKey representation of this key.
uint mod() const
The native modifier flags of the key.
uint code() const
The native keycode of the key.
uint sym() const
The native symbol (KeySym) of the key.
static KKeyNative & null()
Returns a null key.
bool init(const KKey &key)
Creates a new native key for the given KKey code.
KKeyNative()
Creates a new null KKey.
static bool keyboardHasWinKey()
Checks whether the keyboard has a Win key.
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
ModFlag
Flags to represent the modifiers.
kndbgstream & endl(kndbgstream &s)
Does nothing.
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.
uint modXNumLock()
Returns the X11 NumLock modifier mask/flag.
bool modXToModQt(uint modX, int &modQt)
Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.
uint modXLock()
Returns the X11 Lock modifier mask/flag.
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 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 modXScrollLock()
Returns the X11 ScrollLock modifier mask/flag.
int qt() const
Returns the qt key code of the symbol.
uint getModsRequired() const
Returns the mods that are required for this symbol as ORed KKey::ModFlag's.