| 1 | /*
|
|---|
| 2 | * synergy -- mouse and keyboard sharing utility
|
|---|
| 3 | * Copyright (C) 2002 Chris Schoeneman
|
|---|
| 4 | *
|
|---|
| 5 | * This package is free software; you can redistribute it and/or
|
|---|
| 6 | * modify it under the terms of the GNU General Public License
|
|---|
| 7 | * found in the file COPYING that should have accompanied this file.
|
|---|
| 8 | *
|
|---|
| 9 | * This package is distributed in the hope that it will be useful,
|
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | * GNU General Public License for more details.
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| 15 | #ifndef CPRIMARYCLIENT_H
|
|---|
| 16 | #define CPRIMARYCLIENT_H
|
|---|
| 17 |
|
|---|
| 18 | #include "CBaseClientProxy.h"
|
|---|
| 19 | #include "ProtocolTypes.h"
|
|---|
| 20 |
|
|---|
| 21 | class CScreen;
|
|---|
| 22 |
|
|---|
| 23 | //! Primary screen as pseudo-client
|
|---|
| 24 | /*!
|
|---|
| 25 | The primary screen does not have a client associated with it. This
|
|---|
| 26 | class provides a pseudo-client to allow the primary screen to be
|
|---|
| 27 | treated as if it was a client.
|
|---|
| 28 | */
|
|---|
| 29 | class CPrimaryClient : public CBaseClientProxy {
|
|---|
| 30 | public:
|
|---|
| 31 | /*!
|
|---|
| 32 | \c name is the name of the server and \p screen is primary screen.
|
|---|
| 33 | */
|
|---|
| 34 | CPrimaryClient(const CString& name, CScreen* screen);
|
|---|
| 35 | ~CPrimaryClient();
|
|---|
| 36 |
|
|---|
| 37 | //! @name manipulators
|
|---|
| 38 | //@{
|
|---|
| 39 |
|
|---|
| 40 | //! Update configuration
|
|---|
| 41 | /*!
|
|---|
| 42 | Handles reconfiguration of jump zones.
|
|---|
| 43 | */
|
|---|
| 44 | void reconfigure(UInt32 activeSides);
|
|---|
| 45 |
|
|---|
| 46 | //! Register a system hotkey
|
|---|
| 47 | /*!
|
|---|
| 48 | Registers a system-wide hotkey for key \p key with modifiers \p mask.
|
|---|
| 49 | Returns an id used to unregister the hotkey.
|
|---|
| 50 | */
|
|---|
| 51 | UInt32 registerHotKey(KeyID key, KeyModifierMask mask);
|
|---|
| 52 |
|
|---|
| 53 | //! Unregister a system hotkey
|
|---|
| 54 | /*!
|
|---|
| 55 | Unregisters a previously registered hot key.
|
|---|
| 56 | */
|
|---|
| 57 | void unregisterHotKey(UInt32 id);
|
|---|
| 58 |
|
|---|
| 59 | //! Prepare to synthesize input on primary screen
|
|---|
| 60 | /*!
|
|---|
| 61 | Prepares the primary screen to receive synthesized input. We do not
|
|---|
| 62 | want to receive this synthesized input as user input so this method
|
|---|
| 63 | ensures that we ignore it. Calls to \c fakeInputBegin() and
|
|---|
| 64 | \c fakeInputEnd() may be nested; only the outermost have an effect.
|
|---|
| 65 | */
|
|---|
| 66 | void fakeInputBegin();
|
|---|
| 67 |
|
|---|
| 68 | //! Done synthesizing input on primary screen
|
|---|
| 69 | /*!
|
|---|
| 70 | Undoes whatever \c fakeInputBegin() did.
|
|---|
| 71 | */
|
|---|
| 72 | void fakeInputEnd();
|
|---|
| 73 |
|
|---|
| 74 | //@}
|
|---|
| 75 | //! @name accessors
|
|---|
| 76 | //@{
|
|---|
| 77 |
|
|---|
| 78 | //! Get jump zone size
|
|---|
| 79 | /*!
|
|---|
| 80 | Return the jump zone size, the size of the regions on the edges of
|
|---|
| 81 | the screen that cause the cursor to jump to another screen.
|
|---|
| 82 | */
|
|---|
| 83 | SInt32 getJumpZoneSize() const;
|
|---|
| 84 |
|
|---|
| 85 | //! Get cursor center position
|
|---|
| 86 | /*!
|
|---|
| 87 | Return the cursor center position which is where we park the
|
|---|
| 88 | cursor to compute cursor motion deltas and should be far from
|
|---|
| 89 | the edges of the screen, typically the center.
|
|---|
| 90 | */
|
|---|
| 91 | void getCursorCenter(SInt32& x, SInt32& y) const;
|
|---|
| 92 |
|
|---|
| 93 | //! Get toggle key state
|
|---|
| 94 | /*!
|
|---|
| 95 | Returns the primary screen's current toggle modifier key state.
|
|---|
| 96 | */
|
|---|
| 97 | KeyModifierMask getToggleMask() const;
|
|---|
| 98 |
|
|---|
| 99 | //! Get screen lock state
|
|---|
| 100 | /*!
|
|---|
| 101 | Returns true if the user is locked to the screen.
|
|---|
| 102 | */
|
|---|
| 103 | bool isLockedToScreen() const;
|
|---|
| 104 |
|
|---|
| 105 | //@}
|
|---|
| 106 |
|
|---|
| 107 | // FIXME -- these probably belong on IScreen
|
|---|
| 108 | virtual void enable();
|
|---|
| 109 | virtual void disable();
|
|---|
| 110 |
|
|---|
| 111 | // IScreen overrides
|
|---|
| 112 | virtual void* getEventTarget() const;
|
|---|
| 113 | virtual bool getClipboard(ClipboardID id, IClipboard*) const;
|
|---|
| 114 | virtual void getShape(SInt32& x, SInt32& y,
|
|---|
| 115 | SInt32& width, SInt32& height) const;
|
|---|
| 116 | virtual void getCursorPos(SInt32& x, SInt32& y) const;
|
|---|
| 117 |
|
|---|
| 118 | // IClient overrides
|
|---|
| 119 | virtual void enter(SInt32 xAbs, SInt32 yAbs,
|
|---|
| 120 | UInt32 seqNum, KeyModifierMask mask,
|
|---|
| 121 | bool forScreensaver);
|
|---|
| 122 | virtual bool leave();
|
|---|
| 123 | virtual void setClipboard(ClipboardID, const IClipboard*);
|
|---|
| 124 | virtual void grabClipboard(ClipboardID);
|
|---|
| 125 | virtual void setClipboardDirty(ClipboardID, bool);
|
|---|
| 126 | virtual void keyDown(KeyID, KeyModifierMask, KeyButton);
|
|---|
| 127 | virtual void keyRepeat(KeyID, KeyModifierMask,
|
|---|
| 128 | SInt32 count, KeyButton);
|
|---|
| 129 | virtual void keyUp(KeyID, KeyModifierMask, KeyButton);
|
|---|
| 130 | virtual void mouseDown(ButtonID);
|
|---|
| 131 | virtual void mouseUp(ButtonID);
|
|---|
| 132 | virtual void mouseMove(SInt32 xAbs, SInt32 yAbs);
|
|---|
| 133 | virtual void mouseRelativeMove(SInt32 xRel, SInt32 yRel);
|
|---|
| 134 | virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta);
|
|---|
| 135 | virtual void screensaver(bool activate);
|
|---|
| 136 | virtual void resetOptions();
|
|---|
| 137 | virtual void setOptions(const COptionsList& options);
|
|---|
| 138 |
|
|---|
| 139 | private:
|
|---|
| 140 | CScreen* m_screen;
|
|---|
| 141 | bool m_clipboardDirty[kClipboardEnd];
|
|---|
| 142 | SInt32 m_fakeInputCount;
|
|---|
| 143 | };
|
|---|
| 144 |
|
|---|
| 145 | #endif
|
|---|