Changeset 2752 for trunk/synergy/lib/platform/CPMScreen.h
- Timestamp:
- Jul 29, 2006, 6:43:07 AM (19 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/synergy/lib/platform/CPMScreen.h
r2751 r2752 2 2 * synergy -- mouse and keyboard sharing utility 3 3 * Copyright (C) 2002 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 MSWINDOWSSCREEN_H16 #define C MSWINDOWSSCREEN_H16 #ifndef CPMSCREEN_H 17 #define CPMSCREEN_H 17 18 18 19 #include "CPlatformScreen.h" 19 #include "C SynergyHook.h"20 #include "CPMSynergyHook.h" 20 21 #include "CCondVar.h" 21 22 #include "CMutex.h" 22 23 #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 25 29 26 30 class CEventQueueTimer; 27 class C MSWindowsDesks;28 class C MSWindowsKeyState;29 class C MSWindowsScreenSaver;31 class CPMDesks; 32 class CPMKeyState; 33 class CPMScreenSaver; 30 34 class CThread; 31 35 32 //! Implementation of IPlatformScreen for Microsoft Windows33 class C MSWindowsScreen : public CPlatformScreen {36 //! Implementation of IPlatformScreen for PM 37 class CPMScreen : public CPlatformScreen { 34 38 public: 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(); 59 41 60 42 // IScreen overrides 61 43 virtual void* getEventTarget() const; 62 44 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; 65 46 virtual void getCursorPos(SInt32& x, SInt32& y) const; 66 47 … … 115 96 private: 116 97 // 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; 121 100 ATOM createWindowClass() const; 122 101 ATOM createDeskWindowClass(bool isPrimary) const; … … 131 110 // handle message before it gets dispatched. returns true iff 132 111 // the message should not be dispatched. 133 bool onPreDispatch(HWND, U INT, WPARAM, LPARAM);112 bool onPreDispatch(HWND, ULONG, MPARAM, MPARAM); 134 113 135 114 // handle message before it gets dispatched. returns true iff 136 115 // the message should not be dispatched. 137 bool onPreDispatchPrimary(HWND, U INT, WPARAM, LPARAM);116 bool onPreDispatchPrimary(HWND, ULONG, MPARAM, MPARAM); 138 117 139 118 // handle message. returns true iff handled and optionally sets 140 119 // \c *result (which defaults to 0). 141 bool onEvent(HWND, U INT, WPARAM, LPARAM, LRESULT* result);120 bool onEvent(HWND, ULONG, MPARAM, MPARAM, MRESULT*); 142 121 143 122 // message handlers 144 123 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); 148 127 bool onMouseMove(SInt32 x, SInt32 y); 149 128 bool onMouseWheel(SInt32 xDelta, SInt32 yDelta); … … 167 146 void handleFixes(const CEvent&, void*); 168 147 169 // fix the clipboard viewer chain170 void fixClipboardViewer();171 172 148 // enable/disable special key combinations so we can catch/pass them 173 149 void enableSpecialKeys(bool) const; 174 150 175 151 // map a button event to a button ID 176 ButtonID mapButtonFromEvent( WPARAM msg, LPARAM button) const;152 ButtonID mapButtonFromEvent(ULONG msg, MPARAM button) const; 177 153 178 154 // 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; 180 156 181 157 // job to update the key state … … 193 169 194 170 // our window proc 195 static LRESULT CALLBACK wndProc(HWND, UINT, WPARAM, LPARAM);171 static MRESULT EXPENTRY wndProc(HWND, ULONG, MPARAM, MPARAM); 196 172 197 173 private: 198 174 struct CHotKeyItem { 199 175 public: 200 CHotKeyItem(U INT vk, UINTmodifiers);201 202 U INTgetVirtualKey() const;176 CHotKeyItem(ULONG vk, ULONG modifiers); 177 178 ULONG getVirtualKey() const; 203 179 204 180 bool operator<(const CHotKeyItem&) const; 205 181 206 182 private: 207 U INTm_keycode;208 U INTm_mask;183 ULONG m_keycode; 184 ULONG m_mask; 209 185 }; 210 186 typedef std::map<UInt32, CHotKeyItem> HotKeyMap; … … 212 188 typedef std::map<CHotKeyItem, UInt32> HotKeyToIDMap; 213 189 214 static HINSTANCE s_instance;215 216 190 // true if screen is being used as a primary screen, false otherwise 217 191 bool m_isPrimary; 218 219 // true if windows 95/98/me220 bool m_is95Family;221 222 // true if mouse has entered the screen223 192 bool m_isOnScreen; 224 193 … … 228 197 // screen shape stuff 229 198 SInt32 m_x, m_y; 230 SInt32 m_ w, m_h;199 SInt32 m_cx, m_cy; 231 200 SInt32 m_xCenter, m_yCenter; 232 201 … … 245 214 246 215 // the main loop's thread id 247 DWORDm_threadID;216 int m_threadID; 248 217 249 218 // timer for periodically checking stuff that requires polling 250 219 CEventQueueTimer* m_fixTimer; 251 220 252 // the keyboard layout to use when off primary screen253 HKL m_keyLayout;254 255 221 // screen saver stuff 256 C MSWindowsScreenSaver* m_screensaver;222 CPMScreenSaver* m_screensaver; 257 223 bool m_screensaverNotify; 258 224 bool m_screensaverActive; … … 264 230 bool m_ownClipboard; 265 231 266 // one desk per desktop and a cond var to communicate with it267 CMSWindowsDesks* m_desks;268 269 232 // hook library stuff 270 H INSTANCE m_hookLibrary;233 HMODULE m_hmodHook; 271 234 InitFunc m_init; 272 235 CleanupFunc m_cleanup; … … 276 239 277 240 // keyboard stuff 278 C MSWindowsKeyState*m_keyState;241 CPMKeyState* m_keyState; 279 242 280 243 // hot key stuff … … 286 249 bool m_buttons[1 + kButtonExtra0 + 1]; 287 250 288 // the system shows the mouse cursor when an internal display count289 // is >= 0. this count is maintained per application but there's290 // 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 system292 // and -1 otherwise. the MouseKeys accessibility feature can modify293 // 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 or296 // MouseKeys is simulating one. we track this so we can force the297 // cursor to be displayed when the user has entered this screen.298 // m_showingMouse is true when we're doing that.299 251 bool m_hasMouse; 300 252 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; 306 255 }; 307 256
Note:
See TracChangeset
for help on using the changeset viewer.