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/CPMScreen.h

    r2751 r2752  
    22 * synergy -- mouse and keyboard sharing utility
    33 * Copyright (C) 2002 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 CMSWINDOWSSCREEN_H
    16 #define CMSWINDOWSSCREEN_H
     16#ifndef CPMSCREEN_H
     17#define CPMSCREEN_H
    1718
    1819#include "CPlatformScreen.h"
    19 #include "CSynergyHook.h"
     20#include "CPMSynergyHook.h"
    2021#include "CCondVar.h"
    2122#include "CMutex.h"
    2223#include "CString.h"
    23 #define WIN32_LEAN_AND_MEAN
    24 #include <windows.h>
     24#define INCL_ERRORS
     25#define INCL_BASE
     26#define INCL_PM
     27#include <os2.h>
     28
    2529
    2630class CEventQueueTimer;
    27 class CMSWindowsDesks;
    28 class CMSWindowsKeyState;
    29 class CMSWindowsScreenSaver;
     31class CPMDesks;
     32class CPMKeyState;
     33class CPMScreenSaver;
    3034class CThread;
    3135
    32 //! Implementation of IPlatformScreen for Microsoft Windows
    33 class CMSWindowsScreen : public CPlatformScreen {
     36//! Implementation of IPlatformScreen for PM
     37class CPMScreen : public CPlatformScreen {
    3438public:
    35         CMSWindowsScreen(bool isPrimary);
    36         virtual ~CMSWindowsScreen();
    37 
    38         //! @name manipulators
    39         //@{
    40 
    41         //! Initialize
    42         /*!
    43         Saves the application's HINSTANCE.  This \b must be called by
    44         WinMain with the HINSTANCE it was passed.
    45         */
    46         static void                     init(HINSTANCE);
    47 
    48         //@}
    49         //! @name accessors
    50         //@{
    51 
    52         //! Get instance
    53         /*!
    54         Returns the application instance handle passed to init().
    55         */
    56         static HINSTANCE        getInstance();
    57 
    58         //@}
     39        CPMScreen(bool isPrimary);
     40        virtual ~CPMScreen();
    5941
    6042        // IScreen overrides
    6143        virtual void*           getEventTarget() const;
    6244        virtual bool            getClipboard(ClipboardID id, IClipboard*) const;
    63         virtual void            getShape(SInt32& x, SInt32& y,
    64                                                         SInt32& width, SInt32& height) const;
     45        virtual void            getShape(SInt32& x, SInt32& y, SInt32& cx, SInt32& cy) const;
    6546        virtual void            getCursorPos(SInt32& x, SInt32& y) const;
    6647
     
    11596private:
    11697        // initialization and shutdown operations
    117         HINSTANCE                       openHookLibrary(const char* name);
    118         void                            closeHookLibrary(HINSTANCE hookLibrary) const;
    119         HCURSOR                         createBlankCursor() const;
    120         void                            destroyCursor(HCURSOR cursor) const;
     98        HMODULE                         openHookLibrary(const char* name);
     99        void                            closeHookLibrary(HMODULE hookLibrary) const;
    121100        ATOM                            createWindowClass() const;
    122101        ATOM                            createDeskWindowClass(bool isPrimary) const;
     
    131110        // handle message before it gets dispatched.  returns true iff
    132111        // the message should not be dispatched.
    133         bool                            onPreDispatch(HWND, UINT, WPARAM, LPARAM);
     112        bool                            onPreDispatch(HWND, ULONG, MPARAM, MPARAM);
    134113
    135114        // handle message before it gets dispatched.  returns true iff
    136115        // the message should not be dispatched.
    137         bool                            onPreDispatchPrimary(HWND, UINT, WPARAM, LPARAM);
     116        bool                            onPreDispatchPrimary(HWND, ULONG, MPARAM, MPARAM);
    138117
    139118        // handle message.  returns true iff handled and optionally sets
    140119        // \c *result (which defaults to 0).
    141         bool                            onEvent(HWND, UINT, WPARAM, LPARAM, LRESULT* result);
     120        bool                            onEvent(HWND, ULONG, MPARAM, MPARAM, MRESULT*);
    142121
    143122        // message handlers
    144123        bool                            onMark(UInt32 mark);
    145         bool                            onKey(WPARAM, LPARAM);
    146         bool                            onHotKey(WPARAM, LPARAM);
    147         bool                            onMouseButton(WPARAM, LPARAM);
     124        bool                            onKey(MPARAM, MPARAM);
     125        bool                            onHotKey(MPARAM, MPARAM);
     126        bool                            onMouseButton(MPARAM, MPARAM);
    148127        bool                            onMouseMove(SInt32 x, SInt32 y);
    149128        bool                            onMouseWheel(SInt32 xDelta, SInt32 yDelta);
     
    167146        void                            handleFixes(const CEvent&, void*);
    168147
    169         // fix the clipboard viewer chain
    170         void                            fixClipboardViewer();
    171 
    172148        // enable/disable special key combinations so we can catch/pass them
    173149        void                            enableSpecialKeys(bool) const;
    174150
    175151        // map a button event to a button ID
    176         ButtonID                        mapButtonFromEvent(WPARAM msg, LPARAM button) const;
     152        ButtonID                        mapButtonFromEvent(ULONG msg, MPARAM button) const;
    177153
    178154        // map a button event to a press (true) or release (false)
    179         bool                            mapPressFromEvent(WPARAM msg, LPARAM button) const;
     155        bool                            mapPressFromEvent(ULONG msg, MPARAM button) const;
    180156
    181157        // job to update the key state
     
    193169
    194170        // our window proc
    195         static LRESULT CALLBACK wndProc(HWND, UINT, WPARAM, LPARAM);
     171        static MRESULT EXPENTRY wndProc(HWND, ULONG, MPARAM, MPARAM);
    196172
    197173private:
    198174        struct CHotKeyItem {
    199175        public:
    200                 CHotKeyItem(UINT vk, UINT modifiers);
    201 
    202                 UINT                    getVirtualKey() const;
     176                CHotKeyItem(ULONG vk, ULONG modifiers);
     177
     178                ULONG                   getVirtualKey() const;
    203179
    204180                bool                    operator<(const CHotKeyItem&) const;
    205181
    206182        private:
    207                 UINT                    m_keycode;
    208                 UINT                    m_mask;
     183                ULONG                   m_keycode;
     184                ULONG                   m_mask;
    209185        };
    210186        typedef std::map<UInt32, CHotKeyItem> HotKeyMap;
     
    212188        typedef std::map<CHotKeyItem, UInt32> HotKeyToIDMap;
    213189
    214         static HINSTANCE        s_instance;
    215 
    216190        // true if screen is being used as a primary screen, false otherwise
    217191        bool                            m_isPrimary;
    218 
    219         // true if windows 95/98/me
    220         bool                            m_is95Family;
    221 
    222         // true if mouse has entered the screen
    223192        bool                            m_isOnScreen;
    224193
     
    228197        // screen shape stuff
    229198        SInt32                          m_x, m_y;
    230         SInt32                          m_w, m_h;
     199        SInt32                          m_cx, m_cy;
    231200        SInt32                          m_xCenter, m_yCenter;
    232201
     
    245214
    246215        // the main loop's thread id
    247         DWORD                           m_threadID;
     216        int                                     m_threadID;
    248217
    249218        // timer for periodically checking stuff that requires polling
    250219        CEventQueueTimer*       m_fixTimer;
    251220
    252         // the keyboard layout to use when off primary screen
    253         HKL                                     m_keyLayout;
    254 
    255221        // screen saver stuff
    256         CMSWindowsScreenSaver*  m_screensaver;
     222        CPMScreenSaver* m_screensaver;
    257223        bool                                    m_screensaverNotify;
    258224        bool                                    m_screensaverActive;
     
    264230        bool                            m_ownClipboard;
    265231
    266         // one desk per desktop and a cond var to communicate with it
    267         CMSWindowsDesks*        m_desks;
    268 
    269232        // hook library stuff
    270         HINSTANCE                       m_hookLibrary;
     233        HMODULE                         m_hmodHook;
    271234        InitFunc                        m_init;
    272235        CleanupFunc                     m_cleanup;
     
    276239
    277240        // keyboard stuff
    278         CMSWindowsKeyState*     m_keyState;
     241        CPMKeyState*            m_keyState;
    279242
    280243        // hot key stuff
     
    286249        bool                            m_buttons[1 + kButtonExtra0 + 1];
    287250
    288         // the system shows the mouse cursor when an internal display count
    289         // is >= 0.  this count is maintained per application but there's
    290         // apparently a system wide count added to the application's count.
    291         // this system count is 0 if there's a mouse attached to the system
    292         // and -1 otherwise.  the MouseKeys accessibility feature can modify
    293         // this system count by making the system appear to have a mouse.
    294         //
    295         // m_hasMouse is true iff there's a mouse attached to the system or
    296         // MouseKeys is simulating one.  we track this so we can force the
    297         // cursor to be displayed when the user has entered this screen.
    298         // m_showingMouse is true when we're doing that.
    299251        bool                            m_hasMouse;
    300252        bool                            m_showingMouse;
    301         bool                            m_gotOldMouseKeys;
    302         MOUSEKEYS                       m_mouseKeys;
    303         MOUSEKEYS                       m_oldMouseKeys;
    304 
    305         static CMSWindowsScreen*        s_screen;
     253
     254        static CPMScreen*       s_screen;
    306255};
    307256
Note: See TracChangeset for help on using the changeset viewer.