From 67377109f3bac950520e858f308660a92f5a3a5b Mon Sep 17 00:00:00 2001 From: Xinyu Hou Date: Tue, 11 Nov 2014 17:45:24 +0000 Subject: [PATCH] Moved Screen class into synergy namespace --- src/lib/client/Client.cpp | 2 +- src/lib/client/Client.h | 6 +++--- src/lib/platform/XWindowsClipboard.cpp | 2 +- src/lib/server/PrimaryClient.cpp | 2 +- src/lib/server/PrimaryClient.h | 6 +++--- src/lib/server/Server.cpp | 2 +- src/lib/server/Server.h | 7 ++++--- src/lib/synergy/App.cpp | 2 +- src/lib/synergy/App.h | 7 ++++--- src/lib/synergy/ClientApp.cpp | 19 ++++++++++--------- src/lib/synergy/ClientApp.h | 13 +++++++------ src/lib/synergy/IApp.h | 4 ++-- src/lib/synergy/Screen.cpp | 4 ++++ src/lib/synergy/Screen.h | 4 ++++ src/lib/synergy/ServerApp.cpp | 19 ++++++++++--------- src/lib/synergy/ServerApp.h | 18 +++++++++--------- src/test/mock/synergy/MockApp.h | 2 +- src/test/mock/synergy/MockScreen.h | 4 ++-- 18 files changed, 68 insertions(+), 55 deletions(-) diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp index 340801a1..a13052c0 100644 --- a/src/lib/client/Client.cpp +++ b/src/lib/client/Client.cpp @@ -54,7 +54,7 @@ Client::Client( const String& name, const NetworkAddress& address, ISocketFactory* socketFactory, IStreamFilterFactory* streamFilterFactory, - Screen* screen, + synergy::Screen* screen, const CryptoOptions& crypto, bool enableDragDrop) : m_mock(false), diff --git a/src/lib/client/Client.h b/src/lib/client/Client.h index 4c392de4..144d007d 100644 --- a/src/lib/client/Client.h +++ b/src/lib/client/Client.h @@ -28,7 +28,7 @@ #include "base/EventTypes.h" class EventQueueTimer; -class Screen; +namespace synergy { class Screen; } class ServerProxy; class IDataSocket; class ISocketFactory; @@ -61,7 +61,7 @@ public: const String& name, const NetworkAddress& address, ISocketFactory* socketFactory, IStreamFilterFactory* streamFilterFactory, - Screen* screen, + synergy::Screen* screen, const CryptoOptions& crypto, bool enableDragDrop); ~Client(); @@ -211,7 +211,7 @@ private: NetworkAddress m_serverAddress; ISocketFactory* m_socketFactory; IStreamFilterFactory* m_streamFilterFactory; - Screen* m_screen; + synergy::Screen* m_screen; synergy::IStream* m_stream; EventQueueTimer* m_timer; ServerProxy* m_server; diff --git a/src/lib/platform/XWindowsClipboard.cpp b/src/lib/platform/XWindowsClipboard.cpp index 9b41bfa1..20dedef0 100644 --- a/src/lib/platform/XWindowsClipboard.cpp +++ b/src/lib/platform/XWindowsClipboard.cpp @@ -937,7 +937,7 @@ CXWindowsClipboard::pushReplies() for (ReplyMap::iterator index = m_replies.begin(); index != m_replies.end(); ) { assert(!index->second.empty()); - CReplyList::iterator listit = index->second.begin(); + ReplyList::iterator listit = index->second.begin(); while (listit != index->second.end()) { if (!(*listit)->m_replied) break; diff --git a/src/lib/server/PrimaryClient.cpp b/src/lib/server/PrimaryClient.cpp index f1cb2415..9826ef57 100644 --- a/src/lib/server/PrimaryClient.cpp +++ b/src/lib/server/PrimaryClient.cpp @@ -26,7 +26,7 @@ // PrimaryClient // -PrimaryClient::PrimaryClient(const String& name, Screen* screen) : +PrimaryClient::PrimaryClient(const String& name, synergy::Screen* screen) : BaseClientProxy(name), m_screen(screen), m_fakeInputCount(0) diff --git a/src/lib/server/PrimaryClient.h b/src/lib/server/PrimaryClient.h index 04fb14d8..f22f4464 100644 --- a/src/lib/server/PrimaryClient.h +++ b/src/lib/server/PrimaryClient.h @@ -21,7 +21,7 @@ #include "server/BaseClientProxy.h" #include "synergy/protocol_types.h" -class Screen; +namespace synergy { class Screen; } //! Primary screen as pseudo-client /*! @@ -34,7 +34,7 @@ public: /*! \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(); #ifdef TEST_ENV @@ -147,7 +147,7 @@ public: virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize); private: - Screen* m_screen; + synergy::Screen* m_screen; bool m_clipboardDirty[kClipboardEnd]; SInt32 m_fakeInputCount; }; diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index b53f7f68..194b25d1 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -53,7 +53,7 @@ Server::Server( Config& config, PrimaryClient* primaryClient, - Screen* screen, + synergy::Screen* screen, IEventQueue* events, bool enableDragDrop) : m_mock(false), diff --git a/src/lib/server/Server.h b/src/lib/server/Server.h index f04e0007..d1efccb6 100644 --- a/src/lib/server/Server.h +++ b/src/lib/server/Server.h @@ -36,7 +36,7 @@ class BaseClientProxy; class EventQueueTimer; class PrimaryClient; class InputFilter; -class Screen; +namespace synergy { class Screen; } class IEventQueue; class Thread; @@ -104,7 +104,8 @@ public: client (local screen) \p primaryClient. The client retains 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(); #ifdef TEST_ENV @@ -457,7 +458,7 @@ private: bool m_lockedToScreen; // server screen - Screen* m_screen; + synergy::Screen* m_screen; IEventQueue* m_events; diff --git a/src/lib/synergy/App.cpp b/src/lib/synergy/App.cpp index 38ce25ea..b70ca9e9 100644 --- a/src/lib/synergy/App.cpp +++ b/src/lib/synergy/App.cpp @@ -288,7 +288,7 @@ MinimalApp::foregroundStartup(int argc, char** argv) return 0; } -Screen* +synergy::Screen* MinimalApp::createScreen() { return NULL; diff --git a/src/lib/synergy/App.h b/src/lib/synergy/App.h index a2fe7c05..d1133046 100644 --- a/src/lib/synergy/App.h +++ b/src/lib/synergy/App.h @@ -35,7 +35,7 @@ class IArchTaskBarReceiver; class BufferedLogOutputter; class ILogOutputter; class FileLogOutputter; -class Screen; +namespace synergy { class Screen; } class IEventQueue; class SocketMultiplexer; @@ -133,7 +133,8 @@ public: virtual void startNode(); virtual int mainLoop(); virtual int foregroundStartup(int argc, char** argv); - virtual Screen* createScreen(); + virtual synergy::Screen* + createScreen(); virtual void loadConfig(); virtual bool loadConfig(const String& pathname); virtual const char* daemonInfo() const; @@ -142,7 +143,7 @@ public: private: Arch m_arch; - Log m_log; + Log m_log; EventQueue m_events; }; diff --git a/src/lib/synergy/ClientApp.cpp b/src/lib/synergy/ClientApp.cpp index 2d8697a4..a1e189bf 100644 --- a/src/lib/synergy/ClientApp.cpp +++ b/src/lib/synergy/ClientApp.cpp @@ -169,18 +169,18 @@ ClientApp::daemonInfo() const #endif } -Screen* +synergy::Screen* ClientApp::createScreen() { #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); #elif WINAPI_XWINDOWS - return new Screen(new CXWindowsScreen( + return new synergy::Screen(new CXWindowsScreen( args().m_display, false, args().m_disableXInitThreads, args().m_yscroll, m_events), m_events); #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 } @@ -240,10 +240,10 @@ ClientApp::handleScreenError(const Event&, void*) } -Screen* +synergy::Screen* ClientApp::openClientScreen() { - Screen* screen = createScreen(); + synergy::Screen* screen = createScreen(); screen->setEnableDragDrop(argsBase().m_enableDragDrop); m_events->adoptHandler(m_events->forIScreen().error(), screen->getEventTarget(), @@ -254,7 +254,7 @@ ClientApp::openClientScreen() void -ClientApp::closeClientScreen(Screen* screen) +ClientApp::closeClientScreen(synergy::Screen* screen) { if (screen != NULL) { m_events->removeHandler(m_events->forIScreen().error(), @@ -333,7 +333,8 @@ ClientApp::handleClientDisconnected(const Event&, void*) 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( m_events, @@ -396,7 +397,7 @@ bool ClientApp::startClient() { double retryTime; - Screen* clientScreen = NULL; + synergy::Screen* clientScreen = NULL; try { if (m_clientScreen == NULL) { clientScreen = openClientScreen(); diff --git a/src/lib/synergy/ClientApp.h b/src/lib/synergy/ClientApp.h index 47b29e27..4a172f3b 100644 --- a/src/lib/synergy/ClientApp.h +++ b/src/lib/synergy/ClientApp.h @@ -20,7 +20,7 @@ #include "synergy/App.h" -class Screen; +namespace synergy { class Screen; } class Event; class Client; class NetworkAddress; @@ -52,20 +52,21 @@ public: int foregroundStartup(int argc, char** argv); int standardStartup(int argc, char** argv); int runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup); - Screen* createScreen(); + synergy::Screen* createScreen(); void updateStatus(); void updateStatus(const String& msg); void resetRestartTimeout(); double nextRestartTimeout(); void handleScreenError(const Event&, void*); - Screen* openClientScreen(); - void closeClientScreen(Screen* screen); + synergy::Screen* openClientScreen(); + void closeClientScreen(synergy::Screen* screen); void handleClientRestart(const Event&, void* vtimer); void scheduleClientRestart(double retryTime); void handleClientConnected(const Event&, void*); void handleClientFailed(const Event& e, 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); bool startClient(); void stopClient(); @@ -78,6 +79,6 @@ public: private: Client* m_client; - Screen* m_clientScreen; + synergy::Screen*m_clientScreen; NetworkAddress* m_serverAddress; }; diff --git a/src/lib/synergy/IApp.h b/src/lib/synergy/IApp.h index 5fdc303f..340b98e6 100644 --- a/src/lib/synergy/IApp.h +++ b/src/lib/synergy/IApp.h @@ -25,7 +25,7 @@ typedef int (*StartupFunc)(int, char**); class ILogOutputter; class ArgsBase; class IArchTaskBarReceiver; -class Screen; +namespace synergy { class Screen; } class IEventQueue; class IApp : public IInterface @@ -42,6 +42,6 @@ public: virtual void initApp(int argc, const char** argv) = 0; virtual const char* daemonName() const = 0; virtual int foregroundStartup(int argc, char** argv) = 0; - virtual Screen* createScreen() = 0; + virtual synergy::Screen* createScreen() = 0; virtual IEventQueue* getEvents() const = 0; }; diff --git a/src/lib/synergy/Screen.cpp b/src/lib/synergy/Screen.cpp index 3aeb073b..6eb978ed 100644 --- a/src/lib/synergy/Screen.cpp +++ b/src/lib/synergy/Screen.cpp @@ -24,6 +24,8 @@ #include "server/ClientProxy.h" #include "base/TMethodEventJob.h" +namespace synergy { + // // Screen // @@ -553,3 +555,5 @@ Screen::leaveSecondary() // release any keys we think are still down m_screen->fakeAllKeysUp(); } + +} diff --git a/src/lib/synergy/Screen.h b/src/lib/synergy/Screen.h index e64f4eab..98ac3056 100644 --- a/src/lib/synergy/Screen.h +++ b/src/lib/synergy/Screen.h @@ -30,6 +30,8 @@ class IClipboard; class IPlatformScreen; class IEventQueue; +namespace synergy { + //! Platform independent screen /*! This is a platform independent screen. It can work as either a @@ -339,3 +341,5 @@ private: bool m_mock; bool m_enableDragDrop; }; + +} diff --git a/src/lib/synergy/ServerApp.cpp b/src/lib/synergy/ServerApp.cpp index 3f7c6311..4124c98e 100644 --- a/src/lib/synergy/ServerApp.cpp +++ b/src/lib/synergy/ServerApp.cpp @@ -359,7 +359,7 @@ ServerApp::closePrimaryClient(PrimaryClient* primaryClient) } void -ServerApp::closeServerScreen(Screen* screen) +ServerApp::closeServerScreen(synergy::Screen* screen) { if (screen != NULL) { m_events->removeHandler(m_events->forIScreen().error(), @@ -447,7 +447,7 @@ bool ServerApp::initServer() } double retryTime; - Screen* serverScreen = NULL; + synergy::Screen* serverScreen = NULL; PrimaryClient* primaryClient = NULL; try { 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); m_events->adoptHandler(m_events->forIScreen().error(), screen->getEventTarget(), @@ -576,22 +577,22 @@ ServerApp::startServer() } } -Screen* +synergy::Screen* ServerApp::createScreen() { #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); #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); #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 } PrimaryClient* -ServerApp::openPrimaryClient(const String& name, Screen* screen) +ServerApp::openPrimaryClient(const String& name, synergy::Screen* screen) { LOG((CLOG_DEBUG1 "creating primary screen")); return new PrimaryClient(name, screen); diff --git a/src/lib/synergy/ServerApp.h b/src/lib/synergy/ServerApp.h index 38df1310..61c06a8e 100644 --- a/src/lib/synergy/ServerApp.h +++ b/src/lib/synergy/ServerApp.h @@ -40,7 +40,7 @@ enum EServerState { }; class Server; -class Screen; +namespace synergy { class Screen; } class ClientListener; class EventQueueTimer; class ILogOutputter; @@ -81,13 +81,13 @@ public: void closeClientListener(ClientListener* listen); void stopServer(); void closePrimaryClient(PrimaryClient* primaryClient); - void closeServerScreen(Screen* screen); + void closeServerScreen(synergy::Screen* screen); void cleanupServer(); bool initServer(); void retryHandler(const Event&, void*); - Screen* openServerScreen(); - Screen* createScreen(); - PrimaryClient* openPrimaryClient(const String& name, Screen* screen); + synergy::Screen* openServerScreen(); + synergy::Screen* createScreen(); + PrimaryClient* openPrimaryClient(const String& name, synergy::Screen* screen); void handleScreenError(const Event&, void*); void handleSuspend(const Event&, void*); void handleResume(const Event&, void*); @@ -105,13 +105,13 @@ public: Server* getServerPtr() { return m_server; } - Server* m_server; + Server* m_server; EServerState m_serverState; - Screen* m_serverScreen; + synergy::Screen* m_serverScreen; PrimaryClient* m_primaryClient; - ClientListener* m_listener; + ClientListener* m_listener; EventQueueTimer* m_timer; - NetworkAddress* m_synergyAddress; + NetworkAddress* m_synergyAddress; private: void handleScreenSwitched(const Event&, void* data); diff --git a/src/test/mock/synergy/MockApp.h b/src/test/mock/synergy/MockApp.h index d3e1402a..d8d2a72a 100644 --- a/src/test/mock/synergy/MockApp.h +++ b/src/test/mock/synergy/MockApp.h @@ -40,5 +40,5 @@ public: MOCK_METHOD0(startNode, void()); MOCK_METHOD0(mainLoop, int()); MOCK_METHOD2(foregroundStartup, int(int, char**)); - MOCK_METHOD0(createScreen, Screen*()); + MOCK_METHOD0(createScreen, synergy::Screen*()); }; diff --git a/src/test/mock/synergy/MockScreen.h b/src/test/mock/synergy/MockScreen.h index 597e73a2..970793a0 100644 --- a/src/test/mock/synergy/MockScreen.h +++ b/src/test/mock/synergy/MockScreen.h @@ -23,10 +23,10 @@ #include "test/global/gmock.h" -class MockScreen : public Screen +class MockScreen : public synergy::Screen { public: - MockScreen() : Screen() { } + MockScreen() : synergy::Screen() { } MOCK_METHOD0(disable, void()); MOCK_CONST_METHOD4(getShape, void(SInt32&, SInt32&, SInt32&, SInt32&)); MOCK_CONST_METHOD2(getCursorPos, void(SInt32&, SInt32&));