2001-11-19 00:33:36 +00:00
|
|
|
#ifndef CMSWINDOWSSECONDARYSCREEN_H
|
|
|
|
#define CMSWINDOWSSECONDARYSCREEN_H
|
|
|
|
|
2002-06-20 11:13:37 +00:00
|
|
|
// ensure that we get SendInput()
|
|
|
|
#if _WIN32_WINNT <= 0x400
|
|
|
|
#undef _WIN32_WINNT
|
|
|
|
#define _WIN32_WINNT 0x401
|
|
|
|
#endif
|
|
|
|
|
2001-11-19 00:33:36 +00:00
|
|
|
#include "CMSWindowsScreen.h"
|
|
|
|
#include "ISecondaryScreen.h"
|
2002-06-08 21:48:00 +00:00
|
|
|
#include "CMutex.h"
|
|
|
|
#include "CString.h"
|
2002-06-01 19:26:11 +00:00
|
|
|
#include "stdvector.h"
|
2001-11-19 00:33:36 +00:00
|
|
|
|
2002-06-10 22:06:45 +00:00
|
|
|
class CMSWindowsSecondaryScreen : public CMSWindowsScreen,
|
|
|
|
public ISecondaryScreen {
|
2002-04-29 14:40:01 +00:00
|
|
|
public:
|
2001-11-19 00:33:36 +00:00
|
|
|
CMSWindowsSecondaryScreen();
|
|
|
|
virtual ~CMSWindowsSecondaryScreen();
|
|
|
|
|
|
|
|
// ISecondaryScreen overrides
|
|
|
|
virtual void run();
|
|
|
|
virtual void stop();
|
|
|
|
virtual void open(CClient*);
|
|
|
|
virtual void close();
|
2002-04-30 17:48:11 +00:00
|
|
|
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute,
|
2002-06-10 22:06:45 +00:00
|
|
|
KeyModifierMask mask);
|
2001-11-19 00:33:36 +00:00
|
|
|
virtual void leave();
|
|
|
|
virtual void keyDown(KeyID, KeyModifierMask);
|
|
|
|
virtual void keyRepeat(KeyID, KeyModifierMask, SInt32 count);
|
|
|
|
virtual void keyUp(KeyID, KeyModifierMask);
|
|
|
|
virtual void mouseDown(ButtonID);
|
|
|
|
virtual void mouseUp(ButtonID);
|
|
|
|
virtual void mouseMove(SInt32 xAbsolute, SInt32 yAbsolute);
|
|
|
|
virtual void mouseWheel(SInt32 delta);
|
2002-04-30 16:23:03 +00:00
|
|
|
virtual void setClipboard(ClipboardID, const IClipboard*);
|
|
|
|
virtual void grabClipboard(ClipboardID);
|
2002-06-23 21:53:31 +00:00
|
|
|
virtual void screenSaver(bool activate);
|
2002-06-19 17:03:29 +00:00
|
|
|
virtual void getMousePos(SInt32& x, SInt32& y) const;
|
|
|
|
virtual void getShape(SInt32&, SInt32&, SInt32&, SInt32&) const;
|
2001-11-19 00:33:36 +00:00
|
|
|
virtual SInt32 getJumpZoneSize() const;
|
2002-04-30 16:23:03 +00:00
|
|
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
2001-11-19 00:33:36 +00:00
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
protected:
|
2001-11-19 00:33:36 +00:00
|
|
|
// CMSWindowsScreen overrides
|
2001-11-25 18:32:41 +00:00
|
|
|
virtual bool onPreTranslate(MSG*);
|
|
|
|
virtual LRESULT onEvent(HWND, UINT, WPARAM, LPARAM);
|
2001-11-19 00:33:36 +00:00
|
|
|
virtual void onOpenDisplay();
|
|
|
|
virtual void onCloseDisplay();
|
2002-06-08 21:48:00 +00:00
|
|
|
virtual CString getCurrentDesktopName() const;
|
2001-11-19 00:33:36 +00:00
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2002-05-04 18:08:22 +00:00
|
|
|
enum EKeyAction { kPress, kRelease, kRepeat };
|
|
|
|
class Keystroke {
|
|
|
|
public:
|
|
|
|
UINT m_virtualKey;
|
|
|
|
bool m_press;
|
|
|
|
bool m_repeat;
|
|
|
|
};
|
2002-04-30 16:23:03 +00:00
|
|
|
typedef std::vector<Keystroke> Keystrokes;
|
2002-06-08 21:48:00 +00:00
|
|
|
|
|
|
|
void onEnter(SInt32 x, SInt32 y);
|
|
|
|
void onLeave();
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
// get calling thread to use the input desktop
|
|
|
|
void syncDesktop() const;
|
|
|
|
|
2002-06-20 11:13:37 +00:00
|
|
|
// warp the mouse to the specified position
|
|
|
|
void warpCursor(SInt32 x, SInt32 y);
|
|
|
|
|
|
|
|
// returns true iff there appear to be multiple monitors
|
|
|
|
bool isMultimon() const;
|
|
|
|
|
2002-06-08 21:48:00 +00:00
|
|
|
// key and button queries and operations
|
2002-05-04 18:08:22 +00:00
|
|
|
DWORD mapButton(ButtonID button, bool press) const;
|
2002-04-30 16:23:03 +00:00
|
|
|
KeyModifierMask mapKey(Keystrokes&, UINT& virtualKey, KeyID,
|
2002-06-10 22:06:45 +00:00
|
|
|
KeyModifierMask, EKeyAction) const;
|
2002-05-04 18:08:22 +00:00
|
|
|
void doKeystrokes(const Keystrokes&, SInt32 count);
|
2002-04-30 16:23:03 +00:00
|
|
|
|
|
|
|
void updateKeys();
|
|
|
|
void updateModifiers();
|
2002-04-30 17:48:11 +00:00
|
|
|
void toggleKey(UINT virtualKey, KeyModifierMask mask);
|
2002-05-22 17:01:17 +00:00
|
|
|
UINT virtualKeyToScanCode(UINT& virtualKey);
|
|
|
|
bool isExtendedKey(UINT virtualKey);
|
|
|
|
void sendKeyEvent(UINT virtualKey, bool press);
|
2001-11-19 00:33:36 +00:00
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2002-06-08 21:48:00 +00:00
|
|
|
CMutex m_mutex;
|
2001-11-19 00:33:36 +00:00
|
|
|
CClient* m_client;
|
2002-06-08 21:48:00 +00:00
|
|
|
|
|
|
|
// true if windows 95/98/me
|
|
|
|
bool m_is95Family;
|
|
|
|
|
2002-06-20 11:13:37 +00:00
|
|
|
// true if system appears to have multiple monitors
|
|
|
|
bool m_multimon;
|
|
|
|
|
2002-06-08 21:48:00 +00:00
|
|
|
// the main loop's thread id
|
|
|
|
DWORD m_threadID;
|
|
|
|
|
2002-06-14 18:08:20 +00:00
|
|
|
// the thread id of the last attached thread
|
|
|
|
mutable DWORD m_lastThreadID;
|
|
|
|
|
2002-06-08 21:48:00 +00:00
|
|
|
// the current desk and it's name
|
|
|
|
HDESK m_desk;
|
|
|
|
CString m_deskName;
|
|
|
|
|
|
|
|
// our window (for getting clipboard changes)
|
2001-11-19 00:33:36 +00:00
|
|
|
HWND m_window;
|
2002-06-08 21:48:00 +00:00
|
|
|
|
|
|
|
// m_active is true if this screen has been entered
|
|
|
|
bool m_active;
|
|
|
|
|
|
|
|
// clipboard stuff
|
2001-11-25 18:32:41 +00:00
|
|
|
HWND m_nextClipboardWindow;
|
|
|
|
HWND m_clipboardOwner;
|
2002-04-30 16:23:03 +00:00
|
|
|
|
|
|
|
// virtual key states
|
|
|
|
BYTE m_keys[256];
|
|
|
|
|
|
|
|
// current active modifiers
|
|
|
|
KeyModifierMask m_mask;
|
2001-11-19 00:33:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|