2001-10-06 18:13:28 +04:00
|
|
|
#ifndef CCLIENT_H
|
|
|
|
#define CCLIENT_H
|
|
|
|
|
2002-07-11 01:22:28 +04:00
|
|
|
#include "IScreenReceiver.h"
|
2002-07-11 00:18:32 +04:00
|
|
|
#include "IClient.h"
|
2002-04-29 17:31:44 +04:00
|
|
|
#include "IClipboard.h"
|
2002-07-11 00:18:32 +04:00
|
|
|
#include "CNetworkAddress.h"
|
2002-06-11 02:06:45 +04:00
|
|
|
#include "CMutex.h"
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-07-14 02:00:38 +04:00
|
|
|
class CSecondaryScreen;
|
2002-07-11 00:18:32 +04:00
|
|
|
class CServerProxy;
|
|
|
|
class CThread;
|
|
|
|
class IDataSocket;
|
2002-07-11 01:22:28 +04:00
|
|
|
class IScreenReceiver;
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-07-11 01:22:28 +04:00
|
|
|
class CClient : public IScreenReceiver, public IClient {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-10-06 18:13:28 +04:00
|
|
|
CClient(const CString& clientName);
|
|
|
|
~CClient();
|
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
2002-06-10 02:20:28 +04:00
|
|
|
// turn camping on or off. when camping the client will keep
|
|
|
|
// trying to connect to the server until it succeeds. this
|
|
|
|
// is useful if the client may start before the server. do
|
|
|
|
// not call this while in run().
|
|
|
|
void camp(bool on);
|
|
|
|
|
2002-07-11 00:18:32 +04:00
|
|
|
// set the server's address that the client should connect to
|
|
|
|
void setAddress(const CNetworkAddress& serverAddress);
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-06-21 21:55:47 +04:00
|
|
|
// tell client to exit run() gracefully. this must only be called
|
|
|
|
// after a successful open().
|
2002-06-09 01:48:00 +04:00
|
|
|
void quit();
|
|
|
|
|
2001-10-06 18:13:28 +04:00
|
|
|
// accessors
|
|
|
|
|
2002-07-11 00:18:32 +04:00
|
|
|
// returns true if the server rejected us
|
|
|
|
bool wasRejected() const;
|
|
|
|
|
2002-07-11 01:22:28 +04:00
|
|
|
// IScreenReceiver overrides
|
|
|
|
virtual void onInfoChanged(const CClientInfo&);
|
|
|
|
virtual bool onGrabClipboard(ClipboardID);
|
|
|
|
virtual void onClipboardChanged(ClipboardID, const CString&);
|
|
|
|
|
2002-07-11 00:18:32 +04:00
|
|
|
// IClient overrides
|
|
|
|
virtual bool open();
|
|
|
|
virtual void run();
|
|
|
|
virtual void close();
|
2002-07-11 01:22:28 +04:00
|
|
|
// FIXME -- can we avoid passing everything here?
|
2002-07-11 00:18:32 +04:00
|
|
|
virtual void enter(SInt32 xAbs, SInt32 yAbs,
|
|
|
|
UInt32 seqNum, KeyModifierMask mask,
|
2002-07-14 02:00:38 +04:00
|
|
|
bool forScreensaver);
|
2002-07-11 00:18:32 +04:00
|
|
|
virtual bool leave();
|
|
|
|
virtual void setClipboard(ClipboardID, const CString&);
|
|
|
|
virtual void grabClipboard(ClipboardID);
|
|
|
|
virtual void setClipboardDirty(ClipboardID, bool dirty);
|
|
|
|
virtual void keyDown(KeyID, KeyModifierMask);
|
|
|
|
virtual void keyRepeat(KeyID, KeyModifierMask, SInt32 count);
|
|
|
|
virtual void keyUp(KeyID, KeyModifierMask);
|
|
|
|
virtual void mouseDown(ButtonID);
|
|
|
|
virtual void mouseUp(ButtonID);
|
|
|
|
virtual void mouseMove(SInt32 xAbs, SInt32 yAbs);
|
|
|
|
virtual void mouseWheel(SInt32 delta);
|
2002-07-14 02:00:38 +04:00
|
|
|
virtual void screensaver(bool activate);
|
2002-07-11 00:18:32 +04:00
|
|
|
virtual CString getName() const;
|
2002-07-14 02:00:38 +04:00
|
|
|
virtual SInt32 getJumpZoneSize() const;
|
2002-07-11 00:18:32 +04:00
|
|
|
virtual void getShape(SInt32& x, SInt32& y,
|
|
|
|
SInt32& width, SInt32& height) const;
|
2002-07-14 02:00:38 +04:00
|
|
|
virtual void getCursorPos(SInt32& x, SInt32& y) const;
|
|
|
|
virtual void getCursorCenter(SInt32& x, SInt32& y) const;
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2002-06-26 17:48:08 +04:00
|
|
|
// open/close the secondary screen
|
2001-11-19 03:33:36 +03:00
|
|
|
void openSecondaryScreen();
|
|
|
|
void closeSecondaryScreen();
|
|
|
|
|
2002-07-11 00:18:32 +04:00
|
|
|
// send the clipboard to the server
|
|
|
|
void sendClipboard(ClipboardID);
|
|
|
|
|
|
|
|
// handle server messaging
|
|
|
|
void runSession(void*);
|
|
|
|
void deleteSession(CThread*);
|
|
|
|
void runServer();
|
|
|
|
CServerProxy* handshakeServer(IDataSocket*);
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2001-11-25 21:32:41 +03:00
|
|
|
CMutex m_mutex;
|
2001-10-06 18:13:28 +04:00
|
|
|
CString m_name;
|
2002-07-14 02:00:38 +04:00
|
|
|
CSecondaryScreen* m_screen;
|
2002-07-11 01:22:28 +04:00
|
|
|
IScreenReceiver* m_server;
|
2002-07-11 00:18:32 +04:00
|
|
|
CNetworkAddress m_serverAddress;
|
2002-06-10 02:20:28 +04:00
|
|
|
bool m_camp;
|
2002-04-29 17:31:44 +04:00
|
|
|
bool m_active;
|
2002-07-11 00:18:32 +04:00
|
|
|
bool m_rejected;
|
2002-04-29 17:31:44 +04:00
|
|
|
bool m_ownClipboard[kClipboardEnd];
|
|
|
|
IClipboard::Time m_timeClipboard[kClipboardEnd];
|
2002-05-24 21:54:28 +04:00
|
|
|
CString m_dataClipboard[kClipboardEnd];
|
2001-10-06 18:13:28 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|