Moved Screen class into synergy namespace

This commit is contained in:
Xinyu Hou 2014-11-11 17:45:24 +00:00
parent a4843c4947
commit 67377109f3
18 changed files with 68 additions and 55 deletions

View File

@ -54,7 +54,7 @@ Client::Client(
const String& name, const NetworkAddress& address, const String& name, const NetworkAddress& address,
ISocketFactory* socketFactory, ISocketFactory* socketFactory,
IStreamFilterFactory* streamFilterFactory, IStreamFilterFactory* streamFilterFactory,
Screen* screen, synergy::Screen* screen,
const CryptoOptions& crypto, const CryptoOptions& crypto,
bool enableDragDrop) : bool enableDragDrop) :
m_mock(false), m_mock(false),

View File

@ -28,7 +28,7 @@
#include "base/EventTypes.h" #include "base/EventTypes.h"
class EventQueueTimer; class EventQueueTimer;
class Screen; namespace synergy { class Screen; }
class ServerProxy; class ServerProxy;
class IDataSocket; class IDataSocket;
class ISocketFactory; class ISocketFactory;
@ -61,7 +61,7 @@ public:
const String& name, const NetworkAddress& address, const String& name, const NetworkAddress& address,
ISocketFactory* socketFactory, ISocketFactory* socketFactory,
IStreamFilterFactory* streamFilterFactory, IStreamFilterFactory* streamFilterFactory,
Screen* screen, synergy::Screen* screen,
const CryptoOptions& crypto, const CryptoOptions& crypto,
bool enableDragDrop); bool enableDragDrop);
~Client(); ~Client();
@ -211,7 +211,7 @@ private:
NetworkAddress m_serverAddress; NetworkAddress m_serverAddress;
ISocketFactory* m_socketFactory; ISocketFactory* m_socketFactory;
IStreamFilterFactory* m_streamFilterFactory; IStreamFilterFactory* m_streamFilterFactory;
Screen* m_screen; synergy::Screen* m_screen;
synergy::IStream* m_stream; synergy::IStream* m_stream;
EventQueueTimer* m_timer; EventQueueTimer* m_timer;
ServerProxy* m_server; ServerProxy* m_server;

View File

@ -937,7 +937,7 @@ CXWindowsClipboard::pushReplies()
for (ReplyMap::iterator index = m_replies.begin(); for (ReplyMap::iterator index = m_replies.begin();
index != m_replies.end(); ) { index != m_replies.end(); ) {
assert(!index->second.empty()); assert(!index->second.empty());
CReplyList::iterator listit = index->second.begin(); ReplyList::iterator listit = index->second.begin();
while (listit != index->second.end()) { while (listit != index->second.end()) {
if (!(*listit)->m_replied) if (!(*listit)->m_replied)
break; break;

View File

@ -26,7 +26,7 @@
// PrimaryClient // PrimaryClient
// //
PrimaryClient::PrimaryClient(const String& name, Screen* screen) : PrimaryClient::PrimaryClient(const String& name, synergy::Screen* screen) :
BaseClientProxy(name), BaseClientProxy(name),
m_screen(screen), m_screen(screen),
m_fakeInputCount(0) m_fakeInputCount(0)

View File

@ -21,7 +21,7 @@
#include "server/BaseClientProxy.h" #include "server/BaseClientProxy.h"
#include "synergy/protocol_types.h" #include "synergy/protocol_types.h"
class Screen; namespace synergy { class Screen; }
//! Primary screen as pseudo-client //! Primary screen as pseudo-client
/*! /*!
@ -34,7 +34,7 @@ public:
/*! /*!
\c name is the name of the server and \p screen is primary screen. \c name is the name of the server and \p screen is primary screen.
*/ */
PrimaryClient(const String& name, Screen* screen); PrimaryClient(const String& name, synergy::Screen* screen);
~PrimaryClient(); ~PrimaryClient();
#ifdef TEST_ENV #ifdef TEST_ENV
@ -147,7 +147,7 @@ public:
virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize); virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize);
private: private:
Screen* m_screen; synergy::Screen* m_screen;
bool m_clipboardDirty[kClipboardEnd]; bool m_clipboardDirty[kClipboardEnd];
SInt32 m_fakeInputCount; SInt32 m_fakeInputCount;
}; };

View File

@ -53,7 +53,7 @@
Server::Server( Server::Server(
Config& config, Config& config,
PrimaryClient* primaryClient, PrimaryClient* primaryClient,
Screen* screen, synergy::Screen* screen,
IEventQueue* events, IEventQueue* events,
bool enableDragDrop) : bool enableDragDrop) :
m_mock(false), m_mock(false),

View File

@ -36,7 +36,7 @@ class BaseClientProxy;
class EventQueueTimer; class EventQueueTimer;
class PrimaryClient; class PrimaryClient;
class InputFilter; class InputFilter;
class Screen; namespace synergy { class Screen; }
class IEventQueue; class IEventQueue;
class Thread; class Thread;
@ -104,7 +104,8 @@ public:
client (local screen) \p primaryClient. The client retains client (local screen) \p primaryClient. The client retains
ownership of \p primaryClient. ownership of \p primaryClient.
*/ */
Server(Config& config, PrimaryClient* primaryClient, Screen* screen, IEventQueue* events, bool enableDragDrop); Server(Config& config, PrimaryClient* primaryClient,
synergy::Screen* screen, IEventQueue* events, bool enableDragDrop);
~Server(); ~Server();
#ifdef TEST_ENV #ifdef TEST_ENV
@ -457,7 +458,7 @@ private:
bool m_lockedToScreen; bool m_lockedToScreen;
// server screen // server screen
Screen* m_screen; synergy::Screen* m_screen;
IEventQueue* m_events; IEventQueue* m_events;

View File

@ -288,7 +288,7 @@ MinimalApp::foregroundStartup(int argc, char** argv)
return 0; return 0;
} }
Screen* synergy::Screen*
MinimalApp::createScreen() MinimalApp::createScreen()
{ {
return NULL; return NULL;

View File

@ -35,7 +35,7 @@ class IArchTaskBarReceiver;
class BufferedLogOutputter; class BufferedLogOutputter;
class ILogOutputter; class ILogOutputter;
class FileLogOutputter; class FileLogOutputter;
class Screen; namespace synergy { class Screen; }
class IEventQueue; class IEventQueue;
class SocketMultiplexer; class SocketMultiplexer;
@ -133,7 +133,8 @@ public:
virtual void startNode(); virtual void startNode();
virtual int mainLoop(); virtual int mainLoop();
virtual int foregroundStartup(int argc, char** argv); virtual int foregroundStartup(int argc, char** argv);
virtual Screen* createScreen(); virtual synergy::Screen*
createScreen();
virtual void loadConfig(); virtual void loadConfig();
virtual bool loadConfig(const String& pathname); virtual bool loadConfig(const String& pathname);
virtual const char* daemonInfo() const; virtual const char* daemonInfo() const;

View File

@ -169,18 +169,18 @@ ClientApp::daemonInfo() const
#endif #endif
} }
Screen* synergy::Screen*
ClientApp::createScreen() ClientApp::createScreen()
{ {
#if WINAPI_MSWINDOWS #if WINAPI_MSWINDOWS
return new Screen(new CMSWindowsScreen( return new synergy::Screen(new CMSWindowsScreen(
false, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events); false, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
#elif WINAPI_XWINDOWS #elif WINAPI_XWINDOWS
return new Screen(new CXWindowsScreen( return new synergy::Screen(new CXWindowsScreen(
args().m_display, false, args().m_disableXInitThreads, args().m_display, false, args().m_disableXInitThreads,
args().m_yscroll, m_events), m_events); args().m_yscroll, m_events), m_events);
#elif WINAPI_CARBON #elif WINAPI_CARBON
return new Screen(new OSXScreen(m_events, false), m_events); return new synergy::Screen(new OSXScreen(m_events, false), m_events);
#endif #endif
} }
@ -240,10 +240,10 @@ ClientApp::handleScreenError(const Event&, void*)
} }
Screen* synergy::Screen*
ClientApp::openClientScreen() ClientApp::openClientScreen()
{ {
Screen* screen = createScreen(); synergy::Screen* screen = createScreen();
screen->setEnableDragDrop(argsBase().m_enableDragDrop); screen->setEnableDragDrop(argsBase().m_enableDragDrop);
m_events->adoptHandler(m_events->forIScreen().error(), m_events->adoptHandler(m_events->forIScreen().error(),
screen->getEventTarget(), screen->getEventTarget(),
@ -254,7 +254,7 @@ ClientApp::openClientScreen()
void void
ClientApp::closeClientScreen(Screen* screen) ClientApp::closeClientScreen(synergy::Screen* screen)
{ {
if (screen != NULL) { if (screen != NULL) {
m_events->removeHandler(m_events->forIScreen().error(), m_events->removeHandler(m_events->forIScreen().error(),
@ -333,7 +333,8 @@ ClientApp::handleClientDisconnected(const Event&, void*)
Client* Client*
ClientApp::openClient(const String& name, const NetworkAddress& address, Screen* screen, const CryptoOptions& crypto) ClientApp::openClient(const String& name, const NetworkAddress& address,
synergy::Screen* screen, const CryptoOptions& crypto)
{ {
Client* client = new Client( Client* client = new Client(
m_events, m_events,
@ -396,7 +397,7 @@ bool
ClientApp::startClient() ClientApp::startClient()
{ {
double retryTime; double retryTime;
Screen* clientScreen = NULL; synergy::Screen* clientScreen = NULL;
try { try {
if (m_clientScreen == NULL) { if (m_clientScreen == NULL) {
clientScreen = openClientScreen(); clientScreen = openClientScreen();

View File

@ -20,7 +20,7 @@
#include "synergy/App.h" #include "synergy/App.h"
class Screen; namespace synergy { class Screen; }
class Event; class Event;
class Client; class Client;
class NetworkAddress; class NetworkAddress;
@ -52,20 +52,21 @@ public:
int foregroundStartup(int argc, char** argv); int foregroundStartup(int argc, char** argv);
int standardStartup(int argc, char** argv); int standardStartup(int argc, char** argv);
int runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup); int runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup);
Screen* createScreen(); synergy::Screen* createScreen();
void updateStatus(); void updateStatus();
void updateStatus(const String& msg); void updateStatus(const String& msg);
void resetRestartTimeout(); void resetRestartTimeout();
double nextRestartTimeout(); double nextRestartTimeout();
void handleScreenError(const Event&, void*); void handleScreenError(const Event&, void*);
Screen* openClientScreen(); synergy::Screen* openClientScreen();
void closeClientScreen(Screen* screen); void closeClientScreen(synergy::Screen* screen);
void handleClientRestart(const Event&, void* vtimer); void handleClientRestart(const Event&, void* vtimer);
void scheduleClientRestart(double retryTime); void scheduleClientRestart(double retryTime);
void handleClientConnected(const Event&, void*); void handleClientConnected(const Event&, void*);
void handleClientFailed(const Event& e, void*); void handleClientFailed(const Event& e, void*);
void handleClientDisconnected(const Event&, void*); void handleClientDisconnected(const Event&, void*);
Client* openClient(const String& name, const NetworkAddress& address, Screen* screen, const CryptoOptions& crypto); Client* openClient(const String& name, const NetworkAddress& address,
synergy::Screen* screen, const CryptoOptions& crypto);
void closeClient(Client* client); void closeClient(Client* client);
bool startClient(); bool startClient();
void stopClient(); void stopClient();
@ -78,6 +79,6 @@ public:
private: private:
Client* m_client; Client* m_client;
Screen* m_clientScreen; synergy::Screen*m_clientScreen;
NetworkAddress* m_serverAddress; NetworkAddress* m_serverAddress;
}; };

View File

@ -25,7 +25,7 @@ typedef int (*StartupFunc)(int, char**);
class ILogOutputter; class ILogOutputter;
class ArgsBase; class ArgsBase;
class IArchTaskBarReceiver; class IArchTaskBarReceiver;
class Screen; namespace synergy { class Screen; }
class IEventQueue; class IEventQueue;
class IApp : public IInterface class IApp : public IInterface
@ -42,6 +42,6 @@ public:
virtual void initApp(int argc, const char** argv) = 0; virtual void initApp(int argc, const char** argv) = 0;
virtual const char* daemonName() const = 0; virtual const char* daemonName() const = 0;
virtual int foregroundStartup(int argc, char** argv) = 0; virtual int foregroundStartup(int argc, char** argv) = 0;
virtual Screen* createScreen() = 0; virtual synergy::Screen* createScreen() = 0;
virtual IEventQueue* getEvents() const = 0; virtual IEventQueue* getEvents() const = 0;
}; };

View File

@ -24,6 +24,8 @@
#include "server/ClientProxy.h" #include "server/ClientProxy.h"
#include "base/TMethodEventJob.h" #include "base/TMethodEventJob.h"
namespace synergy {
// //
// Screen // Screen
// //
@ -553,3 +555,5 @@ Screen::leaveSecondary()
// release any keys we think are still down // release any keys we think are still down
m_screen->fakeAllKeysUp(); m_screen->fakeAllKeysUp();
} }
}

View File

@ -30,6 +30,8 @@ class IClipboard;
class IPlatformScreen; class IPlatformScreen;
class IEventQueue; class IEventQueue;
namespace synergy {
//! Platform independent screen //! Platform independent screen
/*! /*!
This is a platform independent screen. It can work as either a This is a platform independent screen. It can work as either a
@ -339,3 +341,5 @@ private:
bool m_mock; bool m_mock;
bool m_enableDragDrop; bool m_enableDragDrop;
}; };
}

View File

@ -359,7 +359,7 @@ ServerApp::closePrimaryClient(PrimaryClient* primaryClient)
} }
void void
ServerApp::closeServerScreen(Screen* screen) ServerApp::closeServerScreen(synergy::Screen* screen)
{ {
if (screen != NULL) { if (screen != NULL) {
m_events->removeHandler(m_events->forIScreen().error(), m_events->removeHandler(m_events->forIScreen().error(),
@ -447,7 +447,7 @@ bool ServerApp::initServer()
} }
double retryTime; double retryTime;
Screen* serverScreen = NULL; synergy::Screen* serverScreen = NULL;
PrimaryClient* primaryClient = NULL; PrimaryClient* primaryClient = NULL;
try { try {
String name = args().m_config->getCanonicalName(args().m_name); String name = args().m_config->getCanonicalName(args().m_name);
@ -495,9 +495,10 @@ bool ServerApp::initServer()
} }
} }
Screen* ServerApp::openServerScreen() synergy::Screen*
ServerApp::openServerScreen()
{ {
Screen* screen = createScreen(); synergy::Screen* screen = createScreen();
screen->setEnableDragDrop(argsBase().m_enableDragDrop); screen->setEnableDragDrop(argsBase().m_enableDragDrop);
m_events->adoptHandler(m_events->forIScreen().error(), m_events->adoptHandler(m_events->forIScreen().error(),
screen->getEventTarget(), screen->getEventTarget(),
@ -576,22 +577,22 @@ ServerApp::startServer()
} }
} }
Screen* synergy::Screen*
ServerApp::createScreen() ServerApp::createScreen()
{ {
#if WINAPI_MSWINDOWS #if WINAPI_MSWINDOWS
return new Screen(new CMSWindowsScreen( return new synergy::Screen(new CMSWindowsScreen(
true, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events); true, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
#elif WINAPI_XWINDOWS #elif WINAPI_XWINDOWS
return new Screen(new CXWindowsScreen( return new synergy::Screen(new CXWindowsScreen(
args().m_display, true, args().m_disableXInitThreads, 0, m_events), m_events); args().m_display, true, args().m_disableXInitThreads, 0, m_events), m_events);
#elif WINAPI_CARBON #elif WINAPI_CARBON
return new Screen(new OSXScreen(m_events, true), m_events); return new synergy::Screen(new OSXScreen(m_events, true), m_events);
#endif #endif
} }
PrimaryClient* PrimaryClient*
ServerApp::openPrimaryClient(const String& name, Screen* screen) ServerApp::openPrimaryClient(const String& name, synergy::Screen* screen)
{ {
LOG((CLOG_DEBUG1 "creating primary screen")); LOG((CLOG_DEBUG1 "creating primary screen"));
return new PrimaryClient(name, screen); return new PrimaryClient(name, screen);

View File

@ -40,7 +40,7 @@ enum EServerState {
}; };
class Server; class Server;
class Screen; namespace synergy { class Screen; }
class ClientListener; class ClientListener;
class EventQueueTimer; class EventQueueTimer;
class ILogOutputter; class ILogOutputter;
@ -81,13 +81,13 @@ public:
void closeClientListener(ClientListener* listen); void closeClientListener(ClientListener* listen);
void stopServer(); void stopServer();
void closePrimaryClient(PrimaryClient* primaryClient); void closePrimaryClient(PrimaryClient* primaryClient);
void closeServerScreen(Screen* screen); void closeServerScreen(synergy::Screen* screen);
void cleanupServer(); void cleanupServer();
bool initServer(); bool initServer();
void retryHandler(const Event&, void*); void retryHandler(const Event&, void*);
Screen* openServerScreen(); synergy::Screen* openServerScreen();
Screen* createScreen(); synergy::Screen* createScreen();
PrimaryClient* openPrimaryClient(const String& name, Screen* screen); PrimaryClient* openPrimaryClient(const String& name, synergy::Screen* screen);
void handleScreenError(const Event&, void*); void handleScreenError(const Event&, void*);
void handleSuspend(const Event&, void*); void handleSuspend(const Event&, void*);
void handleResume(const Event&, void*); void handleResume(const Event&, void*);
@ -107,7 +107,7 @@ public:
Server* m_server; Server* m_server;
EServerState m_serverState; EServerState m_serverState;
Screen* m_serverScreen; synergy::Screen* m_serverScreen;
PrimaryClient* m_primaryClient; PrimaryClient* m_primaryClient;
ClientListener* m_listener; ClientListener* m_listener;
EventQueueTimer* m_timer; EventQueueTimer* m_timer;

View File

@ -40,5 +40,5 @@ public:
MOCK_METHOD0(startNode, void()); MOCK_METHOD0(startNode, void());
MOCK_METHOD0(mainLoop, int()); MOCK_METHOD0(mainLoop, int());
MOCK_METHOD2(foregroundStartup, int(int, char**)); MOCK_METHOD2(foregroundStartup, int(int, char**));
MOCK_METHOD0(createScreen, Screen*()); MOCK_METHOD0(createScreen, synergy::Screen*());
}; };

View File

@ -23,10 +23,10 @@
#include "test/global/gmock.h" #include "test/global/gmock.h"
class MockScreen : public Screen class MockScreen : public synergy::Screen
{ {
public: public:
MockScreen() : Screen() { } MockScreen() : synergy::Screen() { }
MOCK_METHOD0(disable, void()); MOCK_METHOD0(disable, void());
MOCK_CONST_METHOD4(getShape, void(SInt32&, SInt32&, SInt32&, SInt32&)); MOCK_CONST_METHOD4(getShape, void(SInt32&, SInt32&, SInt32&, SInt32&));
MOCK_CONST_METHOD2(getCursorPos, void(SInt32&, SInt32&)); MOCK_CONST_METHOD2(getCursorPos, void(SInt32&, SInt32&));