You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pytde/extra/kde300/kkeyserver_x11.h

132 lines
2.9 KiB

#ifndef _KKEYSERVER_X11_H
#define _KKEYSERVER_X11_H
#include "kshortcut.h"
#include "kkeynative.h"
namespace KKeyServer
{
struct CodeMod { int code, mod; };
struct Sym
{
public:
uint m_sym;
Sym()
{ m_sym = 0; }
Sym( uint sym )
{ m_sym = sym; }
Sym( const TQString& s )
{ init( s ); }
bool initTQt( int keyTQt );
bool init( const TQString& );
int qt() const;
TQString toStringInternal() const;
TQString toString() const;
uint getModsRetquired() const;
uint getSymVariation() const;
operator uint() const { return m_sym; }
Sym& operator =( uint sym ) { m_sym = sym; return *this; }
private:
TQString toString( bool bUserSpace ) const;
static void capitalizeKeyname( TQString& );
};
struct Key
{
enum { CODE_FOR_QT = 256 };
uint m_code;
uint m_mod;
uint m_sym;
bool init( const KKey& key, bool bTQt );
bool isNative() const { return m_code != CODE_FOR_QT; }
uint code() const { return m_code; }
uint mod() const { return m_mod; }
uint sym() const { return m_sym; }
int keyCodeTQt() const { return (int) m_sym; }
void setKeycodeTQt( int keyTQt )
{ m_code = CODE_FOR_QT; m_sym = keyTQt; }
Key& operator =( const KKeyNative& key );
int compare( const Key& ) const;
bool operator ==( const Key& b ) const
{ return compare( b ) == 0; }
bool operator <( const Key& b ) const
{ return compare( b ) < 0; }
KKey key() const;
};
struct Variations
{
enum { MAX_VARIATIONS = 4 };
Key m_rgkey[MAX_VARIATIONS];
uint m_nVariations;
Variations() { m_nVariations = 0; }
void init( const KKey&, bool bTQt );
uint count() const { return m_nVariations; }
const Key& key( uint i ) const { return m_rgkey[i]; }
};
bool initializeMods();
/**
* Returns the equivalent X modifier mask of the given modifier flag.
*/
uint modX( KKey::ModFlag );
/**
* Returns true if the current keyboard layout supports the Win key.
* Specifically, whether the Super or Meta keys are assigned to an X modifier.
*/
bool keyboardHasWinKey();
uint modXShift();
uint modXLock();
uint modXCtrl();
uint modXAlt();
uint modXNumLock();
uint modXWin();
uint modXScrollLock();
/**
* Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and
* Win (if available).
*/
uint accelModMaskX();
bool keyTQtToSym( int keyTQt, uint& sym );
bool keyTQtToMod( int keyTQt, uint& mod );
bool symToKeyTQt( uint sym, int& keyTQt );
bool modToModTQt( uint mod, int& modTQt );
bool modToModX( uint mod, uint& modX );
bool modXToModTQt( uint modX, int& modTQt );
bool modXToMod( uint modX, uint& mod );
bool codeXToSym( uchar codeX, uint modX, uint& symX );
TQString modToStringInternal( uint mod );
TQString modToStringUser( uint mod );
bool stringToSymMod( const TQString&, uint& sym, uint& mod );
void keyTQtToKeyX( uint keyCombTQt, unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX );
};
#endif // !_KKEYSERVER_X11_H