2001-11-19 03:33:36 +03:00
|
|
|
#ifndef CMSWINDOWSPRIMARYSCREEN_H
|
|
|
|
#define CMSWINDOWSPRIMARYSCREEN_H
|
|
|
|
|
2002-07-15 19:01:36 +04:00
|
|
|
#include "CPrimaryScreen.h"
|
|
|
|
#include "IMSWindowsScreenEventHandler.h"
|
2002-06-11 02:06:45 +04:00
|
|
|
#include "CSynergyHook.h"
|
2002-06-09 01:48:00 +04:00
|
|
|
#include "MouseTypes.h"
|
|
|
|
#include "CString.h"
|
2001-11-19 03:33:36 +03:00
|
|
|
|
2002-07-15 19:01:36 +04:00
|
|
|
class CMSWindowsScreen;
|
2002-07-11 17:13:37 +04:00
|
|
|
class IScreenReceiver;
|
|
|
|
class IPrimaryScreenReceiver;
|
|
|
|
|
2002-07-15 19:01:36 +04:00
|
|
|
class CMSWindowsPrimaryScreen :
|
|
|
|
public CPrimaryScreen, public IMSWindowsScreenEventHandler {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-11-19 03:33:36 +03:00
|
|
|
typedef bool (CMSWindowsPrimaryScreen::*HookMethod)(int, WPARAM, LPARAM);
|
|
|
|
|
2002-07-11 17:13:37 +04:00
|
|
|
CMSWindowsPrimaryScreen(IScreenReceiver*, IPrimaryScreenReceiver*);
|
2001-11-19 03:33:36 +03:00
|
|
|
virtual ~CMSWindowsPrimaryScreen();
|
|
|
|
|
2002-07-15 19:01:36 +04:00
|
|
|
// CPrimaryScreen overrides
|
2002-07-11 17:13:37 +04:00
|
|
|
virtual void reconfigure(UInt32 activeSides);
|
2002-07-15 19:01:36 +04:00
|
|
|
virtual void warpCursor(SInt32 x, SInt32 y);
|
2002-04-30 21:48:11 +04:00
|
|
|
virtual KeyModifierMask getToggleMask() const;
|
2002-05-24 18:37:12 +04:00
|
|
|
virtual bool isLockedToScreen() const;
|
2002-07-15 19:01:36 +04:00
|
|
|
virtual IScreen* getScreen() const;
|
2001-11-19 03:33:36 +03:00
|
|
|
|
2002-07-15 19:01:36 +04:00
|
|
|
// IMSWindowsScreenEventHandler overrides
|
|
|
|
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 17:13:37 +04:00
|
|
|
|
2002-07-15 19:01:36 +04: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-20 00:24:35 +04:00
|
|
|
|
2002-07-15 19:01:36 +04:00
|
|
|
private:
|
2002-07-13 00:41:23 +04:00
|
|
|
void enterNoWarp();
|
2002-06-09 01:48:00 +04:00
|
|
|
|
2002-07-13 00:41:23 +04:00
|
|
|
// discard posted messages
|
|
|
|
void nextMark();
|
|
|
|
|
2002-06-09 01:48:00 +04:00
|
|
|
// key and button queries
|
2001-11-25 21:32:41 +03:00
|
|
|
KeyID mapKey(WPARAM keycode, LPARAM info,
|
2002-06-11 02:06:45 +04:00
|
|
|
KeyModifierMask* maskOut);
|
2001-11-19 03:33:36 +03:00
|
|
|
ButtonID mapButton(WPARAM button) const;
|
2002-04-30 20:23:03 +04:00
|
|
|
void updateKey(UINT vkCode, bool press);
|
2001-11-19 03:33:36 +03:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2002-07-15 19:01:36 +04:00
|
|
|
IPrimaryScreenReceiver* m_receiver;
|
|
|
|
CMSWindowsScreen* m_screen;
|
2002-06-09 01:48:00 +04:00
|
|
|
|
|
|
|
// true if windows 95/98/me
|
2002-06-01 23:26:11 +04:00
|
|
|
bool m_is95Family;
|
2002-06-09 01:48:00 +04:00
|
|
|
|
|
|
|
// the main loop's thread id
|
|
|
|
DWORD m_threadID;
|
|
|
|
|
2002-07-15 19:01:36 +04:00
|
|
|
// our window
|
2001-11-19 03:33:36 +03:00
|
|
|
HWND m_window;
|
2002-06-09 01:48:00 +04: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-20 00:24:35 +04:00
|
|
|
// last mouse position
|
|
|
|
SInt32 m_x, m_y;
|
|
|
|
|
2002-06-09 01:48:00 +04: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-24 01:53:31 +04:00
|
|
|
InitFunc m_init;
|
|
|
|
CleanupFunc m_cleanup;
|
2002-06-09 01:48:00 +04:00
|
|
|
InstallFunc m_install;
|
|
|
|
UninstallFunc m_uninstall;
|
2002-07-11 17:13:37 +04:00
|
|
|
SetSidesFunc m_setSides;
|
2002-06-09 01:48:00 +04:00
|
|
|
SetZoneFunc m_setZone;
|
|
|
|
SetRelayFunc m_setRelay;
|
|
|
|
|
|
|
|
// stuff for restoring active window
|
2002-05-22 21:01:17 +04:00
|
|
|
HWND m_lastForegroundWindow;
|
|
|
|
HWND m_lastActiveWindow;
|
|
|
|
DWORD m_lastActiveThread;
|
2001-11-19 03:33:36 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|