2001-11-19 03:33:36 +03:00
|
|
|
#ifndef CMSWINDOWSPRIMARYSCREEN_H
|
|
|
|
#define CMSWINDOWSPRIMARYSCREEN_H
|
|
|
|
|
|
|
|
#include "CMSWindowsScreen.h"
|
|
|
|
#include "IPrimaryScreen.h"
|
2002-06-09 01:48:00 +04:00
|
|
|
#include "MouseTypes.h"
|
|
|
|
#include "CString.h"
|
|
|
|
#include "CSynergyHook.h"
|
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);
|
|
|
|
|
|
|
|
CMSWindowsPrimaryScreen();
|
|
|
|
virtual ~CMSWindowsPrimaryScreen();
|
|
|
|
|
|
|
|
// IPrimaryScreen overrides
|
|
|
|
virtual void run();
|
|
|
|
virtual void stop();
|
|
|
|
virtual void open(CServer*);
|
|
|
|
virtual void close();
|
|
|
|
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute);
|
2002-06-03 22:53:18 +04:00
|
|
|
virtual bool leave();
|
2002-06-01 23:26:11 +04:00
|
|
|
virtual void onConfigure();
|
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);
|
2001-11-19 03:33:36 +03:00
|
|
|
virtual void getSize(SInt32* width, SInt32* height) const;
|
|
|
|
virtual SInt32 getJumpZoneSize() const;
|
2002-04-30 20:23:03 +04:00
|
|
|
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;
|
2001-11-19 03:33:36 +03: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-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-04-30 20:23:03 +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:
|
2001-11-19 03:33:36 +03:00
|
|
|
CServer* m_server;
|
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];
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
InstallFunc m_install;
|
|
|
|
UninstallFunc m_uninstall;
|
|
|
|
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
|