Ignore:
Timestamp:
Jul 29, 2006, 6:43:07 AM (19 years ago)
Author:
bird
Message:

Two classes (CPMScreen and CPMKeyState) + the hook dll left (and debugging of course).

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/synergy/lib/platform/CPMKeyState.h

    r2751 r2752  
    22 * synergy -- mouse and keyboard sharing utility
    33 * Copyright (C) 2003 Chris Schoeneman
     4 * Copyright (C) 2006 Knut St. Osmundsen
    45 *
    56 * This package is free software; you can redistribute it and/or
     
    1314 */
    1415
    15 #ifndef CMSWINDOWSKEYSTATE_H
    16 #define CMSWINDOWSKEYSTATE_H
     16#ifndef CPMKEYSTATE_H
     17#define CPMKEYSTATE_H
    1718
    1819#include "CKeyState.h"
    1920#include "CString.h"
    2021#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>
    2326
    2427class CEvent;
    2528class CEventQueueTimer;
    26 class CMSWindowsDesks;
    2729
    2830//! Microsoft Windows key mapper
     
    3032This class maps KeyIDs to keystrokes.
    3133*/
    32 class CMSWindowsKeyState : public CKeyState {
     34class CPMKeyState : public CKeyState {
    3335public:
    34         CMSWindowsKeyState(CMSWindowsDesks* desks, void* eventTarget);
    35         virtual ~CMSWindowsKeyState();
     36        CPMKeyState(void* eventTarget);
     37        virtual ~CPMKeyState();
    3638
    3739        //! @name manipulators
     
    4446        */
    4547        void                            disable();
    46 
    47         //! Set the active keyboard layout
    48         /*!
    49         Uses \p keyLayout when querying the keyboard.
    50         */
    51         void                            setKeyLayout(HKL keyLayout);
    5248
    5349        //! Test and set autorepeat state
     
    8783        Returns the button for the \p virtualKey.
    8884        */
    89         KeyButton                       virtualKeyToButton(UINT virtualKey) const;
     85        KeyButton                       virtualKeyToButton(ULONG virtualKey) const;
    9086
    9187        //! Map key event to a key
     
    9490        to a modifier mask.
    9591        */
    96         KeyID                           mapKeyFromEvent(WPARAM charAndVirtKey,
    97                                                         LPARAM info, KeyModifierMask* maskOut) const;
     92        KeyID                           mapKeyFromEvent(MPARAM charAndVirtKey, MPARAM info, KeyModifierMask* maskOut) const;
    9893
    9994        //! Check if keyboard groups have changed
     
    109104        key.
    110105        */
    111         UINT                            mapKeyToVirtualKey(KeyID key) const;
     106        ULONG                           mapKeyToVirtualKey(KeyID key) const;
    112107
    113108        //! Map virtual key and button to KeyID
     
    117112        no such key.
    118113        */
    119         static KeyID            getKeyID(UINT virtualKey, KeyButton button);
     114        static KeyID            getKeyID(ULONG virtualKey, KeyButton button);
    120115
    121116        //@}
     
    148143
    149144private:
    150         typedef std::vector<HKL> GroupList;
    151 
    152         // send ctrl+alt+del hotkey event on NT family
    153         static void                     ctrlAltDelThread(void*);
    154 
    155         bool                            getGroups(GroupList&) const;
    156         void                            setWindowGroup(SInt32 group);
    157 
    158145        void                            fixKeys();
    159146        void                            handleFixKeys(const CEvent&, void*);
    160147
    161148        KeyID                           getIDForKey(CKeyMap::KeyItem& item,
    162                                                         KeyButton button, UINT virtualKey,
    163                                                         PBYTE keyState, HKL hkl) const;
     149                                                        KeyButton button, ULONG virtualKey,
     150                                                        PBYTE keyState) const;
    164151
    165152        void                            addKeyEntry(CKeyMap& keyMap, CKeyMap::KeyItem& item);
     
    167154private:
    168155        // not implemented
    169         CMSWindowsKeyState(const CMSWindowsKeyState&);
    170         CMSWindowsKeyState& operator=(const CMSWindowsKeyState&);
     156        CPMKeyState(const CPMKeyState&);
     157        CPMKeyState& operator=(const CPMKeyState&);
    171158
    172159private:
    173         typedef std::map<HKL, SInt32> GroupMap;
    174         typedef std::map<KeyID, UINT> KeyToVKMap;
     160        typedef std::map<KeyID, ULONG> KeyToVKMap;
    175161
    176         bool                            m_is95Family;
    177162        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];
    182165        KeyButton                       m_virtualKeyToButton[256];
    183166        KeyToVKMap                      m_keyToVKMap;
     
    185168        // the timer used to check for fixing key state
    186169        CEventQueueTimer*       m_fixTimer;
    187 
    188         // the groups (keyboard layouts)
    189         GroupList                       m_groups;
    190         GroupMap                        m_groupMap;
    191170
    192171        // the last button that we generated a key down event for.  this
     
    201180        KeyModifierMask         m_originalSavedModifiers;
    202181
    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];
    214183};
    215184
Note: See TracChangeset for help on using the changeset viewer.