barrier/server/CXWindowsPrimaryScreen.h

105 lines
2.7 KiB
C
Raw Normal View History

2001-10-06 18:13:28 +04:00
#ifndef CXWINDOWSPRIMARYSCREEN_H
#define CXWINDOWSPRIMARYSCREEN_H
#include "CXWindowsScreen.h"
2001-10-06 18:13:28 +04:00
#include "IPrimaryScreen.h"
#include "MouseTypes.h"
2001-10-06 18:13:28 +04:00
2002-07-11 01:22:28 +04:00
class IScreenReceiver;
class IPrimaryScreenReceiver;
class CXWindowsPrimaryScreen : public CXWindowsScreen, public IPrimaryScreen {
2002-04-29 18:40:01 +04:00
public:
2002-07-11 01:22:28 +04:00
CXWindowsPrimaryScreen(IScreenReceiver*, IPrimaryScreenReceiver*);
2001-10-06 18:13:28 +04:00
virtual ~CXWindowsPrimaryScreen();
// IPrimaryScreen overrides
virtual void run();
virtual void stop();
virtual void open();
2001-10-06 18:13:28 +04:00
virtual void close();
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute, bool);
virtual bool leave();
2002-07-11 17:13:37 +04:00
virtual void reconfigure(UInt32 activeSides);
2001-10-06 18:13:28 +04:00
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
virtual void setClipboard(ClipboardID, const IClipboard*);
virtual void grabClipboard(ClipboardID);
virtual void getClipboard(ClipboardID, IClipboard*) const;
virtual KeyModifierMask getToggleMask() const;
virtual bool isLockedToScreen() const;
2001-10-06 18:13:28 +04:00
2002-04-29 18:40:01 +04:00
protected:
// CXWindowsScreen overrides
virtual void onUnexpectedClose();
virtual void onLostClipboard(ClipboardID);
2002-04-29 18:40:01 +04:00
private:
void selectEvents(Display*, Window) const;
void doSelectEvents(Display*, Window) const;
void enterNoWarp();
bool showWindow();
void hideWindow();
SInt32 getJumpZoneSize() const;
void warpCursorToCenter();
void warpCursorNoFlush(Display*,
SInt32 xAbsolute, SInt32 yAbsolute);
2001-10-06 18:13:28 +04:00
// check clipboard ownership and, if necessary, tell the receiver
// of a grab.
void checkClipboard();
// create/destroy window
void createWindow();
void destroyWindow();
// start/stop watch for screen saver changes
void installScreenSaver();
void uninstallScreenSaver();
2001-10-06 18:13:28 +04:00
KeyModifierMask mapModifier(unsigned int state) const;
KeyID mapKey(XKeyEvent*) const;
2001-10-06 18:13:28 +04:00
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);
2002-04-29 18:40:01 +04:00
private:
2002-07-11 01:22:28 +04:00
IScreenReceiver* m_receiver;
IPrimaryScreenReceiver* m_primaryReceiver;
2001-10-06 18:13:28 +04:00
bool m_active;
Window m_window;
// atom for screen saver messages
Atom m_atomScreenSaver;
// 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;
// last mouse position
SInt32 m_x, m_y;
// position of center pixel of screen
SInt32 m_xCenter, m_yCenter;
2001-10-06 18:13:28 +04:00
};
#endif