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.
|
|
|
|
*/
|
|
|
|
|
2002-07-09 21:22:31 +00:00
|
|
|
#include "CPrimaryClient.h"
|
2003-09-02 22:05:47 +00:00
|
|
|
#include "CScreen.h"
|
2002-07-09 21:22:31 +00:00
|
|
|
#include "CClipboard.h"
|
|
|
|
#include "CLog.h"
|
|
|
|
|
|
|
|
//
|
|
|
|
// CPrimaryClient
|
|
|
|
//
|
|
|
|
|
2004-02-14 14:04:36 +00:00
|
|
|
CPrimaryClient::CPrimaryClient(const CString& name, CScreen* screen) :
|
2002-07-09 21:22:31 +00:00
|
|
|
m_name(name),
|
2004-02-14 14:04:36 +00:00
|
|
|
m_screen(screen)
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
2004-02-14 14:04:36 +00:00
|
|
|
// all clipboards are clean
|
|
|
|
for (UInt32 i = 0; i < kClipboardEnd; ++i) {
|
|
|
|
m_clipboardDirty[i] = false;
|
2002-07-31 12:39:34 +00:00
|
|
|
}
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CPrimaryClient::~CPrimaryClient()
|
|
|
|
{
|
2004-02-14 16:30:27 +00:00
|
|
|
// do nothing
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-07-11 13:13:37 +00:00
|
|
|
CPrimaryClient::reconfigure(UInt32 activeSides)
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
2002-07-11 13:13:37 +00:00
|
|
|
m_screen->reconfigure(activeSides);
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
2004-02-15 17:32:11 +00:00
|
|
|
SInt32
|
|
|
|
CPrimaryClient::getJumpZoneSize() const
|
|
|
|
{
|
|
|
|
return m_screen->getJumpZoneSize();
|
|
|
|
}
|
|
|
|
|
2002-07-09 21:22:31 +00:00
|
|
|
void
|
2004-02-14 14:04:36 +00:00
|
|
|
CPrimaryClient::getCursorCenter(SInt32& x, SInt32& y) const
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
2004-02-14 14:04:36 +00:00
|
|
|
m_screen->getCursorCenter(x, y);
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KeyModifierMask
|
|
|
|
CPrimaryClient::getToggleMask() const
|
|
|
|
{
|
2003-09-02 22:05:47 +00:00
|
|
|
return m_screen->getActiveModifiers();
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
2004-02-14 14:04:36 +00:00
|
|
|
bool
|
|
|
|
CPrimaryClient::isLockedToScreen() const
|
2002-07-16 16:52:26 +00:00
|
|
|
{
|
2004-02-14 14:04:36 +00:00
|
|
|
return m_screen->isLockedToScreen();
|
2002-07-16 16:52:26 +00:00
|
|
|
}
|
|
|
|
|
2004-02-14 14:04:36 +00:00
|
|
|
void*
|
|
|
|
CPrimaryClient::getEventTarget() const
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
2004-02-14 14:04:36 +00:00
|
|
|
return m_screen->getEventTarget();
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2004-02-14 14:04:36 +00:00
|
|
|
CPrimaryClient::getClipboard(ClipboardID id, IClipboard* clipboard) const
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
2004-02-14 14:04:36 +00:00
|
|
|
return m_screen->getClipboard(id, clipboard);
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-02-14 14:04:36 +00:00
|
|
|
CPrimaryClient::getShape(SInt32& x, SInt32& y,
|
|
|
|
SInt32& width, SInt32& height) const
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
2004-02-14 14:04:36 +00:00
|
|
|
m_screen->getShape(x, y, width, height);
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-02-14 14:04:36 +00:00
|
|
|
CPrimaryClient::getCursorPos(SInt32& x, SInt32& y) const
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
2004-02-14 14:04:36 +00:00
|
|
|
m_screen->getCursorPos(x, y);
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
2003-09-02 22:05:47 +00:00
|
|
|
void
|
|
|
|
CPrimaryClient::enable()
|
|
|
|
{
|
|
|
|
m_screen->enable();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CPrimaryClient::disable()
|
|
|
|
{
|
|
|
|
m_screen->disable();
|
|
|
|
}
|
|
|
|
|
2002-07-09 21:22:31 +00:00
|
|
|
void
|
|
|
|
CPrimaryClient::enter(SInt32 xAbs, SInt32 yAbs,
|
2004-03-21 20:01:41 +00:00
|
|
|
UInt32 seqNum, KeyModifierMask mask, bool screensaver)
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
2004-02-14 14:04:36 +00:00
|
|
|
m_screen->setSequenceNumber(seqNum);
|
2003-09-02 22:05:47 +00:00
|
|
|
if (!screensaver) {
|
|
|
|
m_screen->warpCursor(xAbs, yAbs);
|
|
|
|
}
|
2004-03-21 20:01:41 +00:00
|
|
|
m_screen->enter(mask);
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CPrimaryClient::leave()
|
|
|
|
{
|
|
|
|
return m_screen->leave();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-02-15 17:32:11 +00:00
|
|
|
CPrimaryClient::setClipboard(ClipboardID id, const IClipboard* clipboard)
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
|
|
|
// ignore if this clipboard is already clean
|
|
|
|
if (m_clipboardDirty[id]) {
|
|
|
|
// this clipboard is now clean
|
|
|
|
m_clipboardDirty[id] = false;
|
|
|
|
|
|
|
|
// set clipboard
|
2004-02-15 17:32:11 +00:00
|
|
|
m_screen->setClipboard(id, clipboard);
|
2002-07-09 21:22:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CPrimaryClient::grabClipboard(ClipboardID id)
|
|
|
|
{
|
|
|
|
// grab clipboard
|
|
|
|
m_screen->grabClipboard(id);
|
|
|
|
|
|
|
|
// clipboard is dirty (because someone else owns it now)
|
|
|
|
m_clipboardDirty[id] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CPrimaryClient::setClipboardDirty(ClipboardID id, bool dirty)
|
|
|
|
{
|
|
|
|
m_clipboardDirty[id] = dirty;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-04-27 17:01:14 +00:00
|
|
|
CPrimaryClient::keyDown(KeyID, KeyModifierMask, KeyButton)
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-04-27 17:01:14 +00:00
|
|
|
CPrimaryClient::keyRepeat(KeyID, KeyModifierMask, SInt32, KeyButton)
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-04-27 17:01:14 +00:00
|
|
|
CPrimaryClient::keyUp(KeyID, KeyModifierMask, KeyButton)
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CPrimaryClient::mouseDown(ButtonID)
|
|
|
|
{
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CPrimaryClient::mouseUp(ButtonID)
|
|
|
|
{
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CPrimaryClient::mouseMove(SInt32 x, SInt32 y)
|
|
|
|
{
|
|
|
|
m_screen->warpCursor(x, y);
|
|
|
|
}
|
|
|
|
|
2004-05-01 15:18:59 +00:00
|
|
|
void
|
|
|
|
CPrimaryClient::mouseRelativeMove(SInt32, SInt32)
|
|
|
|
{
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
|
2002-07-09 21:22:31 +00:00
|
|
|
void
|
|
|
|
CPrimaryClient::mouseWheel(SInt32)
|
|
|
|
{
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-07-13 22:00:38 +00:00
|
|
|
CPrimaryClient::screensaver(bool)
|
2002-07-09 21:22:31 +00:00
|
|
|
{
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
|
2002-12-23 13:55:21 +00:00
|
|
|
void
|
|
|
|
CPrimaryClient::resetOptions()
|
|
|
|
{
|
|
|
|
m_screen->resetOptions();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CPrimaryClient::setOptions(const COptionsList& options)
|
|
|
|
{
|
|
|
|
m_screen->setOptions(options);
|
|
|
|
}
|
|
|
|
|
2002-07-09 21:22:31 +00:00
|
|
|
CString
|
|
|
|
CPrimaryClient::getName() const
|
|
|
|
{
|
|
|
|
return m_name;
|
|
|
|
}
|