2001-11-19 03:33:36 +03:00
|
|
|
#ifndef CMSWINDOWSPRIMARYSCREEN_H
|
|
|
|
#define CMSWINDOWSPRIMARYSCREEN_H
|
|
|
|
|
|
|
|
#include "CMSWindowsScreen.h"
|
2002-07-11 17:13:37 +04:00
|
|
|
#include "IPrimaryScreen.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-11 17:13:37 +04:00
|
|
|
class IScreenReceiver;
|
|
|
|
class IPrimaryScreenReceiver;
|
|
|
|
|
2001-11-19 03:33:36 +03:00
|
|
|
class CMSWindowsPrimaryScreen : public CMSWindowsScreen, public IPrimaryScreen {
|
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();
|
|
|
|
|
|
|
|
// IPrimaryScreen overrides
|
|
|
|
virtual void run();
|
|
|
|
virtual void stop();
|
2002-07-11 17:13:37 +04:00
|
|
|
virtual void open();
|
2001-11-19 03:33:36 +03:00
|
|
|
virtual void close();
|
2002-06-24 03:24:22 +04:00
|
|
|
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute, bool);
|
2002-06-03 22:53:18 +04:00
|
|
|
virtual bool leave();
|
2002-07-11 17:13:37 +04:00
|
|
|
virtual void reconfigure(UInt32 activeSides);
|
2001-11-19 03:33:36 +03:00
|
|
|
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
|
2002-04-30 20:23:03 +04:00
|
|
|
virtual void setClipboard(ClipboardID, const IClipboard*);
|
|
|
|
virtual void grabClipboard(ClipboardID);
|
|
|
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
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-11 17:13:37 +04:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
protected:
|
2001-11-19 03:33:36 +03:00
|
|
|
// CMSWindowsScreen overrides
|
2001-11-25 21:32:41 +03:00
|
|
|
virtual bool onPreTranslate(MSG*);
|
|
|
|
virtual LRESULT onEvent(HWND, UINT, WPARAM, LPARAM);
|
2001-11-19 03:33:36 +03:00
|
|
|
virtual void onOpenDisplay();
|
|
|
|
virtual void onCloseDisplay();
|
2002-06-09 01:48:00 +04:00
|
|
|
virtual CString getCurrentDesktopName() const;
|
2001-11-19 03:33:36 +03:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2002-06-09 01:48:00 +04:00
|
|
|
void enterNoWarp();
|
|
|
|
void onEnter();
|
|
|
|
bool onLeave();
|
2001-11-19 03:33:36 +03:00
|
|
|
|
2002-07-11 17:13:37 +04:00
|
|
|
SInt32 getJumpZoneSize() const;
|
|
|
|
|
2002-06-20 00:24:35 +04:00
|
|
|
// warp mouse to center of primary display (used when computing
|
|
|
|
// motion deltas while mouse is on secondary screen).
|
|
|
|
void warpCursorToCenter();
|
|
|
|
|
2002-06-09 01:48:00 +04:00
|
|
|
// discard posted messages
|
2001-11-19 03:33:36 +03:00
|
|
|
void nextMark();
|
|
|
|
|
2002-06-09 01:48:00 +04:00
|
|
|
// open/close desktop (for windows 95/98/me)
|
|
|
|
bool openDesktop();
|
|
|
|
void closeDesktop();
|
|
|
|
|
|
|
|
// make desk the thread desktop (for windows NT/2000/XP)
|
|
|
|
bool switchDesktop(HDESK desk);
|
|
|
|
|
|
|
|
// 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 updateKeys();
|
|
|
|
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-11 17:13:37 +04:00
|
|
|
IScreenReceiver* m_receiver;
|
|
|
|
IPrimaryScreenReceiver* m_primaryReceiver;
|
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;
|
|
|
|
|
|
|
|
// the current desk and it's name
|
|
|
|
HDESK m_desk;
|
|
|
|
CString m_deskName;
|
|
|
|
|
|
|
|
// our window (for getting clipboard changes)
|
2001-11-19 03:33:36 +03:00
|
|
|
HWND m_window;
|
2002-06-09 01:48:00 +04:00
|
|
|
|
|
|
|
// m_active is true the hooks are relaying events
|
|
|
|
bool m_active;
|
|
|
|
|
|
|
|
// used to discard queued messages that are no longer needed
|
|
|
|
UInt32 m_mark;
|
|
|
|
UInt32 m_markReceived;
|
|
|
|
|
|
|
|
// clipboard stuff
|
2001-11-25 21:32:41 +03:00
|
|
|
HWND m_nextClipboardWindow;
|
|
|
|
HWND m_clipboardOwner;
|
2002-06-09 01:48:00 +04:00
|
|
|
|
|
|
|
// 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;
|
2002-06-24 01:53:31 +04:00
|
|
|
InstallScreenSaverFunc m_installScreenSaver;
|
|
|
|
UninstallScreenSaverFunc m_uninstallScreenSaver;
|
2002-06-09 01:48:00 +04:00
|
|
|
|
|
|
|
// 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
|