00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#ifndef _KKEYSERVER_X11_H
00024
#define _KKEYSERVER_X11_H
00025
00026
#include "kshortcut.h"
00027
#include "kkeynative.h"
00028
00034
namespace KKeyServer
00035 {
00040 enum ExtraModFlag { MODE_SWITCH = 0x2000 };
00041
00047 struct KDECORE_EXPORT Sym
00048 {
00049
public:
00051 uint m_sym;
00052
00054 Sym()
00055 { m_sym = 0; }
00060 Sym( uint sym )
00061 { m_sym = sym; }
00067 Sym(
const QString& s )
00068 { init( s ); }
00069
00076
bool initQt(
int keyQt );
00077
00084
bool init(
const QString &s );
00085
00090
int qt() const;
00091
00095
QString toStringInternal() const;
00096
00101
QString toString() const;
00102
00110 uint getModsRequired() const;
00111
00115 uint getSymVariation() const;
00116
00120 operator uint()
const {
return m_sym; }
00121
00125 Sym& operator =( uint sym ) { m_sym = sym;
return *
this; }
00126
00127
private:
00128
QString toString(
bool bUserSpace )
const;
00129
00130
static void capitalizeKeyname(
QString& );
00131 };
00132
00137 struct KDECORE_EXPORT Key
00138 {
00140
enum { CODE_FOR_QT = 256 };
00141
00143 uint m_code;
00144
00146 uint m_mod;
00147
00149 uint m_sym;
00150
00159
bool init(
const KKey& key,
bool bQt );
00160
00168 bool isNative()
const {
return m_code != CODE_FOR_QT; }
00169
00174 uint code()
const {
return m_code; }
00175
00180 uint mod()
const {
return m_mod; }
00181
00186 uint sym()
const {
return m_sym; }
00187
00192 int keyCodeQt()
const {
return (
int) m_sym; }
00193
00198 void setKeycodeQt(
int keyQt )
00199 { m_code = CODE_FOR_QT; m_sym = keyQt; }
00200
00205 Key& operator =(
const KKeyNative& key );
00206
00218
int compare(
const Key& key )
const;
00219
00224 bool operator ==(
const Key& b )
const
00225
{
return compare( b ) == 0; }
00226
00231 bool operator <(
const Key& b )
const
00232
{
return compare( b ) < 0; }
00233
00238
KKey key() const;
00239 };
00240
00244 struct KDECORE_EXPORT
Variations
00245 {
00246
enum { MAX_VARIATIONS = 4 };
00247
00248 Key m_rgkey[MAX_VARIATIONS];
00249 uint m_nVariations;
00250
00251 Variations() { m_nVariations = 0; }
00252
00253
void init(
const KKey&,
bool bQt );
00254
00255 uint count()
const {
return m_nVariations; }
00256
const Key& key( uint i )
const {
return m_rgkey[i]; }
00257 };
00258
00260 KDECORE_EXPORT
bool initializeMods();
00261
00267 KDECORE_EXPORT uint
modX( KKey::ModFlag modFlag );
00268
00275 KDECORE_EXPORT
bool keyboardHasWinKey();
00276
00282 KDECORE_EXPORT uint
modXShift();
00283
00289 KDECORE_EXPORT uint
modXLock();
00290
00296 KDECORE_EXPORT uint
modXCtrl();
00297
00303 KDECORE_EXPORT uint
modXAlt();
00304
00310 KDECORE_EXPORT uint
modXNumLock();
00311
00318 KDECORE_EXPORT uint
modXWin();
00319
00325 KDECORE_EXPORT uint
modXScrollLock();
00326
00333 KDECORE_EXPORT uint
modXModeSwitch();
00334
00346 KDECORE_EXPORT uint
accelModMaskX();
00347
00357 KDECORE_EXPORT
bool keyQtToSym(
int keyQt, uint& sym );
00358
00367 KDECORE_EXPORT
bool keyQtToMod(
int keyQt, uint& mod );
00368
00377 KDECORE_EXPORT
bool symToKeyQt( uint sym,
int& keyQt );
00378
00389 KDECORE_EXPORT
bool modToModQt( uint mod,
int& modQt );
00390
00400 KDECORE_EXPORT
bool modToModX( uint mod, uint& modX );
00401
00411
00412 KDECORE_EXPORT
bool modXToModQt( uint modX,
int& modQt );
00413
00417 KDECORE_EXPORT
int qtButtonStateToMod( Qt::ButtonState s );
00418
00428 KDECORE_EXPORT
bool modXToMod( uint modX, uint& mod );
00429
00441 KDECORE_EXPORT
bool codeXToSym( uchar codeX, uint modX, uint& symX );
00442
00446 KDECORE_EXPORT
QString modToStringInternal( uint mod );
00447
00454 KDECORE_EXPORT
QString modToStringUser( uint mod );
00455
00460 KDECORE_EXPORT
bool stringToSymMod(
const QString&, uint& sym, uint& mod );
00461
00466 KDECORE_EXPORT
void keyQtToKeyX( uint keyCombQt,
unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX );
00467 }
00468
00469
#endif // !_KKEYSERVER_X11_H