• Main Page
  • Classes
  • Files
  • File List

CPrimaryClient.cpp

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2012 Bolton Software Ltd.
00004  * Copyright (C) 2002 Chris Schoeneman
00005  * 
00006  * This package is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * found in the file COPYING that should have accompanied this file.
00009  * 
00010  * This package is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include "CPrimaryClient.h"
00020 #include "CScreen.h"
00021 #include "CClipboard.h"
00022 #include "CLog.h"
00023 
00024 //
00025 // CPrimaryClient
00026 //
00027 
00028 CPrimaryClient::CPrimaryClient(const CString& name, CScreen* screen) :
00029     CBaseClientProxy(name),
00030     m_screen(screen),
00031     m_fakeInputCount(0)
00032 {
00033     // all clipboards are clean
00034     for (UInt32 i = 0; i < kClipboardEnd; ++i) {
00035         m_clipboardDirty[i] = false;
00036     }
00037 }
00038 
00039 CPrimaryClient::~CPrimaryClient()
00040 {
00041     // do nothing
00042 }
00043 
00044 void
00045 CPrimaryClient::reconfigure(UInt32 activeSides)
00046 {
00047     m_screen->reconfigure(activeSides);
00048 }
00049 
00050 UInt32
00051 CPrimaryClient::registerHotKey(KeyID key, KeyModifierMask mask)
00052 {
00053     return m_screen->registerHotKey(key, mask);
00054 }
00055 
00056 void
00057 CPrimaryClient::unregisterHotKey(UInt32 id)
00058 {
00059     m_screen->unregisterHotKey(id);
00060 }
00061 
00062 void
00063 CPrimaryClient::fakeInputBegin()
00064 {
00065     if (++m_fakeInputCount == 1) {
00066         m_screen->fakeInputBegin();
00067     }
00068 }
00069 
00070 void
00071 CPrimaryClient::fakeInputEnd()
00072 {
00073     if (--m_fakeInputCount == 0) {
00074         m_screen->fakeInputEnd();
00075     }
00076 }
00077 
00078 SInt32
00079 CPrimaryClient::getJumpZoneSize() const
00080 {
00081     return m_screen->getJumpZoneSize();
00082 }
00083 
00084 void
00085 CPrimaryClient::getCursorCenter(SInt32& x, SInt32& y) const
00086 {
00087     m_screen->getCursorCenter(x, y);
00088 }
00089 
00090 KeyModifierMask
00091 CPrimaryClient::getToggleMask() const
00092 {
00093     return m_screen->pollActiveModifiers();
00094 }
00095 
00096 bool
00097 CPrimaryClient::isLockedToScreen() const
00098 {
00099     return m_screen->isLockedToScreen();
00100 }
00101 
00102 void*
00103 CPrimaryClient::getEventTarget() const
00104 {
00105     return m_screen->getEventTarget();
00106 }
00107 
00108 bool
00109 CPrimaryClient::getClipboard(ClipboardID id, IClipboard* clipboard) const
00110 {
00111     return m_screen->getClipboard(id, clipboard);
00112 }
00113 
00114 void
00115 CPrimaryClient::getShape(SInt32& x, SInt32& y,
00116                 SInt32& width, SInt32& height) const
00117 {
00118     m_screen->getShape(x, y, width, height);
00119 }
00120 
00121 void
00122 CPrimaryClient::getCursorPos(SInt32& x, SInt32& y) const
00123 {
00124     m_screen->getCursorPos(x, y);
00125 }
00126 
00127 void
00128 CPrimaryClient::enable()
00129 {
00130     m_screen->enable();
00131 }
00132 
00133 void
00134 CPrimaryClient::disable()
00135 {
00136     m_screen->disable();
00137 }
00138 
00139 void
00140 CPrimaryClient::enter(SInt32 xAbs, SInt32 yAbs,
00141                 UInt32 seqNum, KeyModifierMask mask, bool screensaver)
00142 {
00143     m_screen->setSequenceNumber(seqNum);
00144     if (!screensaver) {
00145         m_screen->warpCursor(xAbs, yAbs);
00146     }
00147     m_screen->enter(mask);
00148 }
00149 
00150 bool
00151 CPrimaryClient::leave()
00152 {
00153     return m_screen->leave();
00154 }
00155 
00156 void
00157 CPrimaryClient::setClipboard(ClipboardID id, const IClipboard* clipboard)
00158 {
00159     // ignore if this clipboard is already clean
00160     if (m_clipboardDirty[id]) {
00161         // this clipboard is now clean
00162         m_clipboardDirty[id] = false;
00163 
00164         // set clipboard
00165         m_screen->setClipboard(id, clipboard);
00166     }
00167 }
00168 
00169 void
00170 CPrimaryClient::grabClipboard(ClipboardID id)
00171 {
00172     // grab clipboard
00173     m_screen->grabClipboard(id);
00174 
00175     // clipboard is dirty (because someone else owns it now)
00176     m_clipboardDirty[id] = true;
00177 }
00178 
00179 void
00180 CPrimaryClient::setClipboardDirty(ClipboardID id, bool dirty)
00181 {
00182     m_clipboardDirty[id] = dirty;
00183 }
00184 
00185 void
00186 CPrimaryClient::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
00187 {
00188     if (m_fakeInputCount > 0) {
00189 // XXX -- don't forward keystrokes to primary screen for now
00190         (void)key;
00191         (void)mask;
00192         (void)button;
00193 //      m_screen->keyDown(key, mask, button);
00194     }
00195 }
00196 
00197 void
00198 CPrimaryClient::keyRepeat(KeyID, KeyModifierMask, SInt32, KeyButton)
00199 {
00200     // ignore
00201 }
00202 
00203 void
00204 CPrimaryClient::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
00205 {
00206     if (m_fakeInputCount > 0) {
00207 // XXX -- don't forward keystrokes to primary screen for now
00208         (void)key;
00209         (void)mask;
00210         (void)button;
00211 //      m_screen->keyUp(key, mask, button);
00212     }
00213 }
00214 
00215 void
00216 CPrimaryClient::mouseDown(ButtonID)
00217 {
00218     // ignore
00219 }
00220 
00221 void
00222 CPrimaryClient::mouseUp(ButtonID)
00223 {
00224     // ignore
00225 }
00226 
00227 void
00228 CPrimaryClient::mouseMove(SInt32 x, SInt32 y)
00229 {
00230     m_screen->warpCursor(x, y);
00231 }
00232 
00233 void
00234 CPrimaryClient::mouseRelativeMove(SInt32, SInt32)
00235 {
00236     // ignore
00237 }
00238 
00239 void
00240 CPrimaryClient::mouseWheel(SInt32, SInt32)
00241 {
00242     // ignore
00243 }
00244 
00245 void
00246 CPrimaryClient::gameDeviceButtons(GameDeviceID, GameDeviceButton)
00247 {
00248     // ignore
00249 }
00250 
00251 void
00252 CPrimaryClient::gameDeviceSticks(GameDeviceID, SInt16, SInt16, SInt16, SInt16)
00253 {
00254     // ignore
00255 }
00256 
00257 void
00258 CPrimaryClient::gameDeviceTriggers(GameDeviceID, UInt8, UInt8)
00259 {
00260     // ignore
00261 }
00262 
00263 void
00264 CPrimaryClient::gameDeviceTimingReq()
00265 {
00266     // ignore
00267 }
00268 
00269 void
00270 CPrimaryClient::screensaver(bool)
00271 {
00272     // ignore
00273 }
00274 
00275 void
00276 CPrimaryClient::resetOptions()
00277 {
00278     m_screen->resetOptions();
00279 }
00280 
00281 void
00282 CPrimaryClient::setOptions(const COptionsList& options)
00283 {
00284     m_screen->setOptions(options);
00285 }

Generated on Tue May 21 2013 00:00:05 for Synergy by  doxygen 1.7.1