barrier/lib/server/CXWindowsPrimaryScreen.h

119 lines
3.1 KiB
C
Raw Normal View History

2002-08-02 19:57:46 +00:00
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
2001-10-06 14:13:28 +00:00
#ifndef CXWINDOWSPRIMARYSCREEN_H
#define CXWINDOWSPRIMARYSCREEN_H
#include "CPrimaryScreen.h"
#include "IScreenEventHandler.h"
#include "MouseTypes.h"
#if defined(X_DISPLAY_MISSING)
# error X11 is required to build synergy
#else
# include <X11/Xlib.h>
#endif
2001-10-06 14:13:28 +00:00
class CXWindowsScreen;
2002-07-10 21:22:28 +00:00
class IScreenReceiver;
class IPrimaryScreenReceiver;
//! X11 primary screen implementation
class CXWindowsPrimaryScreen :
public CPrimaryScreen, public IScreenEventHandler {
2002-04-29 14:40:01 +00:00
public:
2002-07-10 21:22:28 +00:00
CXWindowsPrimaryScreen(IScreenReceiver*, IPrimaryScreenReceiver*);
2001-10-06 14:13:28 +00:00
virtual ~CXWindowsPrimaryScreen();
// CPrimaryScreen overrides
2002-07-11 13:13:37 +00:00
virtual void reconfigure(UInt32 activeSides);
virtual void warpCursor(SInt32 x, SInt32 y);
virtual void resetOptions();
virtual void setOptions(const COptionsList& options);
virtual KeyModifierMask getToggleMask() const;
virtual bool isLockedToScreen() const;
virtual IScreen* getScreen() const;
2001-10-06 14:13:28 +00:00
// IScreenEventHandler overrides
virtual void onScreensaver(bool activated);
virtual bool onPreDispatch(const CEvent* event);
virtual bool onEvent(CEvent* event);
virtual SInt32 getJumpZoneSize() const;
protected:
// CPrimaryScreen overrides
virtual void onPreMainLoop();
virtual void onPreOpen();
virtual void onPostOpen();
virtual void onPreEnter();
virtual void onPreLeave();
virtual void onEnterScreenSaver();
virtual void createWindow();
virtual void destroyWindow();
virtual bool showWindow();
virtual void hideWindow();
virtual void warpCursorToCenter();
virtual void updateKeys();
private:
void warpCursorNoFlush(Display*,
SInt32 xAbsolute, SInt32 yAbsolute);
2001-10-06 14:13:28 +00:00
void selectEvents(Display*, Window) const;
void doSelectEvents(Display*, Window) const;
2001-10-06 14:13:28 +00:00
KeyModifierMask mapModifier(unsigned int state) const;
KeyID mapKey(XKeyEvent*) const;
2001-10-06 14:13:28 +00:00
ButtonID mapButton(unsigned int button) const;
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 14:40:01 +00:00
private:
CXWindowsScreen* m_screen;
IPrimaryScreenReceiver* m_receiver;
2002-07-10 21:22:28 +00:00
// our window
Window m_window;
// note toggle keys that toggle on up/down (false) or on
// transition (true)
bool m_numLockHalfDuplex;
bool m_capsLockHalfDuplex;
// modifier masks
unsigned int m_altMask;
unsigned int m_metaMask;
unsigned int m_superMask;
unsigned int m_modeSwitchMask;
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 14:13:28 +00:00
};
#endif