chore: initialize class vars using the order class define, initilizer list, constructor
This commit is contained in:
parent
593e53370a
commit
475b895755
83 changed files with 249 additions and 465 deletions
|
|
@ -52,42 +52,28 @@ static void setSignalSet(sigset_t *sigset)
|
||||||
class ArchThreadImpl
|
class ArchThreadImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ArchThreadImpl();
|
ArchThreadImpl() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int m_refCount;
|
int m_refCount = 1;
|
||||||
IArchMultithread::ThreadID m_id;
|
IArchMultithread::ThreadID m_id = 0;
|
||||||
pthread_t m_thread;
|
pthread_t m_thread;
|
||||||
IArchMultithread::ThreadFunc m_func;
|
IArchMultithread::ThreadFunc m_func = nullptr;
|
||||||
void *m_userData;
|
void *m_userData = nullptr;
|
||||||
bool m_cancel;
|
bool m_cancel = false;
|
||||||
bool m_cancelling;
|
bool m_cancelling = false;
|
||||||
bool m_exited;
|
bool m_exited = false;
|
||||||
void *m_result;
|
void *m_result = nullptr;
|
||||||
void *m_networkData;
|
void *m_networkData = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
ArchThreadImpl::ArchThreadImpl()
|
|
||||||
: m_refCount(1),
|
|
||||||
m_id(0),
|
|
||||||
m_func(nullptr),
|
|
||||||
m_userData(nullptr),
|
|
||||||
m_cancel(false),
|
|
||||||
m_cancelling(false),
|
|
||||||
m_exited(false),
|
|
||||||
m_result(nullptr),
|
|
||||||
m_networkData(nullptr)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ArchMultithreadPosix
|
// ArchMultithreadPosix
|
||||||
//
|
//
|
||||||
|
|
||||||
ArchMultithreadPosix *ArchMultithreadPosix::s_instance = nullptr;
|
ArchMultithreadPosix *ArchMultithreadPosix::s_instance = nullptr;
|
||||||
|
|
||||||
ArchMultithreadPosix::ArchMultithreadPosix() : m_newThreadCalled(false), m_nextID(0)
|
ArchMultithreadPosix::ArchMultithreadPosix()
|
||||||
{
|
{
|
||||||
assert(s_instance == nullptr);
|
assert(s_instance == nullptr);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,12 +99,12 @@ private:
|
||||||
|
|
||||||
static ArchMultithreadPosix *s_instance;
|
static ArchMultithreadPosix *s_instance;
|
||||||
|
|
||||||
bool m_newThreadCalled;
|
bool m_newThreadCalled = false;
|
||||||
|
|
||||||
ArchMutex m_threadMutex;
|
ArchMutex m_threadMutex;
|
||||||
ArchThread m_mainThread;
|
ArchThread m_mainThread;
|
||||||
ThreadList m_threadList;
|
ThreadList m_threadList;
|
||||||
ThreadID m_nextID;
|
ThreadID m_nextID = 0;
|
||||||
|
|
||||||
pthread_t m_signalThread;
|
pthread_t m_signalThread;
|
||||||
SignalFunc m_signalFunc[kNUM_SIGNALS];
|
SignalFunc m_signalFunc[kNUM_SIGNALS];
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,11 @@
|
||||||
//
|
//
|
||||||
// Event
|
// Event
|
||||||
//
|
//
|
||||||
|
|
||||||
Event::Event() : m_type(EventTypes::Unknown), m_target(nullptr), m_data(nullptr), m_flags(0), m_dataObject(nullptr)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
Event::Event(EventTypes type, void *target, void *data, Flags flags)
|
Event::Event(EventTypes type, void *target, void *data, Flags flags)
|
||||||
: m_type(type),
|
: m_type(type),
|
||||||
m_target(target),
|
m_target(target),
|
||||||
m_data(data),
|
m_data(data),
|
||||||
m_flags(flags),
|
m_flags(flags)
|
||||||
m_dataObject(nullptr)
|
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
@ -29,8 +22,6 @@ Event::Event(EventTypes type, void *target, void *data, Flags flags)
|
||||||
Event::Event(EventTypes type, void *target, EventData *dataObject)
|
Event::Event(EventTypes type, void *target, EventData *dataObject)
|
||||||
: m_type(type),
|
: m_type(type),
|
||||||
m_target(target),
|
m_target(target),
|
||||||
m_data(nullptr),
|
|
||||||
m_flags(kNone),
|
|
||||||
m_dataObject(dataObject)
|
m_dataObject(dataObject)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public:
|
||||||
kDontFreeData = 0x02 //!< Don't free data in deleteData
|
kDontFreeData = 0x02 //!< Don't free data in deleteData
|
||||||
};
|
};
|
||||||
|
|
||||||
Event();
|
Event() = default;
|
||||||
|
|
||||||
//! Create \c Event with data (POD)
|
//! Create \c Event with data (POD)
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -110,9 +110,9 @@ public:
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EventTypes m_type;
|
EventTypes m_type = EventTypes::Unknown;
|
||||||
void *m_target;
|
void *m_target = nullptr;
|
||||||
void *m_data;
|
void *m_data = nullptr;
|
||||||
Flags m_flags;
|
Flags m_flags = kNone;
|
||||||
EventData *m_dataObject;
|
EventData *m_dataObject = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,7 @@ static void interrupt(Arch::ESignal, void *data)
|
||||||
// EventQueue
|
// EventQueue
|
||||||
//
|
//
|
||||||
|
|
||||||
EventQueue::EventQueue()
|
EventQueue::EventQueue() : m_readyMutex(new Mutex), m_readyCondVar(new CondVar<bool>(m_readyMutex, false))
|
||||||
: m_systemTarget(0),
|
|
||||||
m_readyMutex(new Mutex),
|
|
||||||
m_readyCondVar(new CondVar<bool>(m_readyMutex, false))
|
|
||||||
{
|
{
|
||||||
m_mutex = ARCH->newMutex();
|
m_mutex = ARCH->newMutex();
|
||||||
ARCH->setSignalHandler(Arch::kINTERRUPT, &interrupt, this);
|
ARCH->setSignalHandler(Arch::kINTERRUPT, &interrupt, this);
|
||||||
|
|
|
||||||
|
|
@ -102,11 +102,11 @@ private:
|
||||||
using TypeHandlerTable = std::map<EventTypes, IEventJob *>;
|
using TypeHandlerTable = std::map<EventTypes, IEventJob *>;
|
||||||
using HandlerTable = std::map<void *, TypeHandlerTable>;
|
using HandlerTable = std::map<void *, TypeHandlerTable>;
|
||||||
|
|
||||||
int m_systemTarget;
|
int m_systemTarget = 0;
|
||||||
ArchMutex m_mutex;
|
ArchMutex m_mutex;
|
||||||
|
|
||||||
// buffer of events
|
// buffer of events
|
||||||
IEventQueueBuffer *m_buffer;
|
IEventQueueBuffer *m_buffer = nullptr;
|
||||||
|
|
||||||
// saved events
|
// saved events
|
||||||
EventTable m_events;
|
EventTable m_events;
|
||||||
|
|
@ -122,7 +122,7 @@ private:
|
||||||
HandlerTable m_handlers;
|
HandlerTable m_handlers;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex *m_readyMutex;
|
Mutex *m_readyMutex = nullptr;
|
||||||
CondVar<bool> *m_readyCondVar;
|
CondVar<bool> *m_readyCondVar = nullptr;
|
||||||
std::queue<Event> m_pending;
|
std::queue<Event> m_pending;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ bool SystemLogOutputter::write(ELevel level, const char *msg)
|
||||||
// SystemLogger
|
// SystemLogger
|
||||||
//
|
//
|
||||||
|
|
||||||
SystemLogger::SystemLogger(const char *title, bool blockConsole) : m_stop(nullptr)
|
SystemLogger::SystemLogger(const char *title, bool blockConsole)
|
||||||
{
|
{
|
||||||
// redirect log messages
|
// redirect log messages
|
||||||
if (blockConsole) {
|
if (blockConsole) {
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,6 @@ public:
|
||||||
SystemLogger &operator=(SystemLogger &&) = delete;
|
SystemLogger &operator=(SystemLogger &&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ILogOutputter *m_syslog;
|
ILogOutputter *m_syslog = nullptr;
|
||||||
ILogOutputter *m_stop;
|
ILogOutputter *m_stop = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ SimpleEventQueueBuffer::SimpleEventQueueBuffer()
|
||||||
{
|
{
|
||||||
m_queueMutex = ARCH->newMutex();
|
m_queueMutex = ARCH->newMutex();
|
||||||
m_queueReadyCond = ARCH->newCondVar();
|
m_queueReadyCond = ARCH->newCondVar();
|
||||||
m_queueReady = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleEventQueueBuffer::~SimpleEventQueueBuffer()
|
SimpleEventQueueBuffer::~SimpleEventQueueBuffer()
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,6 @@ private:
|
||||||
|
|
||||||
ArchMutex m_queueMutex;
|
ArchMutex m_queueMutex;
|
||||||
ArchCond m_queueReadyCond;
|
ArchCond m_queueReadyCond;
|
||||||
bool m_queueReady;
|
bool m_queueReady = false;
|
||||||
EventDeque m_queue;
|
EventDeque m_queue;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
// Stopwatch
|
// Stopwatch
|
||||||
//
|
//
|
||||||
|
|
||||||
Stopwatch::Stopwatch(bool triggered) : m_mark(0.0), m_triggered(triggered), m_stopped(triggered)
|
Stopwatch::Stopwatch(bool triggered) : m_triggered(triggered), m_stopped(triggered)
|
||||||
{
|
{
|
||||||
if (!triggered) {
|
if (!triggered) {
|
||||||
m_mark = ARCH->time();
|
m_mark = ARCH->time();
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ private:
|
||||||
double getClock() const;
|
double getClock() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_mark;
|
double m_mark = 0.0;
|
||||||
bool m_triggered;
|
bool m_triggered = false;
|
||||||
bool m_stopped;
|
bool m_stopped = false;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -48,23 +48,13 @@ Client::Client(
|
||||||
IEventQueue *events, const std::string &name, const NetworkAddress &address, ISocketFactory *socketFactory,
|
IEventQueue *events, const std::string &name, const NetworkAddress &address, ISocketFactory *socketFactory,
|
||||||
deskflow::Screen *screen, deskflow::ClientArgs const &args
|
deskflow::Screen *screen, deskflow::ClientArgs const &args
|
||||||
)
|
)
|
||||||
: m_mock(false),
|
: m_name(name),
|
||||||
m_name(name),
|
|
||||||
m_serverAddress(address),
|
m_serverAddress(address),
|
||||||
m_socketFactory(socketFactory),
|
m_socketFactory(socketFactory),
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
m_stream(nullptr),
|
|
||||||
m_timer(nullptr),
|
|
||||||
m_server(nullptr),
|
|
||||||
m_ready(false),
|
|
||||||
m_active(false),
|
|
||||||
m_suspended(false),
|
|
||||||
m_connectOnResume(false),
|
|
||||||
m_events(events),
|
m_events(events),
|
||||||
m_useSecureNetwork(args.m_enableCrypto),
|
m_useSecureNetwork(args.m_enableCrypto),
|
||||||
m_args(args),
|
m_args(args)
|
||||||
m_enableClipboard(true),
|
|
||||||
m_maximumClipboardSize(INT_MAX)
|
|
||||||
{
|
{
|
||||||
assert(m_socketFactory != nullptr);
|
assert(m_socketFactory != nullptr);
|
||||||
assert(m_screen != nullptr);
|
assert(m_screen != nullptr);
|
||||||
|
|
@ -93,10 +83,6 @@ Client::Client(
|
||||||
|
|
||||||
Client::~Client()
|
Client::~Client()
|
||||||
{
|
{
|
||||||
if (m_mock) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_events->removeHandler(EventTypes::ScreenSuspend, getEventTarget());
|
m_events->removeHandler(EventTypes::ScreenSuspend, getEventTarget());
|
||||||
m_events->removeHandler(EventTypes::ScreenResume, getEventTarget());
|
m_events->removeHandler(EventTypes::ScreenResume, getEventTarget());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ public:
|
||||||
class FailInfo
|
class FailInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FailInfo(const char *what) : m_retry(false), m_what(what)
|
explicit FailInfo(const char *what) : m_what(what)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
bool m_retry;
|
bool m_retry = false;
|
||||||
std::string m_what;
|
std::string m_what;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -182,29 +182,26 @@ private:
|
||||||
void sendClipboardThread(void *);
|
void sendClipboardThread(void *);
|
||||||
void bindNetworkInterface(IDataSocket *socket) const;
|
void bindNetworkInterface(IDataSocket *socket) const;
|
||||||
|
|
||||||
public:
|
|
||||||
bool m_mock;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
NetworkAddress m_serverAddress;
|
NetworkAddress m_serverAddress;
|
||||||
ISocketFactory *m_socketFactory;
|
ISocketFactory *m_socketFactory = nullptr;
|
||||||
deskflow::Screen *m_screen;
|
deskflow::Screen *m_screen = nullptr;
|
||||||
deskflow::IStream *m_stream;
|
deskflow::IStream *m_stream = nullptr;
|
||||||
EventQueueTimer *m_timer;
|
EventQueueTimer *m_timer = nullptr;
|
||||||
ServerProxy *m_server;
|
ServerProxy *m_server = nullptr;
|
||||||
bool m_ready;
|
bool m_ready = false;
|
||||||
bool m_active;
|
bool m_active = false;
|
||||||
bool m_suspended;
|
bool m_suspended = false;
|
||||||
bool m_connectOnResume;
|
bool m_connectOnResume = false;
|
||||||
bool m_ownClipboard[kClipboardEnd];
|
bool m_ownClipboard[kClipboardEnd];
|
||||||
bool m_sentClipboard[kClipboardEnd];
|
bool m_sentClipboard[kClipboardEnd];
|
||||||
IClipboard::Time m_timeClipboard[kClipboardEnd];
|
IClipboard::Time m_timeClipboard[kClipboardEnd];
|
||||||
std::string m_dataClipboard[kClipboardEnd];
|
std::string m_dataClipboard[kClipboardEnd];
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events = nullptr;
|
||||||
bool m_useSecureNetwork;
|
bool m_useSecureNetwork = false;
|
||||||
bool m_enableClipboard;
|
bool m_enableClipboard = true;
|
||||||
size_t m_maximumClipboardSize;
|
size_t m_maximumClipboardSize = INT_MAX;
|
||||||
deskflow::ClientArgs m_args;
|
deskflow::ClientArgs m_args;
|
||||||
size_t m_resolvedAddressesCount = 0;
|
size_t m_resolvedAddressesCount = 0;
|
||||||
std::unique_ptr<deskflow::client::HelloBack> m_pHelloBack;
|
std::unique_ptr<deskflow::client::HelloBack> m_pHelloBack;
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,6 @@
|
||||||
ServerProxy::ServerProxy(Client *client, deskflow::IStream *stream, IEventQueue *events)
|
ServerProxy::ServerProxy(Client *client, deskflow::IStream *stream, IEventQueue *events)
|
||||||
: m_client(client),
|
: m_client(client),
|
||||||
m_stream(stream),
|
m_stream(stream),
|
||||||
m_seqNum(0),
|
|
||||||
m_compressMouse(false),
|
|
||||||
m_compressMouseRelative(false),
|
|
||||||
m_xMouse(0),
|
|
||||||
m_yMouse(0),
|
|
||||||
m_dxMouse(0),
|
|
||||||
m_dyMouse(0),
|
|
||||||
m_ignoreMouse(false),
|
|
||||||
m_keepAliveAlarm(0.0),
|
|
||||||
m_keepAliveAlarmTimer(nullptr),
|
|
||||||
m_parser(&ServerProxy::parseHandshakeMessage),
|
m_parser(&ServerProxy::parseHandshakeMessage),
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -105,27 +105,27 @@ private:
|
||||||
private:
|
private:
|
||||||
using MessageParser = EResult (ServerProxy::*)(const uint8_t *);
|
using MessageParser = EResult (ServerProxy::*)(const uint8_t *);
|
||||||
|
|
||||||
Client *m_client;
|
Client *m_client = nullptr;
|
||||||
deskflow::IStream *m_stream;
|
deskflow::IStream *m_stream = nullptr;
|
||||||
|
|
||||||
uint32_t m_seqNum;
|
uint32_t m_seqNum = 0;
|
||||||
|
|
||||||
bool m_compressMouse;
|
bool m_compressMouse = false;
|
||||||
bool m_compressMouseRelative;
|
bool m_compressMouseRelative = false;
|
||||||
int32_t m_xMouse;
|
int32_t m_xMouse = 0;
|
||||||
int32_t m_yMouse;
|
int32_t m_yMouse = 0;
|
||||||
int32_t m_dxMouse;
|
int32_t m_dxMouse = 0;
|
||||||
int32_t m_dyMouse;
|
int32_t m_dyMouse = 0;
|
||||||
|
|
||||||
bool m_ignoreMouse;
|
bool m_ignoreMouse = false;
|
||||||
|
|
||||||
KeyModifierID m_modifierTranslationTable[kKeyModifierIDLast];
|
KeyModifierID m_modifierTranslationTable[kKeyModifierIDLast];
|
||||||
|
|
||||||
double m_keepAliveAlarm;
|
double m_keepAliveAlarm = 0.0;
|
||||||
EventQueueTimer *m_keepAliveAlarmTimer;
|
EventQueueTimer *m_keepAliveAlarmTimer = nullptr;
|
||||||
|
|
||||||
MessageParser m_parser;
|
MessageParser m_parser;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events = nullptr;
|
||||||
std::string m_serverLanguage = "";
|
std::string m_serverLanguage = "";
|
||||||
bool m_isUserNotifiedAboutLanguageSyncError = false;
|
bool m_isUserNotifiedAboutLanguageSyncError = false;
|
||||||
deskflow::languages::LanguageManager m_languageManager;
|
deskflow::languages::LanguageManager m_languageManager;
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,9 @@ App *App::s_instance = nullptr;
|
||||||
|
|
||||||
App::App(IEventQueue *events, deskflow::ArgsBase *args)
|
App::App(IEventQueue *events, deskflow::ArgsBase *args)
|
||||||
: m_bye(&exit),
|
: m_bye(&exit),
|
||||||
m_suspended(false),
|
|
||||||
m_events(events),
|
m_events(events),
|
||||||
m_args(args),
|
m_args(args),
|
||||||
m_fileLog(nullptr),
|
m_appUtil(events)
|
||||||
m_appUtil(events),
|
|
||||||
m_socketMultiplexer(nullptr)
|
|
||||||
{
|
{
|
||||||
assert(s_instance == nullptr);
|
assert(s_instance == nullptr);
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
|
|
|
||||||
|
|
@ -112,15 +112,15 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void runEventsLoop(void *);
|
void runEventsLoop(void *);
|
||||||
|
|
||||||
bool m_suspended;
|
bool m_suspended = false;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
deskflow::ArgsBase *m_args;
|
deskflow::ArgsBase *m_args;
|
||||||
static App *s_instance;
|
static App *s_instance;
|
||||||
FileLogOutputter *m_fileLog;
|
FileLogOutputter *m_fileLog = nullptr;
|
||||||
ARCH_APP_UTIL m_appUtil;
|
ARCH_APP_UTIL m_appUtil;
|
||||||
SocketMultiplexer *m_socketMultiplexer;
|
SocketMultiplexer *m_socketMultiplexer = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if WINAPI_MSWINDOWS
|
#if WINAPI_MSWINDOWS
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
AppUtil *AppUtil::s_instance = nullptr;
|
AppUtil *AppUtil::s_instance = nullptr;
|
||||||
|
|
||||||
AppUtil::AppUtil() : m_app(nullptr)
|
AppUtil::AppUtil()
|
||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IApp *m_app;
|
IApp *m_app = nullptr;
|
||||||
static AppUtil *s_instance;
|
static AppUtil *s_instance;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,8 @@
|
||||||
#include "deskflow/Chunk.h"
|
#include "deskflow/Chunk.h"
|
||||||
#include "base/String.h"
|
#include "base/String.h"
|
||||||
|
|
||||||
Chunk::Chunk(size_t size) : m_dataSize(0)
|
Chunk::Chunk(size_t size) : m_chunk{new char[size]}
|
||||||
{
|
{
|
||||||
m_chunk = new char[size];
|
|
||||||
memset(m_chunk, 0, size);
|
memset(m_chunk, 0, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,6 @@ public:
|
||||||
Chunk &operator=(Chunk &&) = delete;
|
Chunk &operator=(Chunk &&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
size_t m_dataSize;
|
size_t m_dataSize = 0;
|
||||||
char *m_chunk;
|
char *m_chunk = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -60,11 +60,7 @@
|
||||||
|
|
||||||
#define RETRY_TIME 1.0
|
#define RETRY_TIME 1.0
|
||||||
|
|
||||||
ClientApp::ClientApp(IEventQueue *events)
|
ClientApp::ClientApp(IEventQueue *events) : App(events, new deskflow::ClientArgs())
|
||||||
: App(events, new deskflow::ClientArgs()),
|
|
||||||
m_client(nullptr),
|
|
||||||
m_clientScreen(nullptr),
|
|
||||||
m_serverAddress(nullptr)
|
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,8 @@ public:
|
||||||
private:
|
private:
|
||||||
ISocketFactory *getSocketFactory() const;
|
ISocketFactory *getSocketFactory() const;
|
||||||
|
|
||||||
Client *m_client;
|
Client *m_client = nullptr;
|
||||||
deskflow::Screen *m_clientScreen;
|
deskflow::Screen *m_clientScreen = nullptr;
|
||||||
NetworkAddress *m_serverAddress;
|
NetworkAddress *m_serverAddress = nullptr;
|
||||||
size_t m_lastServerAddressIndex = 0;
|
size_t m_lastServerAddressIndex = 0;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
// Clipboard
|
// Clipboard
|
||||||
//
|
//
|
||||||
|
|
||||||
Clipboard::Clipboard() : m_open(false), m_owner(false)
|
Clipboard::Clipboard()
|
||||||
{
|
{
|
||||||
open(0);
|
open(0);
|
||||||
empty();
|
empty();
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ public:
|
||||||
std::string get(EFormat) const override;
|
std::string get(EFormat) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable bool m_open;
|
mutable bool m_open = false;
|
||||||
mutable Time m_time;
|
mutable Time m_time;
|
||||||
bool m_owner;
|
bool m_owner = false;
|
||||||
Time m_timeOwned;
|
Time m_timeOwned;
|
||||||
bool m_added[kNumFormats];
|
bool m_added[kNumFormats] = {false, false, false};
|
||||||
std::string m_data[kNumFormats];
|
std::string m_data[kNumFormats] = {"", "", ""};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@
|
||||||
|
|
||||||
PacketStreamFilter::PacketStreamFilter(IEventQueue *events, deskflow::IStream *stream, bool adoptStream)
|
PacketStreamFilter::PacketStreamFilter(IEventQueue *events, deskflow::IStream *stream, bool adoptStream)
|
||||||
: StreamFilter(events, stream, adoptStream),
|
: StreamFilter(events, stream, adoptStream),
|
||||||
m_size(0),
|
|
||||||
m_inputShutdown(false),
|
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex m_mutex;
|
Mutex m_mutex;
|
||||||
uint32_t m_size;
|
uint32_t m_size = 0;
|
||||||
StreamBuffer m_buffer;
|
StreamBuffer m_buffer;
|
||||||
bool m_inputShutdown;
|
bool m_inputShutdown = false;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,8 @@ namespace deskflow {
|
||||||
Screen::Screen(IPlatformScreen *platformScreen, IEventQueue *events)
|
Screen::Screen(IPlatformScreen *platformScreen, IEventQueue *events)
|
||||||
: m_screen(platformScreen),
|
: m_screen(platformScreen),
|
||||||
m_isPrimary(platformScreen->isPrimary()),
|
m_isPrimary(platformScreen->isPrimary()),
|
||||||
m_enabled(false),
|
|
||||||
m_entered(m_isPrimary),
|
m_entered(m_isPrimary),
|
||||||
m_fakeInput(false),
|
m_events(events)
|
||||||
m_events(events),
|
|
||||||
m_mock(false)
|
|
||||||
{
|
{
|
||||||
assert(m_screen != nullptr);
|
assert(m_screen != nullptr);
|
||||||
|
|
||||||
|
|
@ -38,9 +35,6 @@ Screen::Screen(IPlatformScreen *platformScreen, IEventQueue *events)
|
||||||
|
|
||||||
Screen::~Screen()
|
Screen::~Screen()
|
||||||
{
|
{
|
||||||
if (m_mock) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_enabled) {
|
if (m_enabled) {
|
||||||
disable();
|
disable();
|
||||||
|
|
|
||||||
|
|
@ -292,27 +292,25 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// our platform dependent screen
|
// our platform dependent screen
|
||||||
IPlatformScreen *m_screen;
|
IPlatformScreen *m_screen = nullptr;
|
||||||
|
|
||||||
// true if screen is being used as a primary screen, false otherwise
|
// true if screen is being used as a primary screen, false otherwise
|
||||||
bool m_isPrimary;
|
bool m_isPrimary = false;
|
||||||
|
|
||||||
// true if screen is enabled
|
// true if screen is enabled
|
||||||
bool m_enabled;
|
bool m_enabled = false;
|
||||||
|
|
||||||
// true if the cursor is on this screen
|
// true if the cursor is on this screen
|
||||||
bool m_entered;
|
bool m_entered = false;
|
||||||
|
|
||||||
// note toggle keys that toggles on up/down (false) or on
|
// note toggle keys that toggles on up/down (false) or on
|
||||||
// transition (true)
|
// transition (true)
|
||||||
KeyModifierMask m_halfDuplex;
|
KeyModifierMask m_halfDuplex;
|
||||||
|
|
||||||
// true if we're faking input on a primary screen
|
// true if we're faking input on a primary screen
|
||||||
bool m_fakeInput;
|
bool m_fakeInput = false;
|
||||||
|
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events = nullptr;
|
||||||
|
|
||||||
bool m_mock;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace deskflow
|
} // namespace deskflow
|
||||||
|
|
|
||||||
|
|
@ -68,16 +68,9 @@ using namespace deskflow::server;
|
||||||
// ServerApp
|
// ServerApp
|
||||||
//
|
//
|
||||||
|
|
||||||
ServerApp::ServerApp(IEventQueue *events)
|
ServerApp::ServerApp(IEventQueue *events) : App(events, new deskflow::ServerArgs())
|
||||||
: App(events, new deskflow::ServerArgs()),
|
|
||||||
m_server(nullptr),
|
|
||||||
m_serverState(kUninitialized),
|
|
||||||
m_serverScreen(nullptr),
|
|
||||||
m_primaryClient(nullptr),
|
|
||||||
m_listener(nullptr),
|
|
||||||
m_timer(nullptr),
|
|
||||||
m_deskflowAddress(nullptr)
|
|
||||||
{
|
{
|
||||||
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerApp::parseArgs(int argc, const char *const *argv)
|
void ServerApp::parseArgs(int argc, const char *const *argv)
|
||||||
|
|
|
||||||
|
|
@ -128,11 +128,11 @@ private:
|
||||||
ISocketFactory *getSocketFactory() const;
|
ISocketFactory *getSocketFactory() const;
|
||||||
NetworkAddress getAddress(const NetworkAddress &address) const;
|
NetworkAddress getAddress(const NetworkAddress &address) const;
|
||||||
|
|
||||||
Server *m_server;
|
Server *m_server = nullptr;
|
||||||
EServerState m_serverState;
|
EServerState m_serverState = EServerState::kUninitialized;
|
||||||
deskflow::Screen *m_serverScreen;
|
deskflow::Screen *m_serverScreen = nullptr;
|
||||||
PrimaryClient *m_primaryClient;
|
PrimaryClient *m_primaryClient = nullptr;
|
||||||
ClientListener *m_listener;
|
ClientListener *m_listener = nullptr;
|
||||||
EventQueueTimer *m_timer;
|
EventQueueTimer *m_timer = nullptr;
|
||||||
NetworkAddress *m_deskflowAddress;
|
NetworkAddress *m_deskflowAddress = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "DataDownloader.h"
|
#include "DataDownloader.h"
|
||||||
|
|
||||||
DataDownloader::DataDownloader(QObject *parent) : QObject(parent), m_pReply(nullptr), m_IsFinished(false)
|
DataDownloader::DataDownloader(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
connect(&m_NetworkManager, &QNetworkAccessManager::finished, this, &DataDownloader::complete);
|
connect(&m_NetworkManager, &QNetworkAccessManager::finished, this, &DataDownloader::complete);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,6 @@ private slots:
|
||||||
private:
|
private:
|
||||||
QNetworkAccessManager m_NetworkManager;
|
QNetworkAccessManager m_NetworkManager;
|
||||||
QByteArray m_Data;
|
QByteArray m_Data;
|
||||||
QNetworkReply *m_pReply;
|
QNetworkReply *m_pReply = nullptr;
|
||||||
bool m_IsFinished;
|
bool m_IsFinished = false;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,6 @@
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
Hotkey::Hotkey() : m_keySequence{}, m_actions{}
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Hotkey::text() const
|
QString Hotkey::text() const
|
||||||
{
|
{
|
||||||
return m_keySequence.isMouseButton() ? kMousebutton.arg(m_keySequence.toString())
|
return m_keySequence.isMouseButton() ? kMousebutton.arg(m_keySequence.toString())
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class Hotkey
|
||||||
friend QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey);
|
friend QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Hotkey();
|
Hotkey() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString text() const;
|
QString text() const;
|
||||||
|
|
@ -59,8 +59,8 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KeySequence m_keySequence;
|
KeySequence m_keySequence = {};
|
||||||
ActionList m_actions;
|
ActionList m_actions = {};
|
||||||
inline static const QString kSectionActions = QStringLiteral("actions");
|
inline static const QString kSectionActions = QStringLiteral("actions");
|
||||||
inline static const QString kMousebutton = QStringLiteral("mousebutton(%1)");
|
inline static const QString kMousebutton = QStringLiteral("mousebutton(%1)");
|
||||||
inline static const QString kKeystroke = QStringLiteral("keystroke(%1)");
|
inline static const QString kKeystroke = QStringLiteral("keystroke(%1)");
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,6 @@ static const struct
|
||||||
{0, nullptr}
|
{0, nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
KeySequence::KeySequence() : m_Sequence(), m_Modifiers(0), m_IsValid(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KeySequence::isMouseButton() const
|
bool KeySequence::isMouseButton() const
|
||||||
{
|
{
|
||||||
return !m_Sequence.isEmpty() && m_Sequence.last() < Qt::Key_Space;
|
return !m_Sequence.isEmpty() && m_Sequence.last() < Qt::Key_Space;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class QSettings;
|
||||||
class KeySequence
|
class KeySequence
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KeySequence();
|
KeySequence() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
|
|
@ -54,9 +54,9 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<int> m_Sequence;
|
QList<int> m_Sequence = {};
|
||||||
int m_Modifiers;
|
int m_Modifiers = 0;
|
||||||
bool m_IsValid;
|
bool m_IsValid = false;
|
||||||
|
|
||||||
inline static const int kStrSize = 4;
|
inline static const int kStrSize = 4;
|
||||||
inline static const int kBase = 16;
|
inline static const int kBase = 16;
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,7 @@ ServerConfig::ServerConfig(MainWindow &mainWindow, int columns, int rows)
|
||||||
: m_pMainWindow(&mainWindow),
|
: m_pMainWindow(&mainWindow),
|
||||||
m_Screens(columns),
|
m_Screens(columns),
|
||||||
m_Columns(columns),
|
m_Columns(columns),
|
||||||
m_Rows(rows),
|
m_Rows(rows)
|
||||||
m_ClipboardSharingSize(defaultClipboardSharingSize())
|
|
||||||
{
|
{
|
||||||
recall();
|
recall();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ private:
|
||||||
ScreenList m_Screens;
|
ScreenList m_Screens;
|
||||||
int m_Columns;
|
int m_Columns;
|
||||||
int m_Rows;
|
int m_Rows;
|
||||||
size_t m_ClipboardSharingSize;
|
size_t m_ClipboardSharingSize = defaultClipboardSharingSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config);
|
QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config);
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,7 @@
|
||||||
|
|
||||||
AddClientDialog::AddClientDialog(const QString &clientName, QWidget *parent)
|
AddClientDialog::AddClientDialog(const QString &clientName, QWidget *parent)
|
||||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||||
ui{std::make_unique<Ui::AddClientDialog>()},
|
ui{std::make_unique<Ui::AddClientDialog>()}
|
||||||
m_AddResult(kAddClientIgnore)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,5 +51,5 @@ private:
|
||||||
QPushButton *m_pButtonRight;
|
QPushButton *m_pButtonRight;
|
||||||
QPushButton *m_pButtonDown;
|
QPushButton *m_pButtonDown;
|
||||||
QLabel *m_pLabelCenter;
|
QLabel *m_pLabelCenter;
|
||||||
int m_AddResult;
|
int m_AddResult = kAddClientIgnore;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config)
|
||||||
m_OriginalServerConfigIsExternal(config.useExternalConfig()),
|
m_OriginalServerConfigIsExternal(config.useExternalConfig()),
|
||||||
m_OriginalServerConfigUsesExternalFile(config.configFile()),
|
m_OriginalServerConfigUsesExternalFile(config.configFile()),
|
||||||
m_ServerConfig(config),
|
m_ServerConfig(config),
|
||||||
m_ScreenSetupModel(serverConfig().screens(), serverConfig().numColumns(), serverConfig().numRows()),
|
m_ScreenSetupModel(serverConfig().screens(), serverConfig().numColumns(), serverConfig().numRows())
|
||||||
m_Message("")
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ private:
|
||||||
bool m_OriginalServerConfigIsExternal;
|
bool m_OriginalServerConfigIsExternal;
|
||||||
QString m_OriginalServerConfigUsesExternalFile;
|
QString m_OriginalServerConfigUsesExternalFile;
|
||||||
ScreenSetupModel m_ScreenSetupModel;
|
ScreenSetupModel m_ScreenSetupModel;
|
||||||
QString m_Message;
|
QString m_Message = "";
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onChange();
|
void onChange();
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,7 @@
|
||||||
KeySequenceWidget::KeySequenceWidget(QWidget *parent, const KeySequence &seq)
|
KeySequenceWidget::KeySequenceWidget(QWidget *parent, const KeySequence &seq)
|
||||||
: QPushButton(parent),
|
: QPushButton(parent),
|
||||||
m_KeySequence(seq),
|
m_KeySequence(seq),
|
||||||
m_BackupSequence(seq),
|
m_BackupSequence(seq)
|
||||||
m_Status(Stopped),
|
|
||||||
m_MousePrefix("mousebutton("),
|
|
||||||
m_MousePostfix(")"),
|
|
||||||
m_KeyPrefix("keystroke("),
|
|
||||||
m_KeyPostfix(")")
|
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
updateOutput();
|
updateOutput();
|
||||||
|
|
|
||||||
|
|
@ -98,9 +98,9 @@ private:
|
||||||
private:
|
private:
|
||||||
KeySequence m_KeySequence;
|
KeySequence m_KeySequence;
|
||||||
KeySequence m_BackupSequence;
|
KeySequence m_BackupSequence;
|
||||||
Status m_Status;
|
Status m_Status = Status::Stopped;
|
||||||
QString m_MousePrefix;
|
QString m_MousePrefix = QStringLiteral("mousebutton(");
|
||||||
QString m_MousePostfix;
|
QString m_MousePostfix = QStringLiteral(")");
|
||||||
QString m_KeyPrefix;
|
QString m_KeyPrefix = QStringLiteral("keystroke(");
|
||||||
QString m_KeyPostfix;
|
QString m_KeyPostfix = QStringLiteral(")");
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,6 @@
|
||||||
|
|
||||||
const uint32_t StreamBuffer::kChunkSize = 4096;
|
const uint32_t StreamBuffer::kChunkSize = 4096;
|
||||||
|
|
||||||
StreamBuffer::StreamBuffer() : m_size(0), m_headUsed(0)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
const void *StreamBuffer::peek(uint32_t n)
|
const void *StreamBuffer::peek(uint32_t n)
|
||||||
{
|
{
|
||||||
assert(n <= m_size);
|
assert(n <= m_size);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ This class maintains a FIFO (first-in, last-out) buffer of bytes.
|
||||||
class StreamBuffer
|
class StreamBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StreamBuffer();
|
StreamBuffer() = default;
|
||||||
~StreamBuffer() = default;
|
~StreamBuffer() = default;
|
||||||
|
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
|
|
@ -65,6 +65,6 @@ private:
|
||||||
using ChunkList = std::list<Chunk>;
|
using ChunkList = std::list<Chunk>;
|
||||||
|
|
||||||
ChunkList m_chunks;
|
ChunkList m_chunks;
|
||||||
uint32_t m_size;
|
uint32_t m_size = 0;
|
||||||
uint32_t m_headUsed;
|
uint32_t m_headUsed = 0;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,14 @@ Thread::Thread(IJob *job)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread::Thread(const Thread &thread)
|
Thread::Thread(const Thread &thread) : m_thread{ARCH->copyThread(thread.m_thread)}
|
||||||
{
|
{
|
||||||
m_thread = ARCH->copyThread(thread.m_thread);
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread::Thread(ArchThread adoptedThread)
|
Thread::Thread(ArchThread adoptedThread) : m_thread{adoptedThread}
|
||||||
{
|
{
|
||||||
m_thread = adoptedThread;
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread::~Thread()
|
Thread::~Thread()
|
||||||
|
|
|
||||||
|
|
@ -195,5 +195,5 @@ private:
|
||||||
static void *threadFunc(void *);
|
static void *threadFunc(void *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ArchThread m_thread;
|
ArchThread m_thread = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,6 @@ SecureSocket::SecureSocket(
|
||||||
SecurityLevel securityLevel
|
SecurityLevel securityLevel
|
||||||
)
|
)
|
||||||
: TCPSocket(events, socketMultiplexer, family),
|
: TCPSocket(events, socketMultiplexer, family),
|
||||||
m_ssl(nullptr),
|
|
||||||
m_secureReady(false),
|
|
||||||
m_fatal(false),
|
|
||||||
m_securityLevel{securityLevel}
|
m_securityLevel{securityLevel}
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|
@ -72,9 +69,6 @@ SecureSocket::SecureSocket(
|
||||||
IEventQueue *events, SocketMultiplexer *socketMultiplexer, ArchSocket socket, SecurityLevel securityLevel
|
IEventQueue *events, SocketMultiplexer *socketMultiplexer, ArchSocket socket, SecurityLevel securityLevel
|
||||||
)
|
)
|
||||||
: TCPSocket(events, socketMultiplexer, socket),
|
: TCPSocket(events, socketMultiplexer, socket),
|
||||||
m_ssl(nullptr),
|
|
||||||
m_secureReady(false),
|
|
||||||
m_fatal(false),
|
|
||||||
m_securityLevel{securityLevel}
|
m_securityLevel{securityLevel}
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,8 @@ private:
|
||||||
// by it.
|
// by it.
|
||||||
std::mutex ssl_mutex_;
|
std::mutex ssl_mutex_;
|
||||||
|
|
||||||
Ssl *m_ssl;
|
Ssl *m_ssl = nullptr;
|
||||||
bool m_secureReady;
|
bool m_secureReady = false;
|
||||||
bool m_fatal;
|
bool m_fatal = false;
|
||||||
SecurityLevel m_securityLevel = SecurityLevel::Encrypted;
|
SecurityLevel m_securityLevel = SecurityLevel::Encrypted;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,9 @@
|
||||||
|
|
||||||
SocketMultiplexer::SocketMultiplexer()
|
SocketMultiplexer::SocketMultiplexer()
|
||||||
: m_mutex(new Mutex),
|
: m_mutex(new Mutex),
|
||||||
m_thread(nullptr),
|
|
||||||
m_update(false),
|
|
||||||
m_jobsReady(new CondVar<bool>(m_mutex, false)),
|
m_jobsReady(new CondVar<bool>(m_mutex, false)),
|
||||||
m_jobListLock(new CondVar<bool>(m_mutex, false)),
|
m_jobListLock(new CondVar<bool>(m_mutex, false)),
|
||||||
m_jobListLockLocked(new CondVar<bool>(m_mutex, false)),
|
m_jobListLockLocked(new CondVar<bool>(m_mutex, false))
|
||||||
m_jobListLocker(nullptr),
|
|
||||||
m_jobListLockLocker(nullptr)
|
|
||||||
{
|
{
|
||||||
// this pointer just has to be unique and not nullptr. it will
|
// this pointer just has to be unique and not nullptr. it will
|
||||||
// never be dereferenced. it's used to identify cursor nodes
|
// never be dereferenced. it's used to identify cursor nodes
|
||||||
|
|
|
||||||
|
|
@ -89,16 +89,16 @@ private:
|
||||||
void unlockJobList();
|
void unlockJobList();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex *m_mutex;
|
Mutex *m_mutex = nullptr;
|
||||||
Thread *m_thread;
|
Thread *m_thread = nullptr;
|
||||||
bool m_update;
|
bool m_update = false;
|
||||||
CondVar<bool> *m_jobsReady;
|
CondVar<bool> *m_jobsReady = nullptr;
|
||||||
CondVar<bool> *m_jobListLock;
|
CondVar<bool> *m_jobListLock = nullptr;
|
||||||
CondVar<bool> *m_jobListLockLocked;
|
CondVar<bool> *m_jobListLockLocked = nullptr;
|
||||||
Thread *m_jobListLocker;
|
Thread *m_jobListLocker = nullptr;
|
||||||
Thread *m_jobListLockLocker;
|
Thread *m_jobListLockLocker = nullptr;
|
||||||
|
|
||||||
SocketJobs m_socketJobs;
|
SocketJobs m_socketJobs = {};
|
||||||
SocketJobMap m_socketJobMap;
|
SocketJobMap m_socketJobMap = {};
|
||||||
ISocketMultiplexerJob *m_cursorMark;
|
ISocketMultiplexerJob *m_cursorMark = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ArchSocket m_socket;
|
ArchSocket m_socket;
|
||||||
Mutex *m_mutex;
|
Mutex *m_mutex = nullptr;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
SocketMultiplexer *m_socketMultiplexer;
|
SocketMultiplexer *m_socketMultiplexer;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ static const std::size_t MAX_INPUT_BUFFER_SIZE = 1024 * 1024;
|
||||||
TCPSocket::TCPSocket(IEventQueue *events, SocketMultiplexer *socketMultiplexer, IArchNetwork::EAddressFamily family)
|
TCPSocket::TCPSocket(IEventQueue *events, SocketMultiplexer *socketMultiplexer, IArchNetwork::EAddressFamily family)
|
||||||
: IDataSocket(events),
|
: IDataSocket(events),
|
||||||
m_events(events),
|
m_events(events),
|
||||||
m_mutex(),
|
|
||||||
m_flushed(&m_mutex, true),
|
m_flushed(&m_mutex, true),
|
||||||
m_socketMultiplexer(socketMultiplexer)
|
m_socketMultiplexer(socketMultiplexer)
|
||||||
{
|
{
|
||||||
|
|
@ -49,7 +48,6 @@ TCPSocket::TCPSocket(IEventQueue *events, SocketMultiplexer *socketMultiplexer,
|
||||||
TCPSocket::TCPSocket(IEventQueue *events, SocketMultiplexer *socketMultiplexer, ArchSocket socket)
|
TCPSocket::TCPSocket(IEventQueue *events, SocketMultiplexer *socketMultiplexer, ArchSocket socket)
|
||||||
: IDataSocket(events),
|
: IDataSocket(events),
|
||||||
m_events(events),
|
m_events(events),
|
||||||
m_mutex(),
|
|
||||||
m_socket(socket),
|
m_socket(socket),
|
||||||
m_flushed(&m_mutex, true),
|
m_flushed(&m_mutex, true),
|
||||||
m_socketMultiplexer(socketMultiplexer)
|
m_socketMultiplexer(socketMultiplexer)
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,7 @@
|
||||||
XWindowsClipboard::XWindowsClipboard(Display *display, Window window, ClipboardID id)
|
XWindowsClipboard::XWindowsClipboard(Display *display, Window window, ClipboardID id)
|
||||||
: m_display(display),
|
: m_display(display),
|
||||||
m_window(window),
|
m_window(window),
|
||||||
m_id(id),
|
m_id(id)
|
||||||
m_open(false),
|
|
||||||
m_time(0),
|
|
||||||
m_owner(false),
|
|
||||||
m_timeOwned(0),
|
|
||||||
m_timeLost(0)
|
|
||||||
{
|
{
|
||||||
// get some atoms
|
// get some atoms
|
||||||
m_atomTargets = XInternAtom(m_display, "TARGETS", False);
|
m_atomTargets = XInternAtom(m_display, "TARGETS", False);
|
||||||
|
|
@ -1373,12 +1368,8 @@ XWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time)
|
||||||
m_target(target),
|
m_target(target),
|
||||||
m_time(time),
|
m_time(time),
|
||||||
m_property(None),
|
m_property(None),
|
||||||
m_replied(false),
|
|
||||||
m_done(false),
|
|
||||||
m_data(),
|
|
||||||
m_type(None),
|
m_type(None),
|
||||||
m_format(32),
|
m_format(32)
|
||||||
m_ptr(0)
|
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -235,10 +235,10 @@ protected:
|
||||||
Atom m_property;
|
Atom m_property;
|
||||||
|
|
||||||
// true iff we've sent the notification for this reply
|
// true iff we've sent the notification for this reply
|
||||||
bool m_replied;
|
bool m_replied = false;
|
||||||
|
|
||||||
// true iff the reply has sent its last message
|
// true iff the reply has sent its last message
|
||||||
bool m_done;
|
bool m_done = false;
|
||||||
|
|
||||||
// the data to send and its type and format
|
// the data to send and its type and format
|
||||||
std::string m_data;
|
std::string m_data;
|
||||||
|
|
@ -246,7 +246,7 @@ protected:
|
||||||
int m_format;
|
int m_format;
|
||||||
|
|
||||||
// index of next byte in m_data to send
|
// index of next byte in m_data to send
|
||||||
uint32_t m_ptr;
|
uint32_t m_ptr = 0;
|
||||||
};
|
};
|
||||||
using ReplyList = std::list<Reply *>;
|
using ReplyList = std::list<Reply *>;
|
||||||
using ReplyMap = std::map<Window, ReplyList>;
|
using ReplyMap = std::map<Window, ReplyList>;
|
||||||
|
|
@ -287,11 +287,11 @@ private:
|
||||||
Window m_window;
|
Window m_window;
|
||||||
ClipboardID m_id;
|
ClipboardID m_id;
|
||||||
Atom m_selection;
|
Atom m_selection;
|
||||||
mutable bool m_open;
|
mutable bool m_open = false;
|
||||||
mutable Time m_time;
|
mutable Time m_time = 0;
|
||||||
bool m_owner;
|
bool m_owner = false;
|
||||||
mutable Time m_timeOwned;
|
mutable Time m_timeOwned = 0;
|
||||||
Time m_timeLost;
|
Time m_timeLost = 0;
|
||||||
|
|
||||||
// true iff open and clipboard owned by a motif app
|
// true iff open and clipboard owned by a motif app
|
||||||
mutable bool m_motif;
|
mutable bool m_motif;
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ class EventQueueTimer
|
||||||
XWindowsEventQueueBuffer::XWindowsEventQueueBuffer(Display *display, Window window, IEventQueue *events)
|
XWindowsEventQueueBuffer::XWindowsEventQueueBuffer(Display *display, Window window, IEventQueue *events)
|
||||||
: m_events(events),
|
: m_events(events),
|
||||||
m_display(display),
|
m_display(display),
|
||||||
m_window(window),
|
m_window(window)
|
||||||
m_waiting(false)
|
|
||||||
{
|
{
|
||||||
assert(m_display != nullptr);
|
assert(m_display != nullptr);
|
||||||
assert(m_window != None);
|
assert(m_window != None);
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ private:
|
||||||
Atom m_userEvent;
|
Atom m_userEvent;
|
||||||
XEvent m_event;
|
XEvent m_event;
|
||||||
EventList m_postedEvents;
|
EventList m_postedEvents;
|
||||||
bool m_waiting;
|
bool m_waiting = false;
|
||||||
int m_pipefd[2];
|
int m_pipefd[2];
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ private:
|
||||||
NonXKBModifierMap m_lastGoodNonXKBModifiers;
|
NonXKBModifierMap m_lastGoodNonXKBModifiers;
|
||||||
|
|
||||||
// X modifier (bit number) to deskflow modifier (mask) mapping
|
// X modifier (bit number) to deskflow modifier (mask) mapping
|
||||||
KeyModifierMaskList m_modifierFromX;
|
KeyModifierMaskList m_modifierFromX = {};
|
||||||
|
|
||||||
// deskflow modifier (mask) to X modifier (mask)
|
// deskflow modifier (mask) to X modifier (mask)
|
||||||
KeyModifierToXMask m_modifierToX;
|
KeyModifierToXMask m_modifierToX;
|
||||||
|
|
|
||||||
|
|
@ -92,32 +92,7 @@ XWindowsScreen::XWindowsScreen(
|
||||||
: PlatformScreen(events, scrollDirection),
|
: PlatformScreen(events, scrollDirection),
|
||||||
m_isPrimary(isPrimary),
|
m_isPrimary(isPrimary),
|
||||||
m_mouseScrollDelta(mouseScrollDelta),
|
m_mouseScrollDelta(mouseScrollDelta),
|
||||||
m_display(nullptr),
|
|
||||||
m_root(None),
|
|
||||||
m_window(None),
|
|
||||||
m_isOnScreen(m_isPrimary),
|
m_isOnScreen(m_isPrimary),
|
||||||
m_x(0),
|
|
||||||
m_y(0),
|
|
||||||
m_w(0),
|
|
||||||
m_h(0),
|
|
||||||
m_xCenter(0),
|
|
||||||
m_yCenter(0),
|
|
||||||
m_xCursor(0),
|
|
||||||
m_yCursor(0),
|
|
||||||
m_keyState(nullptr),
|
|
||||||
m_lastFocus(None),
|
|
||||||
m_lastFocusRevert(RevertToNone),
|
|
||||||
m_im(nullptr),
|
|
||||||
m_ic(nullptr),
|
|
||||||
m_lastKeycode(0),
|
|
||||||
m_sequenceNumber(0),
|
|
||||||
m_screensaver(nullptr),
|
|
||||||
m_screensaverNotify(false),
|
|
||||||
m_xtestIsXineramaUnaware(true),
|
|
||||||
m_preserveFocus(false),
|
|
||||||
m_xkb(false),
|
|
||||||
m_xi2detected(false),
|
|
||||||
m_xrandr(false),
|
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
assert(s_screen == nullptr);
|
assert(s_screen == nullptr);
|
||||||
|
|
|
||||||
|
|
@ -172,27 +172,27 @@ private:
|
||||||
bool m_isPrimary;
|
bool m_isPrimary;
|
||||||
int m_mouseScrollDelta;
|
int m_mouseScrollDelta;
|
||||||
|
|
||||||
Display *m_display;
|
Display *m_display = nullptr;
|
||||||
Window m_root;
|
Window m_root = None;
|
||||||
Window m_window;
|
Window m_window = None;
|
||||||
|
|
||||||
// true if mouse has entered the screen
|
// true if mouse has entered the screen
|
||||||
bool m_isOnScreen;
|
bool m_isOnScreen;
|
||||||
|
|
||||||
// screen shape stuff
|
// screen shape stuff
|
||||||
int32_t m_x;
|
int32_t m_x = 0;
|
||||||
int32_t m_y;
|
int32_t m_y = 0;
|
||||||
int32_t m_w;
|
int32_t m_w = 0;
|
||||||
int32_t m_h;
|
int32_t m_h = 0;
|
||||||
int32_t m_xCenter;
|
int32_t m_xCenter = 0;
|
||||||
int32_t m_yCenter;
|
int32_t m_yCenter = 0;
|
||||||
|
|
||||||
// last mouse position
|
// last mouse position
|
||||||
int32_t m_xCursor;
|
int32_t m_xCursor = 0;
|
||||||
int32_t m_yCursor;
|
int32_t m_yCursor = 0;
|
||||||
|
|
||||||
// keyboard stuff
|
// keyboard stuff
|
||||||
XWindowsKeyState *m_keyState;
|
XWindowsKeyState *m_keyState = nullptr;
|
||||||
|
|
||||||
// hot key stuff
|
// hot key stuff
|
||||||
HotKeyMap m_hotKeys;
|
HotKeyMap m_hotKeys;
|
||||||
|
|
@ -200,22 +200,22 @@ private:
|
||||||
HotKeyToIDMap m_hotKeyToIDMap;
|
HotKeyToIDMap m_hotKeyToIDMap;
|
||||||
|
|
||||||
// input focus stuff
|
// input focus stuff
|
||||||
Window m_lastFocus;
|
Window m_lastFocus = None;
|
||||||
int m_lastFocusRevert;
|
int m_lastFocusRevert = RevertToNone;
|
||||||
|
|
||||||
// input method stuff
|
// input method stuff
|
||||||
XIM m_im;
|
XIM m_im = nullptr;
|
||||||
XIC m_ic;
|
XIC m_ic = nullptr;
|
||||||
KeyCode m_lastKeycode;
|
KeyCode m_lastKeycode = 0;
|
||||||
FilteredKeycodes m_filtered;
|
FilteredKeycodes m_filtered;
|
||||||
|
|
||||||
// clipboards
|
// clipboards
|
||||||
XWindowsClipboard *m_clipboard[kClipboardEnd];
|
XWindowsClipboard *m_clipboard[kClipboardEnd];
|
||||||
uint32_t m_sequenceNumber;
|
uint32_t m_sequenceNumber = 0;
|
||||||
|
|
||||||
// screen saver stuff
|
// screen saver stuff
|
||||||
XWindowsScreenSaver *m_screensaver;
|
XWindowsScreenSaver *m_screensaver = nullptr;
|
||||||
bool m_screensaverNotify;
|
bool m_screensaverNotify = false;
|
||||||
|
|
||||||
// logical to physical button mapping. m_buttons[i] gives the
|
// logical to physical button mapping. m_buttons[i] gives the
|
||||||
// physical button for logical button i+1.
|
// physical button for logical button i+1.
|
||||||
|
|
@ -228,24 +228,24 @@ private:
|
||||||
// to fake a mouse motion under xinerama may behave strangely,
|
// to fake a mouse motion under xinerama may behave strangely,
|
||||||
// especially if screen 0 is not at 0,0 or if faking a motion on
|
// especially if screen 0 is not at 0,0 or if faking a motion on
|
||||||
// a screen other than screen 0.
|
// a screen other than screen 0.
|
||||||
bool m_xtestIsXineramaUnaware;
|
bool m_xtestIsXineramaUnaware = true;
|
||||||
bool m_xinerama;
|
bool m_xinerama;
|
||||||
|
|
||||||
// stuff to work around lost focus issues on certain systems
|
// stuff to work around lost focus issues on certain systems
|
||||||
// (ie: a MythTV front-end).
|
// (ie: a MythTV front-end).
|
||||||
bool m_preserveFocus;
|
bool m_preserveFocus = false;
|
||||||
|
|
||||||
// XKB extension stuff
|
// XKB extension stuff
|
||||||
bool m_xkb;
|
bool m_xkb = false;
|
||||||
int m_xkbEventBase;
|
int m_xkbEventBase;
|
||||||
|
|
||||||
bool m_xi2detected;
|
bool m_xi2detected = false;
|
||||||
|
|
||||||
// XRandR extension stuff
|
// XRandR extension stuff
|
||||||
bool m_xrandr;
|
bool m_xrandr = false;
|
||||||
int m_xrandrEventBase;
|
int m_xrandrEventBase;
|
||||||
|
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events = nullptr;
|
||||||
deskflow::KeyMap m_keyMap;
|
deskflow::KeyMap m_keyMap;
|
||||||
|
|
||||||
// pointer to (singleton) screen. this is only needed by
|
// pointer to (singleton) screen. this is only needed by
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,6 @@ XWindowsScreenSaver::XWindowsScreenSaver(Display *display, Window window, void *
|
||||||
: m_display(display),
|
: m_display(display),
|
||||||
m_xscreensaverSink(window),
|
m_xscreensaverSink(window),
|
||||||
m_eventTarget(eventTarget),
|
m_eventTarget(eventTarget),
|
||||||
m_xscreensaver(None),
|
|
||||||
m_xscreensaverActive(false),
|
|
||||||
m_dpms(false),
|
|
||||||
m_disabled(false),
|
|
||||||
m_suppressDisable(false),
|
|
||||||
m_disableTimer(nullptr),
|
|
||||||
m_disablePos(0),
|
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
// get atoms
|
// get atoms
|
||||||
|
|
|
||||||
|
|
@ -118,10 +118,10 @@ private:
|
||||||
void *m_eventTarget;
|
void *m_eventTarget;
|
||||||
|
|
||||||
// xscreensaver's window
|
// xscreensaver's window
|
||||||
Window m_xscreensaver;
|
Window m_xscreensaver = None;
|
||||||
|
|
||||||
// xscreensaver activation state
|
// xscreensaver activation state
|
||||||
bool m_xscreensaverActive;
|
bool m_xscreensaverActive = false;
|
||||||
|
|
||||||
// old event mask on root window
|
// old event mask on root window
|
||||||
long m_rootEventMask;
|
long m_rootEventMask;
|
||||||
|
|
@ -142,24 +142,24 @@ private:
|
||||||
int m_allowExposures;
|
int m_allowExposures;
|
||||||
|
|
||||||
// DPMS screen saver settings
|
// DPMS screen saver settings
|
||||||
bool m_dpms;
|
bool m_dpms = false;
|
||||||
bool m_dpmsEnabled;
|
bool m_dpmsEnabled;
|
||||||
|
|
||||||
// true iff the client wants the screen saver suppressed
|
// true iff the client wants the screen saver suppressed
|
||||||
bool m_disabled;
|
bool m_disabled = false;
|
||||||
|
|
||||||
// true iff we're ignoring m_disabled. this is true, for example,
|
// true iff we're ignoring m_disabled. this is true, for example,
|
||||||
// when the client has called activate() and so presumably wants
|
// when the client has called activate() and so presumably wants
|
||||||
// to activate the screen saver even if disabled.
|
// to activate the screen saver even if disabled.
|
||||||
bool m_suppressDisable;
|
bool m_suppressDisable = false;
|
||||||
|
|
||||||
// the disable timer (nullptr if not installed)
|
// the disable timer (nullptr if not installed)
|
||||||
EventQueueTimer *m_disableTimer;
|
EventQueueTimer *m_disableTimer = nullptr;
|
||||||
|
|
||||||
// fake mouse motion position for suppressing the screen saver.
|
// fake mouse motion position for suppressing the screen saver.
|
||||||
// xscreensaver since 2.21 requires the mouse to move more than 10
|
// xscreensaver since 2.21 requires the mouse to move more than 10
|
||||||
// pixels to be considered significant.
|
// pixels to be considered significant.
|
||||||
int32_t m_disablePos;
|
int32_t m_disablePos = 0;
|
||||||
|
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
// BaseClientProxy
|
// BaseClientProxy
|
||||||
//
|
//
|
||||||
|
|
||||||
BaseClientProxy::BaseClientProxy(const std::string &name) : m_name(name), m_x(0), m_y(0)
|
BaseClientProxy::BaseClientProxy(const std::string &name) : m_name(name)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
int32_t m_x;
|
int32_t m_x = 0;
|
||||||
int32_t m_y;
|
int32_t m_y = 0;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ ClientListener::ClientListener(
|
||||||
const NetworkAddress &address, ISocketFactory *socketFactory, IEventQueue *events, SecurityLevel securityLevel
|
const NetworkAddress &address, ISocketFactory *socketFactory, IEventQueue *events, SecurityLevel securityLevel
|
||||||
)
|
)
|
||||||
: m_socketFactory(socketFactory),
|
: m_socketFactory(socketFactory),
|
||||||
m_server(nullptr),
|
|
||||||
m_events(events),
|
m_events(events),
|
||||||
m_securityLevel(securityLevel),
|
m_securityLevel(securityLevel),
|
||||||
m_address(address)
|
m_address(address)
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ private:
|
||||||
ISocketFactory *m_socketFactory;
|
ISocketFactory *m_socketFactory;
|
||||||
NewClients m_newClients;
|
NewClients m_newClients;
|
||||||
WaitingClients m_waitingClients;
|
WaitingClients m_waitingClients;
|
||||||
Server *m_server;
|
Server *m_server = nullptr;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
SecurityLevel m_securityLevel;
|
SecurityLevel m_securityLevel;
|
||||||
ClientSockets m_clientSockets;
|
ClientSockets m_clientSockets;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
ClientProxy1_0::ClientProxy1_0(const std::string &name, deskflow::IStream *stream, IEventQueue *events)
|
ClientProxy1_0::ClientProxy1_0(const std::string &name, deskflow::IStream *stream, IEventQueue *events)
|
||||||
: ClientProxy(name, stream),
|
: ClientProxy(name, stream),
|
||||||
m_heartbeatTimer(nullptr),
|
|
||||||
m_parser(&ClientProxy1_0::parseHandshakeMessage),
|
m_parser(&ClientProxy1_0::parseHandshakeMessage),
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
|
|
@ -443,12 +442,3 @@ bool ClientProxy1_0::recvGrabClipboard()
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// ClientProxy1_0::ClientClipboard
|
|
||||||
//
|
|
||||||
|
|
||||||
ClientProxy1_0::ClientClipboard::ClientClipboard() : m_clipboard(), m_sequenceNumber(0), m_dirty(true)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -81,12 +81,12 @@ protected:
|
||||||
struct ClientClipboard
|
struct ClientClipboard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClientClipboard();
|
ClientClipboard() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Clipboard m_clipboard;
|
Clipboard m_clipboard;
|
||||||
uint32_t m_sequenceNumber;
|
uint32_t m_sequenceNumber = 0;
|
||||||
bool m_dirty;
|
bool m_dirty = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientClipboard m_clipboard[kClipboardEnd];
|
ClientClipboard m_clipboard[kClipboardEnd];
|
||||||
|
|
@ -96,7 +96,7 @@ private:
|
||||||
|
|
||||||
ClientInfo m_info;
|
ClientInfo m_info;
|
||||||
double m_heartbeatAlarm;
|
double m_heartbeatAlarm;
|
||||||
EventQueueTimer *m_heartbeatTimer;
|
EventQueueTimer *m_heartbeatTimer = nullptr;
|
||||||
MessageParser m_parser;
|
MessageParser m_parser;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@
|
||||||
|
|
||||||
ClientProxy1_3::ClientProxy1_3(const std::string &name, deskflow::IStream *stream, IEventQueue *events)
|
ClientProxy1_3::ClientProxy1_3(const std::string &name, deskflow::IStream *stream, IEventQueue *events)
|
||||||
: ClientProxy1_2(name, stream, events),
|
: ClientProxy1_2(name, stream, events),
|
||||||
m_keepAliveRate(kKeepAliveRate),
|
|
||||||
m_keepAliveTimer(nullptr),
|
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
setHeartbeatRate(kKeepAliveRate, kKeepAliveRate * kKeepAlivesUntilDeath);
|
setHeartbeatRate(kKeepAliveRate, kKeepAliveRate * kKeepAlivesUntilDeath);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ protected:
|
||||||
virtual void keepAlive();
|
virtual void keepAlive();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_keepAliveRate;
|
double m_keepAliveRate = kKeepAliveRate;
|
||||||
EventQueueTimer *m_keepAliveTimer;
|
EventQueueTimer *m_keepAliveTimer = nullptr;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,6 @@
|
||||||
|
|
||||||
ClientProxyUnknown::ClientProxyUnknown(deskflow::IStream *stream, double timeout, Server *server, IEventQueue *events)
|
ClientProxyUnknown::ClientProxyUnknown(deskflow::IStream *stream, double timeout, Server *server, IEventQueue *events)
|
||||||
: m_stream(stream),
|
: m_stream(stream),
|
||||||
m_proxy(nullptr),
|
|
||||||
m_ready(false),
|
|
||||||
m_server(server),
|
m_server(server),
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,10 @@ private:
|
||||||
void handleReady(const Event &, void *);
|
void handleReady(const Event &, void *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
deskflow::IStream *m_stream;
|
deskflow::IStream *m_stream = nullptr;
|
||||||
EventQueueTimer *m_timer;
|
EventQueueTimer *m_timer = nullptr;
|
||||||
ClientProxy *m_proxy;
|
ClientProxy *m_proxy = nullptr;
|
||||||
bool m_ready;
|
bool m_ready = false;
|
||||||
Server *m_server;
|
Server *m_server = nullptr;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const auto kBarrierProtocolOption = "barrier";
|
||||||
// Config
|
// Config
|
||||||
//
|
//
|
||||||
|
|
||||||
Config::Config(IEventQueue *events) : m_inputFilter(events), m_hasLockToScreenAction(false), m_events(events)
|
Config::Config(IEventQueue *events) : m_inputFilter(events), m_events(events)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,10 +146,7 @@ public:
|
||||||
class const_iterator : std::iterator_traits<Config>
|
class const_iterator : std::iterator_traits<Config>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit const_iterator() : m_i()
|
explicit const_iterator() = default;
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
explicit const_iterator(const internal_const_iterator &i) : m_i(i)
|
explicit const_iterator(const internal_const_iterator &i) : m_i(i)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|
@ -484,7 +481,7 @@ private:
|
||||||
NetworkAddress m_deskflowAddress;
|
NetworkAddress m_deskflowAddress;
|
||||||
ScreenOptions m_globalOptions;
|
ScreenOptions m_globalOptions;
|
||||||
InputFilter m_inputFilter;
|
InputFilter m_inputFilter;
|
||||||
bool m_hasLockToScreenAction;
|
bool m_hasLockToScreenAction = false;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,7 @@ void InputFilter::Condition::disablePrimary(PrimaryClient *)
|
||||||
}
|
}
|
||||||
|
|
||||||
InputFilter::KeystrokeCondition::KeystrokeCondition(IEventQueue *events, IPlatformScreen::KeyInfo *info)
|
InputFilter::KeystrokeCondition::KeystrokeCondition(IEventQueue *events, IPlatformScreen::KeyInfo *info)
|
||||||
: m_id(0),
|
: m_key(info->m_key),
|
||||||
m_key(info->m_key),
|
|
||||||
m_mask(info->m_mask),
|
m_mask(info->m_mask),
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
|
|
@ -40,8 +39,7 @@ InputFilter::KeystrokeCondition::KeystrokeCondition(IEventQueue *events, IPlatfo
|
||||||
}
|
}
|
||||||
|
|
||||||
InputFilter::KeystrokeCondition::KeystrokeCondition(IEventQueue *events, KeyID key, KeyModifierMask mask)
|
InputFilter::KeystrokeCondition::KeystrokeCondition(IEventQueue *events, KeyID key, KeyModifierMask mask)
|
||||||
: m_id(0),
|
: m_key(key),
|
||||||
m_key(key),
|
|
||||||
m_mask(mask),
|
m_mask(mask),
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
|
|
@ -524,17 +522,12 @@ const char *InputFilter::MouseButtonAction::formatName() const
|
||||||
// InputFilter::Rule
|
// InputFilter::Rule
|
||||||
//
|
//
|
||||||
|
|
||||||
InputFilter::Rule::Rule() : m_condition(nullptr)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
InputFilter::Rule::Rule(Condition *adoptedCondition) : m_condition(adoptedCondition)
|
InputFilter::Rule::Rule(Condition *adoptedCondition) : m_condition(adoptedCondition)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
InputFilter::Rule::Rule(const Rule &rule) : m_condition(nullptr)
|
InputFilter::Rule::Rule(const Rule &rule)
|
||||||
{
|
{
|
||||||
copy(rule);
|
copy(rule);
|
||||||
}
|
}
|
||||||
|
|
@ -735,10 +728,7 @@ InputFilter::InputFilter(IEventQueue *events) : m_primaryClient(nullptr), m_even
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
InputFilter::InputFilter(const InputFilter &x)
|
InputFilter::InputFilter(const InputFilter &x) : m_ruleList(x.m_ruleList), m_events(x.m_events)
|
||||||
: m_ruleList(x.m_ruleList),
|
|
||||||
m_primaryClient(nullptr),
|
|
||||||
m_events(x.m_events)
|
|
||||||
{
|
{
|
||||||
setPrimaryClient(x.m_primaryClient);
|
setPrimaryClient(x.m_primaryClient);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public:
|
||||||
void disablePrimary(PrimaryClient *) override;
|
void disablePrimary(PrimaryClient *) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_id;
|
uint32_t m_id = 0;
|
||||||
KeyID m_key;
|
KeyID m_key;
|
||||||
KeyModifierMask m_mask;
|
KeyModifierMask m_mask;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
|
|
@ -300,7 +300,7 @@ public:
|
||||||
class Rule
|
class Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Rule();
|
Rule() = default;
|
||||||
explicit Rule(Condition *adopted);
|
explicit Rule(Condition *adopted);
|
||||||
Rule(const Rule &);
|
Rule(const Rule &);
|
||||||
~Rule();
|
~Rule();
|
||||||
|
|
@ -345,7 +345,7 @@ public:
|
||||||
private:
|
private:
|
||||||
using ActionList = std::vector<Action *>;
|
using ActionList = std::vector<Action *>;
|
||||||
|
|
||||||
Condition *m_condition;
|
Condition *m_condition = nullptr;
|
||||||
ActionList m_activateActions;
|
ActionList m_activateActions;
|
||||||
ActionList m_deactivateActions;
|
ActionList m_deactivateActions;
|
||||||
};
|
};
|
||||||
|
|
@ -391,6 +391,6 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RuleList m_ruleList;
|
RuleList m_ruleList;
|
||||||
PrimaryClient *m_primaryClient;
|
PrimaryClient *m_primaryClient = nullptr;
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@
|
||||||
|
|
||||||
PrimaryClient::PrimaryClient(const std::string &name, deskflow::Screen *screen)
|
PrimaryClient::PrimaryClient(const std::string &name, deskflow::Screen *screen)
|
||||||
: BaseClientProxy(name),
|
: BaseClientProxy(name),
|
||||||
m_screen(screen),
|
m_screen(screen)
|
||||||
m_fakeInputCount(0)
|
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,5 +143,5 @@ public:
|
||||||
private:
|
private:
|
||||||
deskflow::Screen *m_screen;
|
deskflow::Screen *m_screen;
|
||||||
bool m_clipboardDirty[kClipboardEnd] = {false, false};
|
bool m_clipboardDirty[kClipboardEnd] = {false, false};
|
||||||
int32_t m_fakeInputCount;
|
int32_t m_fakeInputCount = 0;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -46,33 +46,10 @@ Server::Server(
|
||||||
)
|
)
|
||||||
: m_primaryClient(primaryClient),
|
: m_primaryClient(primaryClient),
|
||||||
m_active(primaryClient),
|
m_active(primaryClient),
|
||||||
m_seqNum(0),
|
|
||||||
m_xDelta(0),
|
|
||||||
m_yDelta(0),
|
|
||||||
m_xDelta2(0),
|
|
||||||
m_yDelta2(0),
|
|
||||||
m_config(&config),
|
m_config(&config),
|
||||||
m_inputFilter(config.getInputFilter()),
|
m_inputFilter(config.getInputFilter()),
|
||||||
m_activeSaver(nullptr),
|
|
||||||
m_switchDir(kNoDirection),
|
|
||||||
m_switchScreen(nullptr),
|
|
||||||
m_switchWaitDelay(0.0),
|
|
||||||
m_switchWaitTimer(nullptr),
|
|
||||||
m_switchTwoTapDelay(0.0),
|
|
||||||
m_switchTwoTapEngaged(false),
|
|
||||||
m_switchTwoTapArmed(false),
|
|
||||||
m_switchTwoTapZone(3),
|
|
||||||
m_switchNeedsShift(false),
|
|
||||||
m_switchNeedsControl(false),
|
|
||||||
m_switchNeedsAlt(false),
|
|
||||||
m_relativeMoves(false),
|
|
||||||
m_keyboardBroadcasting(false),
|
|
||||||
m_lockedToScreen(false),
|
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
m_events(events),
|
m_events(events),
|
||||||
m_disableLockToScreen(false),
|
|
||||||
m_enableClipboard(true),
|
|
||||||
m_maximumClipboardSize(INT_MAX),
|
|
||||||
m_args(args)
|
m_args(args)
|
||||||
{
|
{
|
||||||
// must have a primary client and it must have a canonical name
|
// must have a primary client and it must have a canonical name
|
||||||
|
|
@ -2078,15 +2055,6 @@ void Server::forceLeaveClient(const BaseClientProxy *client)
|
||||||
m_primaryClient->reconfigure(getActivePrimarySides());
|
m_primaryClient->reconfigure(getActivePrimarySides());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Server::ClipboardInfo
|
|
||||||
//
|
|
||||||
|
|
||||||
Server::ClipboardInfo::ClipboardInfo() : m_clipboard(), m_clipboardData(), m_clipboardOwner(), m_clipboardSeqNum(0)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Server::LockCursorToScreenInfo
|
// Server::LockCursorToScreenInfo
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -351,13 +351,13 @@ private:
|
||||||
class ClipboardInfo
|
class ClipboardInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClipboardInfo();
|
ClipboardInfo() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Clipboard m_clipboard;
|
Clipboard m_clipboard;
|
||||||
std::string m_clipboardData;
|
std::string m_clipboardData;
|
||||||
std::string m_clipboardOwner;
|
std::string m_clipboardOwner;
|
||||||
uint32_t m_clipboardSeqNum;
|
uint32_t m_clipboardSeqNum = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// used in hello message sent to the client
|
// used in hello message sent to the client
|
||||||
|
|
@ -380,7 +380,7 @@ private:
|
||||||
BaseClientProxy *m_active;
|
BaseClientProxy *m_active;
|
||||||
|
|
||||||
// the sequence number of enter messages
|
// the sequence number of enter messages
|
||||||
uint32_t m_seqNum;
|
uint32_t m_seqNum = 0;
|
||||||
|
|
||||||
// current mouse position (in absolute screen coordinates) on
|
// current mouse position (in absolute screen coordinates) on
|
||||||
// whichever screen is active
|
// whichever screen is active
|
||||||
|
|
@ -391,10 +391,10 @@ private:
|
||||||
// on win32 which reports bogus mouse motion at the edge of
|
// on win32 which reports bogus mouse motion at the edge of
|
||||||
// the screen when using low level hooks, synthesizing motion
|
// the screen when using low level hooks, synthesizing motion
|
||||||
// in the opposite direction the mouse actually moved.
|
// in the opposite direction the mouse actually moved.
|
||||||
int32_t m_xDelta;
|
int32_t m_xDelta = 0;
|
||||||
int32_t m_yDelta;
|
int32_t m_yDelta = 0;
|
||||||
int32_t m_xDelta2;
|
int32_t m_xDelta2 = 0;
|
||||||
int32_t m_yDelta2;
|
int32_t m_yDelta2 = 0;
|
||||||
|
|
||||||
// current configuration
|
// current configuration
|
||||||
ServerConfig *m_config;
|
ServerConfig *m_config;
|
||||||
|
|
@ -406,52 +406,52 @@ private:
|
||||||
ClipboardInfo m_clipboards[kClipboardEnd];
|
ClipboardInfo m_clipboards[kClipboardEnd];
|
||||||
|
|
||||||
// state saved when screen saver activates
|
// state saved when screen saver activates
|
||||||
BaseClientProxy *m_activeSaver;
|
BaseClientProxy *m_activeSaver = nullptr;
|
||||||
int32_t m_xSaver;
|
int32_t m_xSaver;
|
||||||
int32_t m_ySaver;
|
int32_t m_ySaver;
|
||||||
|
|
||||||
// common state for screen switch tests. all tests are always
|
// common state for screen switch tests. all tests are always
|
||||||
// trying to reach the same screen in the same direction.
|
// trying to reach the same screen in the same direction.
|
||||||
EDirection m_switchDir;
|
EDirection m_switchDir = EDirection::kNoDirection;
|
||||||
BaseClientProxy *m_switchScreen;
|
BaseClientProxy *m_switchScreen = nullptr;
|
||||||
|
|
||||||
// state for delayed screen switching
|
// state for delayed screen switching
|
||||||
double m_switchWaitDelay;
|
double m_switchWaitDelay = 0.0;
|
||||||
EventQueueTimer *m_switchWaitTimer;
|
EventQueueTimer *m_switchWaitTimer = nullptr;
|
||||||
int32_t m_switchWaitX;
|
int32_t m_switchWaitX;
|
||||||
int32_t m_switchWaitY;
|
int32_t m_switchWaitY;
|
||||||
|
|
||||||
// state for double-tap screen switching
|
// state for double-tap screen switching
|
||||||
double m_switchTwoTapDelay;
|
double m_switchTwoTapDelay = 0.0;
|
||||||
Stopwatch m_switchTwoTapTimer;
|
Stopwatch m_switchTwoTapTimer;
|
||||||
bool m_switchTwoTapEngaged;
|
bool m_switchTwoTapEngaged = false;
|
||||||
bool m_switchTwoTapArmed;
|
bool m_switchTwoTapArmed = false;
|
||||||
int32_t m_switchTwoTapZone;
|
int32_t m_switchTwoTapZone = 3;
|
||||||
|
|
||||||
// modifiers needed before switching
|
// modifiers needed before switching
|
||||||
bool m_switchNeedsShift;
|
bool m_switchNeedsShift = false;
|
||||||
bool m_switchNeedsControl;
|
bool m_switchNeedsControl = false;
|
||||||
bool m_switchNeedsAlt;
|
bool m_switchNeedsAlt = false;
|
||||||
|
|
||||||
// relative mouse move option
|
// relative mouse move option
|
||||||
bool m_relativeMoves;
|
bool m_relativeMoves = false;
|
||||||
|
|
||||||
// flag whether or not we have broadcasting enabled and the screens to
|
// flag whether or not we have broadcasting enabled and the screens to
|
||||||
// which we should send broadcasted keys.
|
// which we should send broadcasted keys.
|
||||||
bool m_keyboardBroadcasting;
|
bool m_keyboardBroadcasting = false;
|
||||||
std::string m_keyboardBroadcastingScreens;
|
std::string m_keyboardBroadcastingScreens;
|
||||||
|
|
||||||
// screen locking (former scroll lock)
|
// screen locking (former scroll lock)
|
||||||
bool m_lockedToScreen;
|
bool m_lockedToScreen = false;
|
||||||
|
|
||||||
// server screen
|
// server screen
|
||||||
deskflow::Screen *m_screen;
|
deskflow::Screen *m_screen;
|
||||||
|
|
||||||
IEventQueue *m_events;
|
IEventQueue *m_events;
|
||||||
|
|
||||||
bool m_disableLockToScreen;
|
bool m_disableLockToScreen = false;
|
||||||
bool m_enableClipboard;
|
bool m_enableClipboard = true;
|
||||||
size_t m_maximumClipboardSize;
|
size_t m_maximumClipboardSize = INT_MAX;
|
||||||
|
|
||||||
ClientListener *m_clientListener;
|
ClientListener *m_clientListener;
|
||||||
deskflow::ServerArgs m_args;
|
deskflow::ServerArgs m_args;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue