2001-10-06 18:13:28 +04:00
|
|
|
#ifndef CCLIENT_H
|
|
|
|
#define CCLIENT_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-11 00:18:32 +04:00
|
|
|
class CServerProxy;
|
|
|
|
class CThread;
|
|
|
|
class IDataSocket;
|
2001-10-08 23:24:46 +04:00
|
|
|
class ISecondaryScreen;
|
2002-07-11 00:18:32 +04:00
|
|
|
class IServer;
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-07-11 00:18:32 +04:00
|
|
|
class CClient : 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-11-25 21:32:41 +03:00
|
|
|
// handle events on client's screen
|
2002-07-11 00:18:32 +04:00
|
|
|
// FIXME -- this should mimic methods on IServer
|
|
|
|
// FIXME -- maybe create a IScreenReceiver with these methods and
|
|
|
|
// have CPrimaryClient and CClient inherit from them. IServer
|
|
|
|
// still needs similar methods with extra parameters, though. so
|
|
|
|
// CServerProxy
|
|
|
|
// CPrimaryClient
|
|
|
|
// CClient
|
|
|
|
// need IScreenReceiver. these classes effective receive notifications
|
|
|
|
// from screens. note that there's another class of notifications that
|
|
|
|
// only the server needs (key, mouyse, screensaver). so maybe we have
|
|
|
|
// IPrimaryScreenReceiver and ISecondaryScreenReceiver (the latter is
|
|
|
|
// derived with no extra methods from IScreenReceiver).
|
2002-04-27 18:19:53 +04:00
|
|
|
void onClipboardChanged(ClipboardID);
|
2002-05-24 21:54:28 +04:00
|
|
|
void onResolutionChanged();
|
2001-11-25 21:32:41 +03:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
// IClient overrides
|
|
|
|
virtual bool open();
|
|
|
|
virtual void run();
|
|
|
|
virtual void close();
|
|
|
|
virtual void enter(SInt32 xAbs, SInt32 yAbs,
|
|
|
|
UInt32 seqNum, KeyModifierMask mask,
|
|
|
|
bool screenSaver);
|
|
|
|
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);
|
|
|
|
virtual void screenSaver(bool activate);
|
|
|
|
virtual CString getName() const;
|
|
|
|
virtual void getShape(SInt32& x, SInt32& y,
|
|
|
|
SInt32& width, SInt32& height) const;
|
|
|
|
virtual void getCenter(SInt32& x, SInt32& y) const;
|
|
|
|
virtual void getMousePos(SInt32& x, SInt32& y) const;
|
|
|
|
virtual SInt32 getJumpZoneSize() 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;
|
2001-10-08 23:24:46 +04:00
|
|
|
ISecondaryScreen* m_screen;
|
2002-07-11 00:18:32 +04:00
|
|
|
IServer* m_server;
|
|
|
|
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;
|
|
|
|
UInt32 m_seqNum;
|
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
|