2002-08-02 23:57:46 +04: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 18:13:28 +04:00
|
|
|
#ifndef CXWINDOWSPRIMARYSCREEN_H
|
|
|
|
#define CXWINDOWSPRIMARYSCREEN_H
|
|
|
|
|
2002-07-14 02:00:38 +04:00
|
|
|
#include "CPrimaryScreen.h"
|
|
|
|
#include "IScreenEventHandler.h"
|
2002-06-11 02:06:45 +04:00
|
|
|
#include "MouseTypes.h"
|
2002-07-14 02:00:38 +04:00
|
|
|
#if defined(X_DISPLAY_MISSING)
|
|
|
|
# error X11 is required to build synergy
|
|
|
|
#else
|
|
|
|
# include <X11/Xlib.h>
|
|
|
|
#endif
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-07-14 02:00:38 +04:00
|
|
|
class CXWindowsScreen;
|
2002-07-11 01:22:28 +04:00
|
|
|
class IScreenReceiver;
|
|
|
|
class IPrimaryScreenReceiver;
|
2002-07-10 01:22:31 +04:00
|
|
|
|
2002-07-30 18:59:36 +04:00
|
|
|
//! X11 primary screen implementation
|
2002-07-14 02:00:38 +04:00
|
|
|
class CXWindowsPrimaryScreen :
|
|
|
|
public CPrimaryScreen, public IScreenEventHandler {
|
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();
|
|
|
|
|
2002-07-14 02:00:38 +04:00
|
|
|
// CPrimaryScreen overrides
|
2002-07-11 17:13:37 +04:00
|
|
|
virtual void reconfigure(UInt32 activeSides);
|
2002-07-14 02:00:38 +04:00
|
|
|
virtual void warpCursor(SInt32 x, SInt32 y);
|
2002-12-23 16:55:21 +03:00
|
|
|
virtual void resetOptions();
|
|
|
|
virtual void setOptions(const COptionsList& options);
|
2002-04-30 21:48:11 +04:00
|
|
|
virtual KeyModifierMask getToggleMask() const;
|
2002-05-24 18:37:12 +04:00
|
|
|
virtual bool isLockedToScreen() const;
|
2002-07-14 02:00:38 +04:00
|
|
|
virtual IScreen* getScreen() const;
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-07-14 02:00:38 +04:00
|
|
|
// IScreenEventHandler overrides
|
|
|
|
virtual void onScreensaver(bool activated);
|
2002-07-13 00:41:23 +04:00
|
|
|
virtual bool onPreDispatch(const CEvent* event);
|
|
|
|
virtual bool onEvent(CEvent* event);
|
2002-07-15 19:01:36 +04:00
|
|
|
virtual SInt32 getJumpZoneSize() const;
|
2001-11-12 00:15:30 +03:00
|
|
|
|
2002-07-14 02:00:38 +04:00
|
|
|
protected:
|
|
|
|
// CPrimaryScreen overrides
|
2002-07-30 19:17:44 +04:00
|
|
|
virtual void onPreMainLoop();
|
2002-07-14 02:00:38 +04:00
|
|
|
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();
|
2002-07-11 22:58:49 +04:00
|
|
|
|
2002-07-14 02:00:38 +04:00
|
|
|
private:
|
2002-07-11 22:58:49 +04:00
|
|
|
void warpCursorNoFlush(Display*,
|
2002-07-03 20:25:36 +04:00
|
|
|
SInt32 xAbsolute, SInt32 yAbsolute);
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-07-13 00:41:23 +04:00
|
|
|
void selectEvents(Display*, Window) const;
|
|
|
|
void doSelectEvents(Display*, Window) const;
|
|
|
|
|
2001-10-06 18:13:28 +04:00
|
|
|
KeyModifierMask mapModifier(unsigned int state) const;
|
2002-04-26 21:38:01 +04:00
|
|
|
KeyID mapKey(XKeyEvent*) const;
|
2001-10-06 18:13:28 +04:00
|
|
|
ButtonID mapButton(unsigned int button) const;
|
|
|
|
|
2002-05-03 15:26:44 +04:00
|
|
|
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-14 02:00:38 +04:00
|
|
|
CXWindowsScreen* m_screen;
|
|
|
|
IPrimaryScreenReceiver* m_receiver;
|
2002-07-11 01:22:28 +04:00
|
|
|
|
2002-07-14 02:00:38 +04:00
|
|
|
// our window
|
2001-11-12 00:15:30 +03:00
|
|
|
Window m_window;
|
2002-04-27 00:12:55 +04:00
|
|
|
|
2002-05-04 22:33:48 +04:00
|
|
|
// note toggle keys that toggle on up/down (false) or on
|
2002-04-30 21:48:11 +04:00
|
|
|
// transition (true)
|
2002-05-04 22:33:48 +04:00
|
|
|
bool m_numLockHalfDuplex;
|
2002-04-27 00:12:55 +04:00
|
|
|
bool m_capsLockHalfDuplex;
|
2002-04-30 21:48:11 +04:00
|
|
|
|
2002-09-01 19:30:00 +04:00
|
|
|
// modifier masks
|
|
|
|
unsigned int m_altMask;
|
|
|
|
unsigned int m_metaMask;
|
2002-09-14 16:07:02 +04:00
|
|
|
unsigned int m_superMask;
|
2002-09-01 19:30:00 +04:00
|
|
|
unsigned int m_modeSwitchMask;
|
2002-04-30 21:48:11 +04:00
|
|
|
unsigned int m_numLockMask;
|
|
|
|
unsigned int m_capsLockMask;
|
|
|
|
unsigned int m_scrollLockMask;
|
2002-06-20 00:24:35 +04:00
|
|
|
|
|
|
|
// 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
|