mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-11 00:58:14 +08:00
Merged primary and secondary screens into one class.
This commit is contained in:
@@ -14,12 +14,13 @@
|
||||
|
||||
#include "CClient.h"
|
||||
#include "CServerProxy.h"
|
||||
#include "ISecondaryScreenFactory.h"
|
||||
#include "CScreen.h"
|
||||
#include "IScreenFactory.h"
|
||||
#include "CClipboard.h"
|
||||
#include "CInputPacketStream.h"
|
||||
#include "COutputPacketStream.h"
|
||||
#include "CProtocolUtil.h"
|
||||
#include "CSecondaryScreen.h"
|
||||
#include "IPlatformScreen.h"
|
||||
#include "IServer.h"
|
||||
#include "ProtocolTypes.h"
|
||||
#include "XScreen.h"
|
||||
@@ -72,7 +73,7 @@ CClient::setAddress(const CNetworkAddress& serverAddress)
|
||||
}
|
||||
|
||||
void
|
||||
CClient::setScreenFactory(ISecondaryScreenFactory* adopted)
|
||||
CClient::setScreenFactory(IScreenFactory* adopted)
|
||||
{
|
||||
CLock lock(&m_mutex);
|
||||
delete m_screenFactory;
|
||||
@@ -305,8 +306,9 @@ CClient::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool)
|
||||
CLock lock(&m_mutex);
|
||||
m_active = true;
|
||||
}
|
||||
|
||||
m_screen->enter(xAbs, yAbs, mask);
|
||||
m_screen->mouseMove(xAbs, yAbs);
|
||||
m_screen->enter();
|
||||
m_screen->setToggleState(mask);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -464,7 +466,10 @@ CClient::openSecondaryScreen()
|
||||
// create screen
|
||||
LOG((CLOG_DEBUG1 "creating secondary screen"));
|
||||
if (m_screenFactory != NULL) {
|
||||
m_screen = m_screenFactory->create(this);
|
||||
IPlatformScreen* platformScreen = m_screenFactory->create(this, NULL);
|
||||
if (platformScreen != NULL) {
|
||||
m_screen = new CScreen(platformScreen, this);
|
||||
}
|
||||
}
|
||||
if (m_screen == NULL) {
|
||||
throw XScreenOpenFailure();
|
||||
@@ -634,9 +639,11 @@ CClient::runServer()
|
||||
m_server = proxy;
|
||||
}
|
||||
|
||||
bool enabled = false;
|
||||
try {
|
||||
// prepare for remote control
|
||||
m_screen->remoteControl();
|
||||
// enable the screen
|
||||
m_screen->enable();
|
||||
enabled = true;
|
||||
|
||||
// process messages
|
||||
bool rejected = true;
|
||||
@@ -647,8 +654,8 @@ CClient::runServer()
|
||||
setStatus(kNotRunning);
|
||||
}
|
||||
|
||||
// prepare for local control
|
||||
m_screen->localControl();
|
||||
// disable the screen
|
||||
m_screen->disable();
|
||||
|
||||
// clean up
|
||||
CLock lock(&m_mutex);
|
||||
@@ -661,7 +668,9 @@ CClient::runServer()
|
||||
}
|
||||
catch (...) {
|
||||
setStatus(kNotRunning);
|
||||
m_screen->localControl();
|
||||
if (enabled) {
|
||||
m_screen->disable();
|
||||
}
|
||||
CLock lock(&m_mutex);
|
||||
m_rejected = false;
|
||||
m_server = NULL;
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#include "CMutex.h"
|
||||
#include "CJobList.h"
|
||||
|
||||
class CSecondaryScreen;
|
||||
class CScreen;
|
||||
class CServerProxy;
|
||||
class CThread;
|
||||
class IDataSocket;
|
||||
class IScreenReceiver;
|
||||
class ISecondaryScreenFactory;
|
||||
class IScreenFactory;
|
||||
class ISocketFactory;
|
||||
class IStreamFilterFactory;
|
||||
|
||||
@@ -60,13 +60,12 @@ public:
|
||||
*/
|
||||
void setAddress(const CNetworkAddress& serverAddress);
|
||||
|
||||
//! Set secondary screen factory
|
||||
//! Set screen factory
|
||||
/*!
|
||||
Sets the factory for creating secondary screens. This must be
|
||||
set before calling open(). This object takes ownership of the
|
||||
factory.
|
||||
Sets the factory for creating screens. This must be set before
|
||||
calling open(). This object takes ownership of the factory.
|
||||
*/
|
||||
void setScreenFactory(ISecondaryScreenFactory*);
|
||||
void setScreenFactory(IScreenFactory*);
|
||||
|
||||
//! Set socket factory
|
||||
/*!
|
||||
@@ -184,12 +183,12 @@ private:
|
||||
private:
|
||||
CMutex m_mutex;
|
||||
CString m_name;
|
||||
CSecondaryScreen* m_screen;
|
||||
CScreen* m_screen;
|
||||
IScreenReceiver* m_server;
|
||||
CNetworkAddress m_serverAddress;
|
||||
ISecondaryScreenFactory* m_screenFactory;
|
||||
ISocketFactory* m_socketFactory;
|
||||
IStreamFilterFactory* m_streamFilterFactory;
|
||||
IScreenFactory* m_screenFactory;
|
||||
ISocketFactory* m_socketFactory;
|
||||
IStreamFilterFactory* m_streamFilterFactory;
|
||||
CThread* m_session;
|
||||
bool m_active;
|
||||
bool m_rejected;
|
||||
|
||||
Reference in New Issue
Block a user