2001-11-19 00:33:36 +00:00
|
|
|
#ifndef CMSWINDOWSPRIMARYSCREEN_H
|
|
|
|
#define CMSWINDOWSPRIMARYSCREEN_H
|
|
|
|
|
2002-07-15 15:01:36 +00:00
|
|
|
#include "CPrimaryScreen.h"
|
|
|
|
#include "IMSWindowsScreenEventHandler.h"
|
2002-06-10 22:06:45 +00:00
|
|
|
#include "CSynergyHook.h"
|
2002-06-08 21:48:00 +00:00
|
|
|
#include "MouseTypes.h"
|
|
|
|
#include "CString.h"
|
2001-11-19 00:33:36 +00:00
|
|
|
|
2002-07-15 15:01:36 +00:00
|
|
|
class CMSWindowsScreen;
|
2002-07-11 13:13:37 +00:00
|
|
|
class IScreenReceiver;
|
|
|
|
class IPrimaryScreenReceiver;
|
|
|
|
|
2002-07-15 15:01:36 +00:00
|
|
|
class CMSWindowsPrimaryScreen :
|
|
|
|
public CPrimaryScreen, public IMSWindowsScreenEventHandler {
|
2002-04-29 14:40:01 +00:00
|
|
|
public:
|
2001-11-19 00:33:36 +00:00
|
|
|
typedef bool (CMSWindowsPrimaryScreen::*HookMethod)(int, WPARAM, LPARAM);
|
|
|
|
|
2002-07-11 13:13:37 +00:00
|
|
|
CMSWindowsPrimaryScreen(IScreenReceiver*, IPrimaryScreenReceiver*);
|
2001-11-19 00:33:36 +00:00
|
|
|
virtual ~CMSWindowsPrimaryScreen();
|
|
|
|
|
2002-07-15 15:01:36 +00:00
|
|
|
// CPrimaryScreen overrides
|
2002-07-11 13:13:37 +00:00
|
|
|
virtual void reconfigure(UInt32 activeSides);
|
2002-07-15 15:01:36 +00:00
|
|
|
virtual void warpCursor(SInt32 x, SInt32 y);
|
2002-04-30 17:48:11 +00:00
|
|
|
virtual KeyModifierMask getToggleMask() const;
|
2002-05-24 14:37:12 +00:00
|
|
|
virtual bool isLockedToScreen() const;
|
2002-07-15 15:01:36 +00:00
|
|
|
virtual IScreen* getScreen() const;
|
2001-11-19 00:33:36 +00:00
|
|
|
|
2002-07-15 15:01:36 +00:00
|
|
|
// IMSWindowsScreenEventHandler overrides
|
|
|
|
virtual void onError();
|
|
|
|
virtual void onScreensaver(bool activated);
|
|
|
|
virtual bool onPreDispatch(const CEvent* event);
|
|
|
|
virtual bool onEvent(CEvent* event);
|
|
|
|
virtual SInt32 getJumpZoneSize() const;
|
|
|
|
virtual void postCreateWindow(HWND);
|
|
|
|
virtual void preDestroyWindow(HWND);
|
2002-07-11 13:13:37 +00:00
|
|
|
|
2002-07-15 15:01:36 +00:00
|
|
|
protected:
|
|
|
|
// CPrimaryScreen overrides
|
|
|
|
virtual void onPreRun();
|
|
|
|
virtual void onPreOpen();
|
|
|
|
virtual void onPostOpen();
|
|
|
|
virtual void onPostClose();
|
|
|
|
virtual void onPreEnter();
|
|
|
|
virtual void onPostEnter();
|
|
|
|
virtual void onPreLeave();
|
|
|
|
virtual void onPostLeave(bool);
|
|
|
|
|
|
|
|
virtual void createWindow();
|
|
|
|
virtual void destroyWindow();
|
|
|
|
virtual bool showWindow();
|
|
|
|
virtual void hideWindow();
|
|
|
|
virtual void warpCursorToCenter();
|
|
|
|
|
|
|
|
virtual void updateKeys();
|
2002-06-19 20:24:35 +00:00
|
|
|
|
2002-07-15 15:01:36 +00:00
|
|
|
private:
|
2002-07-12 20:41:23 +00:00
|
|
|
void enterNoWarp();
|
2002-06-08 21:48:00 +00:00
|
|
|
|
2002-07-12 20:41:23 +00:00
|
|
|
// discard posted messages
|
|
|
|
void nextMark();
|
|
|
|
|
2002-06-08 21:48:00 +00:00
|
|
|
// key and button queries
|
2001-11-25 18:32:41 +00:00
|
|
|
KeyID mapKey(WPARAM keycode, LPARAM info,
|
2002-06-10 22:06:45 +00:00
|
|
|
KeyModifierMask* maskOut);
|
2001-11-19 00:33:36 +00:00
|
|
|
ButtonID mapButton(WPARAM button) const;
|
2002-04-30 16:23:03 +00:00
|
|
|
void updateKey(UINT vkCode, bool press);
|
2001-11-19 00:33:36 +00:00
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2002-07-15 15:01:36 +00:00
|
|
|
IPrimaryScreenReceiver* m_receiver;
|
|
|
|
CMSWindowsScreen* m_screen;
|
2002-06-08 21:48:00 +00:00
|
|
|
|
|
|
|
// true if windows 95/98/me
|
2002-06-01 19:26:11 +00:00
|
|
|
bool m_is95Family;
|
2002-06-08 21:48:00 +00:00
|
|
|
|
|
|
|
// the main loop's thread id
|
|
|
|
DWORD m_threadID;
|
|
|
|
|
2002-07-15 15:01:36 +00:00
|
|
|
// our window
|
2001-11-19 00:33:36 +00:00
|
|
|
HWND m_window;
|
2002-06-08 21:48:00 +00:00
|
|
|
|
|
|
|
// used to discard queued messages that are no longer needed
|
|
|
|
UInt32 m_mark;
|
|
|
|
UInt32 m_markReceived;
|
|
|
|
|
|
|
|
// map of key state
|
|
|
|
BYTE m_keys[256];
|
|
|
|
|
2002-06-19 20:24:35 +00:00
|
|
|
// last mouse position
|
|
|
|
SInt32 m_x, m_y;
|
|
|
|
|
2002-06-08 21:48:00 +00:00
|
|
|
// position of center pixel of screen
|
|
|
|
SInt32 m_xCenter, m_yCenter;
|
|
|
|
|
|
|
|
// used to ignore mouse motion
|
|
|
|
SInt32 m_mouseMoveIgnore;
|
|
|
|
|
|
|
|
// hook library stuff
|
|
|
|
HINSTANCE m_hookLibrary;
|
2002-06-23 21:53:31 +00:00
|
|
|
InitFunc m_init;
|
|
|
|
CleanupFunc m_cleanup;
|
2002-06-08 21:48:00 +00:00
|
|
|
InstallFunc m_install;
|
|
|
|
UninstallFunc m_uninstall;
|
2002-07-11 13:13:37 +00:00
|
|
|
SetSidesFunc m_setSides;
|
2002-06-08 21:48:00 +00:00
|
|
|
SetZoneFunc m_setZone;
|
|
|
|
SetRelayFunc m_setRelay;
|
|
|
|
|
|
|
|
// stuff for restoring active window
|
2002-05-22 17:01:17 +00:00
|
|
|
HWND m_lastForegroundWindow;
|
|
|
|
HWND m_lastActiveWindow;
|
|
|
|
DWORD m_lastActiveThread;
|
2001-11-19 00:33:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|