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,
ISocketFactory* socketFactory,
IStreamFilterFactory* streamFilterFactory,
Screen* screen,
synergy::Screen* screen,
const CryptoOptions& crypto,
bool enableDragDrop) :
m_mock(false),

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;
};

View File

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

View File

@ -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;

View File

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

View File

@ -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;
};

View File

@ -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();

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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();
}
}

View File

@ -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;
};
}

View File

@ -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);

View File

@ -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);

View File

@ -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*());
};

View File

@ -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&));