source: vendor/synergy/current/lib/server/CPrimaryClient.cpp

Last change on this file was 2749, checked in by bird, 19 years ago

synergy v1.3.1 sources (zip).

File size: 4.4 KB
Line 
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#include "CPrimaryClient.h"
16#include "CScreen.h"
17#include "CClipboard.h"
18#include "CLog.h"
19
20//
21// CPrimaryClient
22//
23
24CPrimaryClient::CPrimaryClient(const CString& name, CScreen* screen) :
25 CBaseClientProxy(name),
26 m_screen(screen),
27 m_fakeInputCount(0)
28{
29 // all clipboards are clean
30 for (UInt32 i = 0; i < kClipboardEnd; ++i) {
31 m_clipboardDirty[i] = false;
32 }
33}
34
35CPrimaryClient::~CPrimaryClient()
36{
37 // do nothing
38}
39
40void
41CPrimaryClient::reconfigure(UInt32 activeSides)
42{
43 m_screen->reconfigure(activeSides);
44}
45
46UInt32
47CPrimaryClient::registerHotKey(KeyID key, KeyModifierMask mask)
48{
49 return m_screen->registerHotKey(key, mask);
50}
51
52void
53CPrimaryClient::unregisterHotKey(UInt32 id)
54{
55 m_screen->unregisterHotKey(id);
56}
57
58void
59CPrimaryClient::fakeInputBegin()
60{
61 if (++m_fakeInputCount == 1) {
62 m_screen->fakeInputBegin();
63 }
64}
65
66void
67CPrimaryClient::fakeInputEnd()
68{
69 if (--m_fakeInputCount == 0) {
70 m_screen->fakeInputEnd();
71 }
72}
73
74SInt32
75CPrimaryClient::getJumpZoneSize() const
76{
77 return m_screen->getJumpZoneSize();
78}
79
80void
81CPrimaryClient::getCursorCenter(SInt32& x, SInt32& y) const
82{
83 m_screen->getCursorCenter(x, y);
84}
85
86KeyModifierMask
87CPrimaryClient::getToggleMask() const
88{
89 return m_screen->pollActiveModifiers();
90}
91
92bool
93CPrimaryClient::isLockedToScreen() const
94{
95 return m_screen->isLockedToScreen();
96}
97
98void*
99CPrimaryClient::getEventTarget() const
100{
101 return m_screen->getEventTarget();
102}
103
104bool
105CPrimaryClient::getClipboard(ClipboardID id, IClipboard* clipboard) const
106{
107 return m_screen->getClipboard(id, clipboard);
108}
109
110void
111CPrimaryClient::getShape(SInt32& x, SInt32& y,
112 SInt32& width, SInt32& height) const
113{
114 m_screen->getShape(x, y, width, height);
115}
116
117void
118CPrimaryClient::getCursorPos(SInt32& x, SInt32& y) const
119{
120 m_screen->getCursorPos(x, y);
121}
122
123void
124CPrimaryClient::enable()
125{
126 m_screen->enable();
127}
128
129void
130CPrimaryClient::disable()
131{
132 m_screen->disable();
133}
134
135void
136CPrimaryClient::enter(SInt32 xAbs, SInt32 yAbs,
137 UInt32 seqNum, KeyModifierMask mask, bool screensaver)
138{
139 m_screen->setSequenceNumber(seqNum);
140 if (!screensaver) {
141 m_screen->warpCursor(xAbs, yAbs);
142 }
143 m_screen->enter(mask);
144}
145
146bool
147CPrimaryClient::leave()
148{
149 return m_screen->leave();
150}
151
152void
153CPrimaryClient::setClipboard(ClipboardID id, const IClipboard* clipboard)
154{
155 // ignore if this clipboard is already clean
156 if (m_clipboardDirty[id]) {
157 // this clipboard is now clean
158 m_clipboardDirty[id] = false;
159
160 // set clipboard
161 m_screen->setClipboard(id, clipboard);
162 }
163}
164
165void
166CPrimaryClient::grabClipboard(ClipboardID id)
167{
168 // grab clipboard
169 m_screen->grabClipboard(id);
170
171 // clipboard is dirty (because someone else owns it now)
172 m_clipboardDirty[id] = true;
173}
174
175void
176CPrimaryClient::setClipboardDirty(ClipboardID id, bool dirty)
177{
178 m_clipboardDirty[id] = dirty;
179}
180
181void
182CPrimaryClient::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
183{
184 if (m_fakeInputCount > 0) {
185// XXX -- don't forward keystrokes to primary screen for now
186 (void)key;
187 (void)mask;
188 (void)button;
189// m_screen->keyDown(key, mask, button);
190 }
191}
192
193void
194CPrimaryClient::keyRepeat(KeyID, KeyModifierMask, SInt32, KeyButton)
195{
196 // ignore
197}
198
199void
200CPrimaryClient::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
201{
202 if (m_fakeInputCount > 0) {
203// XXX -- don't forward keystrokes to primary screen for now
204 (void)key;
205 (void)mask;
206 (void)button;
207// m_screen->keyUp(key, mask, button);
208 }
209}
210
211void
212CPrimaryClient::mouseDown(ButtonID)
213{
214 // ignore
215}
216
217void
218CPrimaryClient::mouseUp(ButtonID)
219{
220 // ignore
221}
222
223void
224CPrimaryClient::mouseMove(SInt32 x, SInt32 y)
225{
226 m_screen->warpCursor(x, y);
227}
228
229void
230CPrimaryClient::mouseRelativeMove(SInt32, SInt32)
231{
232 // ignore
233}
234
235void
236CPrimaryClient::mouseWheel(SInt32, SInt32)
237{
238 // ignore
239}
240
241void
242CPrimaryClient::screensaver(bool)
243{
244 // ignore
245}
246
247void
248CPrimaryClient::resetOptions()
249{
250 m_screen->resetOptions();
251}
252
253void
254CPrimaryClient::setOptions(const COptionsList& options)
255{
256 m_screen->setOptions(options);
257}
Note: See TracBrowser for help on using the repository browser.