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