mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-20 17:41:52 +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.
77 lines
2.1 KiB
C++
77 lines
2.1 KiB
C++
#ifndef CXWINDOWSPRIMARYSCREEN_H
|
|
#define CXWINDOWSPRIMARYSCREEN_H
|
|
|
|
#include "KeyTypes.h"
|
|
#include "MouseTypes.h"
|
|
#include "CXWindowsScreen.h"
|
|
#include "IPrimaryScreen.h"
|
|
|
|
class CXWindowsPrimaryScreen : public CXWindowsScreen, public IPrimaryScreen {
|
|
public:
|
|
CXWindowsPrimaryScreen();
|
|
virtual ~CXWindowsPrimaryScreen();
|
|
|
|
// IPrimaryScreen overrides
|
|
virtual void run();
|
|
virtual void stop();
|
|
virtual void open(CServer*);
|
|
virtual void close();
|
|
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute);
|
|
virtual void leave();
|
|
virtual void onConfigure();
|
|
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
|
|
virtual void setClipboard(ClipboardID, const IClipboard*);
|
|
virtual void grabClipboard(ClipboardID);
|
|
virtual void getSize(SInt32* width, SInt32* height) const;
|
|
virtual SInt32 getJumpZoneSize() const;
|
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
|
virtual KeyModifierMask getToggleMask() const;
|
|
virtual bool isLockedToScreen() const;
|
|
|
|
protected:
|
|
// CXWindowsScreen overrides
|
|
virtual void onOpenDisplay();
|
|
virtual CXWindowsClipboard*
|
|
createClipboard(ClipboardID);
|
|
virtual void onCloseDisplay();
|
|
virtual void onLostClipboard(ClipboardID);
|
|
|
|
private:
|
|
void selectEvents(Display*, Window) const;
|
|
void doSelectEvents(Display*, Window) const;
|
|
void warpCursorNoLock(Display*,
|
|
SInt32 xAbsolute, SInt32 yAbsolute);
|
|
|
|
KeyModifierMask mapModifier(unsigned int state) const;
|
|
KeyID mapKey(XKeyEvent*) const;
|
|
ButtonID mapButton(unsigned int button) const;
|
|
|
|
void updateModifierMap(Display* display);
|
|
|
|
class CKeyEventInfo {
|
|
public:
|
|
int m_event;
|
|
Window m_window;
|
|
Time m_time;
|
|
KeyCode m_keycode;
|
|
};
|
|
static Bool findKeyEvent(Display*, XEvent* xevent, XPointer arg);
|
|
|
|
private:
|
|
CServer* m_server;
|
|
bool m_active;
|
|
Window m_window;
|
|
|
|
// note toggle keys that toggle on up/down (false) or on
|
|
// transition (true)
|
|
bool m_numLockHalfDuplex;
|
|
bool m_capsLockHalfDuplex;
|
|
|
|
// masks that indicate which modifier bits are for toggle keys
|
|
unsigned int m_numLockMask;
|
|
unsigned int m_capsLockMask;
|
|
unsigned int m_scrollLockMask;
|
|
};
|
|
|
|
#endif
|