Changeset 2752 for trunk/synergy/lib/platform/CPMKeyState.h
- Timestamp:
- Jul 29, 2006, 6:43:07 AM (19 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/synergy/lib/platform/CPMKeyState.h
r2751 r2752 2 2 * synergy -- mouse and keyboard sharing utility 3 3 * Copyright (C) 2003 Chris Schoeneman 4 * Copyright (C) 2006 Knut St. Osmundsen 4 5 * 5 6 * This package is free software; you can redistribute it and/or … … 13 14 */ 14 15 15 #ifndef C MSWINDOWSKEYSTATE_H16 #define C MSWINDOWSKEYSTATE_H16 #ifndef CPMKEYSTATE_H 17 #define CPMKEYSTATE_H 17 18 18 19 #include "CKeyState.h" 19 20 #include "CString.h" 20 21 #include "stdvector.h" 21 #define WIN32_LEAN_AND_MEAN 22 #include <windows.h> 22 #define INCL_ERRORS 23 #define INCL_BASE 24 #define INCL_PM 25 #include <os2.h> 23 26 24 27 class CEvent; 25 28 class CEventQueueTimer; 26 class CMSWindowsDesks;27 29 28 30 //! Microsoft Windows key mapper … … 30 32 This class maps KeyIDs to keystrokes. 31 33 */ 32 class C MSWindowsKeyState : public CKeyState {34 class CPMKeyState : public CKeyState { 33 35 public: 34 C MSWindowsKeyState(CMSWindowsDesks* desks,void* eventTarget);35 virtual ~C MSWindowsKeyState();36 CPMKeyState(void* eventTarget); 37 virtual ~CPMKeyState(); 36 38 37 39 //! @name manipulators … … 44 46 */ 45 47 void disable(); 46 47 //! Set the active keyboard layout48 /*!49 Uses \p keyLayout when querying the keyboard.50 */51 void setKeyLayout(HKL keyLayout);52 48 53 49 //! Test and set autorepeat state … … 87 83 Returns the button for the \p virtualKey. 88 84 */ 89 KeyButton virtualKeyToButton(U INTvirtualKey) const;85 KeyButton virtualKeyToButton(ULONG virtualKey) const; 90 86 91 87 //! Map key event to a key … … 94 90 to a modifier mask. 95 91 */ 96 KeyID mapKeyFromEvent(WPARAM charAndVirtKey, 97 LPARAM info, KeyModifierMask* maskOut) const; 92 KeyID mapKeyFromEvent(MPARAM charAndVirtKey, MPARAM info, KeyModifierMask* maskOut) const; 98 93 99 94 //! Check if keyboard groups have changed … … 109 104 key. 110 105 */ 111 U INTmapKeyToVirtualKey(KeyID key) const;106 ULONG mapKeyToVirtualKey(KeyID key) const; 112 107 113 108 //! Map virtual key and button to KeyID … … 117 112 no such key. 118 113 */ 119 static KeyID getKeyID(U INTvirtualKey, KeyButton button);114 static KeyID getKeyID(ULONG virtualKey, KeyButton button); 120 115 121 116 //@} … … 148 143 149 144 private: 150 typedef std::vector<HKL> GroupList;151 152 // send ctrl+alt+del hotkey event on NT family153 static void ctrlAltDelThread(void*);154 155 bool getGroups(GroupList&) const;156 void setWindowGroup(SInt32 group);157 158 145 void fixKeys(); 159 146 void handleFixKeys(const CEvent&, void*); 160 147 161 148 KeyID getIDForKey(CKeyMap::KeyItem& item, 162 KeyButton button, U INTvirtualKey,163 PBYTE keyState , HKL hkl) const;149 KeyButton button, ULONG virtualKey, 150 PBYTE keyState) const; 164 151 165 152 void addKeyEntry(CKeyMap& keyMap, CKeyMap::KeyItem& item); … … 167 154 private: 168 155 // not implemented 169 C MSWindowsKeyState(const CMSWindowsKeyState&);170 C MSWindowsKeyState& operator=(const CMSWindowsKeyState&);156 CPMKeyState(const CPMKeyState&); 157 CPMKeyState& operator=(const CPMKeyState&); 171 158 172 159 private: 173 typedef std::map<HKL, SInt32> GroupMap; 174 typedef std::map<KeyID, UINT> KeyToVKMap; 160 typedef std::map<KeyID, ULONG> KeyToVKMap; 175 161 176 bool m_is95Family;177 162 void* m_eventTarget; 178 CMSWindowsDesks* m_desks; 179 HKL m_keyLayout; 180 UINT m_buttonToVK[512]; 181 UINT m_buttonToNumpadVK[512]; 163 ULONG m_buttonToVK[512]; 164 ULONG m_buttonToNumpadVK[512]; 182 165 KeyButton m_virtualKeyToButton[256]; 183 166 KeyToVKMap m_keyToVKMap; … … 185 168 // the timer used to check for fixing key state 186 169 CEventQueueTimer* m_fixTimer; 187 188 // the groups (keyboard layouts)189 GroupList m_groups;190 GroupMap m_groupMap;191 170 192 171 // the last button that we generated a key down event for. this … … 201 180 KeyModifierMask m_originalSavedModifiers; 202 181 203 // pointer to ToUnicodeEx. on win95 family this will be NULL. 204 typedef int (WINAPI *ToUnicodeEx_t)(UINT wVirtKey, 205 UINT wScanCode, 206 PBYTE lpKeyState, 207 LPWSTR pwszBuff, 208 int cchBuff, 209 UINT wFlags, 210 HKL dwhkl); 211 ToUnicodeEx_t m_ToUnicodeEx; 212 213 static const KeyID s_virtualKey[]; 182 static const KeyID s_virtualKey[0x42]; 214 183 }; 215 184
Note:
See TracChangeset
for help on using the changeset viewer.