mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-20 01:11:37 +03:00
d2135af0d9
CServer to the primary screen when the configuration changes so it can make necessary adjustments (the win32 primary screen must tell the hook dll about the new jump zones). changed includes of some std c++ library files to go through our own include files. these wrap the include with stuff to keep vc++ quiet when compiling at warning level 4, which is what it does now. it also works around missing <istream> and <ostream> on g++2.96. added missing std:: where necessary. g++ doesn't really support namespaces so it lets references without the namespace slip through. added workaround or fix. not sure if istringstream::str(string) should reset eofbit. it does on g++ but does not on vc++. added clear() after str() so it works either way. added low-level keyboard hook to win32. if available (it's only available on NT SP3 and up) it allows us to catch and handle alt+tab, alt+esc, ctrl+esc, and windows key hot keys. i think that leaves only ctrl+alt+del and accessibility functions uncaught on those systems.
82 lines
2.3 KiB
C++
82 lines
2.3 KiB
C++
#ifndef CMSWINDOWSSECONDARYSCREEN_H
|
|
#define CMSWINDOWSSECONDARYSCREEN_H
|
|
|
|
#include "CMSWindowsScreen.h"
|
|
#include "ISecondaryScreen.h"
|
|
#include "stdmap.h"
|
|
#include "stdvector.h"
|
|
|
|
class CMSWindowsSecondaryScreen : public CMSWindowsScreen, public ISecondaryScreen {
|
|
public:
|
|
CMSWindowsSecondaryScreen();
|
|
virtual ~CMSWindowsSecondaryScreen();
|
|
|
|
// ISecondaryScreen overrides
|
|
virtual void run();
|
|
virtual void stop();
|
|
virtual void open(CClient*);
|
|
virtual void close();
|
|
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute,
|
|
KeyModifierMask mask);
|
|
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);
|
|
virtual void setClipboard(ClipboardID, const IClipboard*);
|
|
virtual void grabClipboard(ClipboardID);
|
|
virtual void getMousePos(SInt32* x, SInt32* y) const;
|
|
virtual void getSize(SInt32* width, SInt32* height) const;
|
|
virtual SInt32 getJumpZoneSize() const;
|
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
|
|
|
protected:
|
|
// CMSWindowsScreen overrides
|
|
virtual bool onPreTranslate(MSG*);
|
|
virtual LRESULT onEvent(HWND, UINT, WPARAM, LPARAM);
|
|
virtual void onOpenDisplay();
|
|
virtual void onCloseDisplay();
|
|
|
|
private:
|
|
enum EKeyAction { kPress, kRelease, kRepeat };
|
|
class Keystroke {
|
|
public:
|
|
UINT m_virtualKey;
|
|
bool m_press;
|
|
bool m_repeat;
|
|
};
|
|
typedef std::vector<Keystroke> Keystrokes;
|
|
|
|
DWORD mapButton(ButtonID button, bool press) const;
|
|
KeyModifierMask mapKey(Keystrokes&, UINT& virtualKey, KeyID,
|
|
KeyModifierMask, EKeyAction) const;
|
|
void doKeystrokes(const Keystrokes&, SInt32 count);
|
|
|
|
void updateKeys();
|
|
void updateModifiers();
|
|
void toggleKey(UINT virtualKey, KeyModifierMask mask);
|
|
UINT virtualKeyToScanCode(UINT& virtualKey);
|
|
bool isExtendedKey(UINT virtualKey);
|
|
void sendKeyEvent(UINT virtualKey, bool press);
|
|
|
|
private:
|
|
CClient* m_client;
|
|
HWND m_window;
|
|
HWND m_nextClipboardWindow;
|
|
HWND m_clipboardOwner;
|
|
|
|
// thread id of the event loop thread
|
|
DWORD m_threadID;
|
|
|
|
// virtual key states
|
|
BYTE m_keys[256];
|
|
|
|
// current active modifiers
|
|
KeyModifierMask m_mask;
|
|
};
|
|
|
|
#endif
|