• Main Page
  • Classes
  • Files
  • File List

KeyTypes.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2012 Bolton Software Ltd.
00004  * Copyright (C) 2002 Chris Schoeneman
00005  * 
00006  * This package is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * found in the file COPYING that should have accompanied this file.
00009  * 
00010  * This package is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #ifndef KEYTYPES_H
00020 #define KEYTYPES_H
00021 
00022 #include "BasicTypes.h"
00023 
00025 
00030 typedef UInt32          KeyID;
00031 
00033 
00039 typedef UInt16          KeyButton;
00040 
00042 
00045 typedef UInt32          KeyModifierMask;
00046 
00048 
00051 typedef UInt32          KeyModifierID;
00052 
00054 
00055 static const KeyModifierMask    KeyModifierShift      = 0x0001;
00056 static const KeyModifierMask    KeyModifierControl    = 0x0002;
00057 static const KeyModifierMask    KeyModifierAlt        = 0x0004;
00058 static const KeyModifierMask    KeyModifierMeta       = 0x0008;
00059 static const KeyModifierMask    KeyModifierSuper      = 0x0010;
00060 static const KeyModifierMask    KeyModifierAltGr      = 0x0020;
00061 static const KeyModifierMask    KeyModifierLevel5Lock = 0x0040;
00062 static const KeyModifierMask    KeyModifierCapsLock   = 0x1000;
00063 static const KeyModifierMask    KeyModifierNumLock    = 0x2000;
00064 static const KeyModifierMask    KeyModifierScrollLock = 0x4000;
00066 
00068 
00069 static const UInt32             kKeyModifierBitNone       = 16;
00070 static const UInt32             kKeyModifierBitShift      = 0;
00071 static const UInt32             kKeyModifierBitControl    = 1;
00072 static const UInt32             kKeyModifierBitAlt        = 2;
00073 static const UInt32             kKeyModifierBitMeta       = 3;
00074 static const UInt32             kKeyModifierBitSuper      = 4;
00075 static const UInt32             kKeyModifierBitAltGr      = 5;
00076 static const UInt32             kKeyModifierBitLevel5Lock = 6;
00077 static const UInt32             kKeyModifierBitCapsLock   = 12;
00078 static const UInt32             kKeyModifierBitNumLock    = 13;
00079 static const UInt32             kKeyModifierBitScrollLock = 14;
00080 static const SInt32             kKeyModifierNumBits       = 16;
00082 
00084 
00085 static const KeyModifierID      kKeyModifierIDNull     = 0;
00086 static const KeyModifierID      kKeyModifierIDShift    = 1;
00087 static const KeyModifierID      kKeyModifierIDControl  = 2;
00088 static const KeyModifierID      kKeyModifierIDAlt      = 3;
00089 static const KeyModifierID      kKeyModifierIDMeta     = 4;
00090 static const KeyModifierID      kKeyModifierIDSuper    = 5;
00091 static const KeyModifierID      kKeyModifierIDAltGr    = 6;
00092 static const KeyModifierID      kKeyModifierIDLast     = 7;
00094 
00096 
00097 // all identifiers except kKeyNone and those in 0xE000 to 0xE0FF
00098 // inclusive are equal to the corresponding X11 keysym - 0x1000.
00099 
00100 // no key
00101 static const KeyID      kKeyNone        = 0x0000;
00102 
00103 // TTY functions
00104 static const KeyID      kKeyBackSpace   = 0xEF08;   /* back space, back char */
00105 static const KeyID      kKeyTab         = 0xEF09;
00106 static const KeyID      kKeyLinefeed    = 0xEF0A;   /* Linefeed, LF */
00107 static const KeyID      kKeyClear       = 0xEF0B;
00108 static const KeyID      kKeyReturn      = 0xEF0D;   /* Return, enter */
00109 static const KeyID      kKeyPause       = 0xEF13;   /* Pause, hold */
00110 static const KeyID      kKeyScrollLock  = 0xEF14;
00111 static const KeyID      kKeySysReq      = 0xEF15;
00112 static const KeyID      kKeyEscape      = 0xEF1B;
00113 static const KeyID      kKeyHenkan      = 0xEF23;   /* Start/Stop Conversion */
00114 static const KeyID      kKeyHangulKana  = 0xEF26;   /* Hangul, Kana */
00115 static const KeyID      kKeyHiraganaKatakana = 0xEF27;  /* Hiragana/Katakana toggle */
00116 static const KeyID      kKeyZenkaku     = 0xEF2A;   /* Zenkaku/Hankaku */
00117 static const KeyID      kKeyHanjaKanzi  = 0xEF2A;   /* Hanja, Kanzi */
00118 static const KeyID      kKeyDelete      = 0xEFFF;   /* Delete, rubout */
00119 
00120 // cursor control
00121 static const KeyID      kKeyHome        = 0xEF50;
00122 static const KeyID      kKeyLeft        = 0xEF51;   /* Move left, left arrow */
00123 static const KeyID      kKeyUp          = 0xEF52;   /* Move up, up arrow */
00124 static const KeyID      kKeyRight       = 0xEF53;   /* Move right, right arrow */
00125 static const KeyID      kKeyDown        = 0xEF54;   /* Move down, down arrow */
00126 static const KeyID      kKeyPageUp      = 0xEF55;
00127 static const KeyID      kKeyPageDown    = 0xEF56;
00128 static const KeyID      kKeyEnd         = 0xEF57;   /* EOL */
00129 static const KeyID      kKeyBegin       = 0xEF58;   /* BOL */
00130 
00131 // misc functions
00132 static const KeyID      kKeySelect      = 0xEF60;   /* Select, mark */
00133 static const KeyID      kKeyPrint       = 0xEF61;
00134 static const KeyID      kKeyExecute     = 0xEF62;   /* Execute, run, do */
00135 static const KeyID      kKeyInsert      = 0xEF63;   /* Insert, insert here */
00136 static const KeyID      kKeyUndo        = 0xEF65;   /* Undo, oops */
00137 static const KeyID      kKeyRedo        = 0xEF66;   /* redo, again */
00138 static const KeyID      kKeyMenu        = 0xEF67;
00139 static const KeyID      kKeyFind        = 0xEF68;   /* Find, search */
00140 static const KeyID      kKeyCancel      = 0xEF69;   /* Cancel, stop, abort, exit */
00141 static const KeyID      kKeyHelp        = 0xEF6A;   /* Help */
00142 static const KeyID      kKeyBreak       = 0xEF6B;
00143 static const KeyID      kKeyAltGr       = 0xEF7E;   /* Character set switch */
00144 static const KeyID      kKeyNumLock     = 0xEF7F;
00145 
00146 // keypad
00147 static const KeyID      kKeyKP_Space    = 0xEF80;   /* space */
00148 static const KeyID      kKeyKP_Tab      = 0xEF89;
00149 static const KeyID      kKeyKP_Enter    = 0xEF8D;   /* enter */
00150 static const KeyID      kKeyKP_F1       = 0xEF91;   /* PF1, KP_A, ... */
00151 static const KeyID      kKeyKP_F2       = 0xEF92;
00152 static const KeyID      kKeyKP_F3       = 0xEF93;
00153 static const KeyID      kKeyKP_F4       = 0xEF94;
00154 static const KeyID      kKeyKP_Home     = 0xEF95;
00155 static const KeyID      kKeyKP_Left     = 0xEF96;
00156 static const KeyID      kKeyKP_Up       = 0xEF97;
00157 static const KeyID      kKeyKP_Right    = 0xEF98;
00158 static const KeyID      kKeyKP_Down     = 0xEF99;
00159 static const KeyID      kKeyKP_PageUp   = 0xEF9A;
00160 static const KeyID      kKeyKP_PageDown = 0xEF9B;
00161 static const KeyID      kKeyKP_End      = 0xEF9C;
00162 static const KeyID      kKeyKP_Begin    = 0xEF9D;
00163 static const KeyID      kKeyKP_Insert   = 0xEF9E;
00164 static const KeyID      kKeyKP_Delete   = 0xEF9F;
00165 static const KeyID      kKeyKP_Equal    = 0xEFBD;   /* equals */
00166 static const KeyID      kKeyKP_Multiply = 0xEFAA;
00167 static const KeyID      kKeyKP_Add      = 0xEFAB;
00168 static const KeyID      kKeyKP_Separator= 0xEFAC;   /* separator, often comma */
00169 static const KeyID      kKeyKP_Subtract = 0xEFAD;
00170 static const KeyID      kKeyKP_Decimal  = 0xEFAE;
00171 static const KeyID      kKeyKP_Divide   = 0xEFAF;
00172 static const KeyID      kKeyKP_0        = 0xEFB0; 
00173 static const KeyID      kKeyKP_1        = 0xEFB1;
00174 static const KeyID      kKeyKP_2        = 0xEFB2;
00175 static const KeyID      kKeyKP_3        = 0xEFB3;
00176 static const KeyID      kKeyKP_4        = 0xEFB4;
00177 static const KeyID      kKeyKP_5        = 0xEFB5;
00178 static const KeyID      kKeyKP_6        = 0xEFB6;
00179 static const KeyID      kKeyKP_7        = 0xEFB7;
00180 static const KeyID      kKeyKP_8        = 0xEFB8;
00181 static const KeyID      kKeyKP_9        = 0xEFB9;
00182 
00183 // function keys
00184 static const KeyID      kKeyF1          = 0xEFBE;
00185 static const KeyID      kKeyF2          = 0xEFBF;
00186 static const KeyID      kKeyF3          = 0xEFC0;
00187 static const KeyID      kKeyF4          = 0xEFC1;
00188 static const KeyID      kKeyF5          = 0xEFC2;
00189 static const KeyID      kKeyF6          = 0xEFC3;
00190 static const KeyID      kKeyF7          = 0xEFC4;
00191 static const KeyID      kKeyF8          = 0xEFC5;
00192 static const KeyID      kKeyF9          = 0xEFC6;
00193 static const KeyID      kKeyF10         = 0xEFC7;
00194 static const KeyID      kKeyF11         = 0xEFC8;
00195 static const KeyID      kKeyF12         = 0xEFC9;
00196 static const KeyID      kKeyF13         = 0xEFCA;
00197 static const KeyID      kKeyF14         = 0xEFCB;
00198 static const KeyID      kKeyF15         = 0xEFCC;
00199 static const KeyID      kKeyF16         = 0xEFCD;
00200 static const KeyID      kKeyF17         = 0xEFCE;
00201 static const KeyID      kKeyF18         = 0xEFCF;
00202 static const KeyID      kKeyF19         = 0xEFD0;
00203 static const KeyID      kKeyF20         = 0xEFD1;
00204 static const KeyID      kKeyF21         = 0xEFD2;
00205 static const KeyID      kKeyF22         = 0xEFD3;
00206 static const KeyID      kKeyF23         = 0xEFD4;
00207 static const KeyID      kKeyF24         = 0xEFD5;
00208 static const KeyID      kKeyF25         = 0xEFD6;
00209 static const KeyID      kKeyF26         = 0xEFD7;
00210 static const KeyID      kKeyF27         = 0xEFD8;
00211 static const KeyID      kKeyF28         = 0xEFD9;
00212 static const KeyID      kKeyF29         = 0xEFDA;
00213 static const KeyID      kKeyF30         = 0xEFDB;
00214 static const KeyID      kKeyF31         = 0xEFDC;
00215 static const KeyID      kKeyF32         = 0xEFDD;
00216 static const KeyID      kKeyF33         = 0xEFDE;
00217 static const KeyID      kKeyF34         = 0xEFDF;
00218 static const KeyID      kKeyF35         = 0xEFE0;
00219 
00220 // modifiers
00221 static const KeyID      kKeyShift_L     = 0xEFE1;   /* Left shift */
00222 static const KeyID      kKeyShift_R     = 0xEFE2;   /* Right shift */
00223 static const KeyID      kKeyControl_L   = 0xEFE3;   /* Left control */
00224 static const KeyID      kKeyControl_R   = 0xEFE4;   /* Right control */
00225 static const KeyID      kKeyCapsLock    = 0xEFE5;   /* Caps lock */
00226 static const KeyID      kKeyShiftLock   = 0xEFE6;   /* Shift lock */
00227 static const KeyID      kKeyMeta_L      = 0xEFE7;   /* Left meta */
00228 static const KeyID      kKeyMeta_R      = 0xEFE8;   /* Right meta */
00229 static const KeyID      kKeyAlt_L       = 0xEFE9;   /* Left alt */
00230 static const KeyID      kKeyAlt_R       = 0xEFEA;   /* Right alt */
00231 static const KeyID      kKeySuper_L     = 0xEFEB;   /* Left super */
00232 static const KeyID      kKeySuper_R     = 0xEFEC;   /* Right super */
00233 static const KeyID      kKeyHyper_L     = 0xEFED;   /* Left hyper */
00234 static const KeyID      kKeyHyper_R     = 0xEFEE;   /* Right hyper */
00235 
00236 // multi-key character composition
00237 static const KeyID      kKeyCompose         = 0xEF20;
00238 static const KeyID      kKeyDeadGrave       = 0x0300;
00239 static const KeyID      kKeyDeadAcute       = 0x0301;
00240 static const KeyID      kKeyDeadCircumflex  = 0x0302;
00241 static const KeyID      kKeyDeadTilde       = 0x0303;
00242 static const KeyID      kKeyDeadMacron      = 0x0304;
00243 static const KeyID      kKeyDeadBreve       = 0x0306;
00244 static const KeyID      kKeyDeadAbovedot    = 0x0307;
00245 static const KeyID      kKeyDeadDiaeresis   = 0x0308;
00246 static const KeyID      kKeyDeadAbovering   = 0x030a;
00247 static const KeyID      kKeyDeadDoubleacute = 0x030b;
00248 static const KeyID      kKeyDeadCaron       = 0x030c;
00249 static const KeyID      kKeyDeadCedilla     = 0x0327;
00250 static const KeyID      kKeyDeadOgonek      = 0x0328;
00251 
00252 // more function and modifier keys
00253 static const KeyID      kKeyLeftTab         = 0xEE20;
00254 
00255 // update modifiers
00256 static const KeyID      kKeySetModifiers    = 0xEE06;
00257 static const KeyID      kKeyClearModifiers  = 0xEE07;
00258 
00259 // group change
00260 static const KeyID      kKeyNextGroup       = 0xEE08;
00261 static const KeyID      kKeyPrevGroup       = 0xEE0A;
00262 
00263 // extended keys
00264 static const KeyID      kKeyEject           = 0xE001;
00265 static const KeyID      kKeySleep           = 0xE05F;
00266 static const KeyID      kKeyWWWBack         = 0xE0A6;
00267 static const KeyID      kKeyWWWForward      = 0xE0A7;
00268 static const KeyID      kKeyWWWRefresh      = 0xE0A8;
00269 static const KeyID      kKeyWWWStop         = 0xE0A9;
00270 static const KeyID      kKeyWWWSearch       = 0xE0AA;
00271 static const KeyID      kKeyWWWFavorites    = 0xE0AB;
00272 static const KeyID      kKeyWWWHome         = 0xE0AC;
00273 static const KeyID      kKeyAudioMute       = 0xE0AD;
00274 static const KeyID      kKeyAudioDown       = 0xE0AE;
00275 static const KeyID      kKeyAudioUp         = 0xE0AF;
00276 static const KeyID      kKeyAudioNext       = 0xE0B0;
00277 static const KeyID      kKeyAudioPrev       = 0xE0B1;
00278 static const KeyID      kKeyAudioStop       = 0xE0B2;
00279 static const KeyID      kKeyAudioPlay       = 0xE0B3;
00280 static const KeyID      kKeyAppMail         = 0xE0B4;
00281 static const KeyID      kKeyAppMedia        = 0xE0B5;
00282 static const KeyID      kKeyAppUser1        = 0xE0B6;
00283 static const KeyID      kKeyAppUser2        = 0xE0B7;
00284 
00286 
00287 struct KeyNameMapEntry {
00288 public:
00289     const char*         m_name;
00290     KeyID               m_id;
00291 };
00292 struct KeyModifierNameMapEntry {
00293 public:
00294     const char*         m_name;
00295     KeyModifierMask     m_mask;
00296 };
00297 
00299 
00304 extern const KeyNameMapEntry kKeyNameMap[];
00305 
00307 
00311 extern const KeyModifierNameMapEntry kModifierNameMap[];
00312 
00313 #endif

Generated on Tue May 21 2013 00:00:06 for Synergy by  doxygen 1.7.1