chore: remove handle* methods that are a single oneline forward and use the line directly

This commit is contained in:
sithlord48
2025-06-18 00:35:39 -04:00
committed by Nick Bolton
parent 3a35b183d3
commit 66e201c8ef
20 changed files with 21 additions and 108 deletions

View File

@ -423,7 +423,7 @@ void Client::setupConnection()
handleDisconnected();
});
m_events->addHandler(EventTypes::SocketStopRetry, m_stream->getEventTarget(), [this](const auto &) {
handleStopRetry();
m_args.m_restartable = false;
});
}
@ -645,8 +645,3 @@ void Client::bindNetworkInterface(IDataSocket *socket) const
LOG((CLOG_WARN "operating system will select network interface automatically"));
}
}
void Client::handleStopRetry()
{
m_args.m_restartable = false;
}

View File

@ -179,7 +179,6 @@ private:
void handleHello();
void handleSuspend();
void handleResume();
void handleStopRetry();
void sendClipboardThread(void *);
void bindNetworkInterface(IDataSocket *socket) const;

View File

@ -47,7 +47,9 @@ ServerProxy::ServerProxy(Client *client, deskflow::IStream *stream, IEventQueue
m_events->addHandler(EventTypes::StreamInputReady, m_stream->getEventTarget(), [this](const auto &) {
handleData();
});
m_events->addHandler(EventTypes::ClipboardSending, this, [this](const auto &e) { handleClipboardSendingEvent(e); });
m_events->addHandler(EventTypes::ClipboardSending, this, [this](const auto &e) {
ClipboardChunk::send(m_stream, e.getDataObject());
});
// send heartbeat
setKeepAliveRate(kKeepAliveRate);
@ -805,11 +807,6 @@ void ServerProxy::infoAcknowledgment()
m_ignoreMouse = false;
}
void ServerProxy::handleClipboardSendingEvent(const Event &event)
{
ClipboardChunk::send(m_stream, event.getDataObject());
}
void ServerProxy::secureInputNotification()
{
std::string app;

View File

@ -96,7 +96,6 @@ private:
void setOptions();
void queryInfo();
void infoAcknowledgment();
void handleClipboardSendingEvent(const Event &event);
void secureInputNotification();
void setServerLanguages();
void setActiveServerLanguage(const std::string &language);

View File

@ -210,11 +210,6 @@ void ServerApp::handleClientConnected(const Event &, ClientListener *listener)
}
}
void ServerApp::handleClientsDisconnected()
{
m_events->addEvent(Event(EventTypes::Quit));
}
void ServerApp::closeServer(Server *server)
{
if (server == nullptr) {
@ -227,8 +222,10 @@ void ServerApp::closeServer(Server *server)
// wait for clients to disconnect for up to timeout seconds
double timeout = 3.0;
EventQueueTimer *timer = m_events->newOneShotTimer(timeout, nullptr);
m_events->addHandler(EventTypes::Timer, timer, [this](const auto &) { handleClientsDisconnected(); });
m_events->addHandler(EventTypes::ServerDisconnected, server, [this](const auto &) { handleClientsDisconnected(); });
m_events->addHandler(EventTypes::Timer, timer, [this](const auto &) { m_events->addEvent(Event(EventTypes::Quit)); });
m_events->addHandler(EventTypes::ServerDisconnected, server, [this](const auto &) {
m_events->addEvent(Event(EventTypes::Quit));
});
m_events->loop();
@ -557,7 +554,7 @@ Server *ServerApp::openServer(ServerConfig &config, PrimaryClient *primaryClient
{
auto *server = new Server(config, primaryClient, m_serverScreen, m_events, args());
try {
m_events->addHandler(EventTypes::ServerDisconnected, server, [this](const auto &) { handleNoClients(); });
m_events->addHandler(EventTypes::ServerDisconnected, server, [this](const auto &) { updateStatus(); });
m_events->addHandler(EventTypes::ServerScreenSwitched, server, [this](const auto &e) { handleScreenSwitched(e); });
} catch (std::bad_alloc &ba) {
@ -568,11 +565,6 @@ Server *ServerApp::openServer(ServerConfig &config, PrimaryClient *primaryClient
return server;
}
void ServerApp::handleNoClients()
{
updateStatus();
}
void ServerApp::handleScreenSwitched(const Event &e)
{
// do nothing

View File

@ -83,7 +83,6 @@ public:
void forceReconnect();
void resetServer();
void handleClientConnected(const Event &e, ClientListener *listener);
void handleClientsDisconnected();
void closeServer(Server *server);
void stopRetryTimer();
void updateStatus() const;
@ -102,7 +101,6 @@ public:
void handleResume();
ClientListener *openClientListener(const NetworkAddress &address);
Server *openServer(ServerConfig &config, PrimaryClient *primaryClient);
void handleNoClients();
bool startServer();
Server *getServerPtr()
{

View File

@ -20,9 +20,7 @@ StreamFilter::StreamFilter(IEventQueue *events, deskflow::IStream *stream, bool
{
// replace handlers for m_stream
m_events->removeHandlers(m_stream->getEventTarget());
m_events->addHandler(EventTypes::Unknown, m_stream->getEventTarget(), [this](const auto &e) {
handleUpstreamEvent(e);
});
m_events->addHandler(EventTypes::Unknown, m_stream->getEventTarget(), [this](const auto &e) { filterEvent(e); });
}
StreamFilter::~StreamFilter()
@ -87,8 +85,3 @@ void StreamFilter::filterEvent(const Event &event)
{
m_events->dispatchEvent(Event(event.getType(), getEventTarget(), event.getData()));
}
void StreamFilter::handleUpstreamEvent(const Event &event)
{
filterEvent(event);
}

View File

@ -59,9 +59,6 @@ protected:
*/
virtual void filterEvent(const Event &);
private:
void handleUpstreamEvent(const Event &);
private:
deskflow::IStream *m_stream;
bool m_adopted;

View File

@ -148,9 +148,6 @@ private:
// get the current scroll wheel speed
double getScrollSpeed() const;
// clipboard check timer handler
void handleClipboardCheck();
// Resolution switch callback
static void displayReconfigurationCallback(CGDirectDisplayID, CGDisplayChangeSummaryFlags, void *);

View File

@ -647,7 +647,7 @@ void OSXScreen::enable()
{
// watch the clipboard
m_clipboardTimer = m_events->newTimer(1.0, nullptr);
m_events->addHandler(EventTypes::Timer, m_clipboardTimer, [this](const auto &) { handleClipboardCheck(); });
m_events->addHandler(EventTypes::Timer, m_clipboardTimer, [this](const auto &) { checkClipboards(); });
if (m_isPrimary) {
// FIXME -- start watching jump zones
@ -992,11 +992,6 @@ bool OSXScreen::onMouseWheel(int32_t xDelta, int32_t yDelta) const
return true;
}
void OSXScreen::handleClipboardCheck()
{
checkClipboards();
}
void OSXScreen::displayReconfigurationCallback(
CGDirectDisplayID displayID, CGDisplayChangeSummaryFlags flags, void *inUserData
)

View File

@ -160,7 +160,7 @@ void ClientListener::handleClientAccepted(IDataSocket *socket)
handleUnknownClient(client);
});
m_events->addHandler(EventTypes::ClientProxyUnknownFailure, client, [this, client](const auto &) {
handleUnknownClientFailure(client);
removeUnknownClient(client);
});
}
@ -190,11 +190,6 @@ void ClientListener::handleUnknownClient(ClientProxyUnknown *unknownClient)
removeUnknownClient(unknownClient);
}
void ClientListener::handleUnknownClientFailure(ClientProxyUnknown *client)
{
removeUnknownClient(client);
}
void ClientListener::handleClientDisconnected(ClientProxy *client)
{
// find client in waiting clients queue

View File

@ -67,7 +67,6 @@ private:
void handleClientConnecting();
void handleClientAccepted(IDataSocket *socket);
void handleUnknownClient(ClientProxyUnknown *unknownClient);
void handleUnknownClientFailure(ClientProxyUnknown *client);
void handleClientDisconnected(ClientProxy *client);
void cleanupListenSocket();

View File

@ -73,7 +73,7 @@ void ClientProxy1_3::addHeartbeatTimer()
// create and install a timer to periodically send keep alives
if (m_keepAliveRate > 0.0) {
m_keepAliveTimer = m_events->newTimer(m_keepAliveRate, nullptr);
m_events->addHandler(EventTypes::Timer, m_keepAliveTimer, [this](const auto &) { handleKeepAlive(); });
m_events->addHandler(EventTypes::Timer, m_keepAliveTimer, [this](const auto &) { keepAlive(); });
}
// superclass does the alarm
@ -93,11 +93,6 @@ void ClientProxy1_3::removeHeartbeatTimer()
ClientProxy1_2::removeHeartbeatTimer();
}
void ClientProxy1_3::handleKeepAlive()
{
keepAlive();
}
void ClientProxy1_3::keepAlive()
{
ProtocolUtil::writef(getStream(), kMsgCKeepAlive);

View File

@ -25,8 +25,6 @@ public:
// IClient overrides
void mouseWheel(int32_t xDelta, int32_t yDelta) override;
void handleKeepAlive();
protected:
// ClientProxy overrides
bool parseMessage(const uint8_t *code) override;

View File

@ -21,7 +21,9 @@ ClientProxy1_6::ClientProxy1_6(const std::string &name, deskflow::IStream *strea
: ClientProxy1_5(name, stream, server, events),
m_events(events)
{
m_events->addHandler(EventTypes::ClipboardSending, this, [this](const auto &e) { handleClipboardSendingEvent(e); });
m_events->addHandler(EventTypes::ClipboardSending, this, [this](const auto &e) {
ClipboardChunk::send(getStream(), e.getDataObject());
});
}
void ClientProxy1_6::setClipboard(ClipboardID id, const IClipboard *clipboard)
@ -41,11 +43,6 @@ void ClientProxy1_6::setClipboard(ClipboardID id, const IClipboard *clipboard)
}
}
void ClientProxy1_6::handleClipboardSendingEvent(const Event &event)
{
ClipboardChunk::send(getStream(), event.getDataObject());
}
bool ClientProxy1_6::recvClipboard()
{
// parse message

View File

@ -21,9 +21,6 @@ public:
void setClipboard(ClipboardID id, const IClipboard *clipboard) override;
bool recvClipboard() override;
private:
void handleClipboardSendingEvent(const Event &e);
private:
IEventQueue *m_events;
};

View File

@ -113,7 +113,7 @@ void ClientProxyUnknown::addProxyHandlers()
{
assert(m_proxy != nullptr);
m_events->addHandler(EventTypes::ClientProxyReady, m_proxy, [this](const auto &e) { handleReady(); });
m_events->addHandler(EventTypes::ClientProxyReady, m_proxy, [this](const auto &e) { sendSuccess(); });
m_events->addHandler(EventTypes::ClientProxyDisconnected, m_proxy, [this](const auto &e) { handleDisconnect(); });
}
@ -261,8 +261,3 @@ void ClientProxyUnknown::handleDisconnect()
LOG((CLOG_NOTE "new client disconnected"));
sendFailure();
}
void ClientProxyUnknown::handleReady()
{
sendSuccess();
}

View File

@ -64,7 +64,6 @@ private:
void handleWriteError();
void handleTimeout();
void handleDisconnect();
void handleReady();
private:
deskflow::IStream *m_stream = nullptr;

View File

@ -96,11 +96,11 @@ Server::Server(
});
m_events->addHandler(
EventTypes::PrimaryScreenSaverActivated, m_primaryClient->getEventTarget(),
[this](const auto &) { handleScreensaverActivatedEvent(); }
[this](const auto &) { onScreensaver(true); }
);
m_events->addHandler(
EventTypes::PrimaryScreenSaverDeactivated, m_primaryClient->getEventTarget(),
[this](const auto &) { handleScreensaverDeactivatedEvent(); }
[this](const auto &) { onScreensaver(false); }
);
m_events->addHandler(EventTypes::ServerSwitchToScreen, m_inputFilter, [this](const auto &e) {
handleSwitchToScreenEvent(e);
@ -115,10 +115,10 @@ Server::Server(
handleLockCursorToScreenEvent(e);
});
m_events->addHandler(EventTypes::PrimaryScreenFakeInputBegin, m_inputFilter, [this](const auto &) {
handleFakeInputBeginEvent();
m_primaryClient->fakeInputBegin();
});
m_events->addHandler(EventTypes::PrimaryScreenFakeInputEnd, m_inputFilter, [this](const auto &) {
handleFakeInputEndEvent();
m_primaryClient->fakeInputEnd();
});
// add connection
@ -1260,16 +1260,6 @@ void Server::handleWheelEvent(const Event &event)
onMouseWheel(info->m_xDelta, info->m_yDelta);
}
void Server::handleScreensaverActivatedEvent()
{
onScreensaver(true);
}
void Server::handleScreensaverDeactivatedEvent()
{
onScreensaver(false);
}
void Server::handleSwitchWaitTimeout()
{
// ignore if mouse is locked to screen
@ -1394,16 +1384,6 @@ void Server::handleLockCursorToScreenEvent(const Event &event)
}
}
void Server::handleFakeInputBeginEvent()
{
m_primaryClient->fakeInputBegin();
}
void Server::handleFakeInputEndEvent()
{
m_primaryClient->fakeInputEnd();
}
void Server::onClipboardChanged(const BaseClientProxy *sender, ClipboardID id, uint32_t seqNum)
{
ClipboardInfo &clipboard = m_clipboards[id];

View File

@ -301,8 +301,6 @@ private:
void handleMotionPrimaryEvent(const Event &event);
void handleMotionSecondaryEvent(const Event &event);
void handleWheelEvent(const Event &event);
void handleScreensaverActivatedEvent();
void handleScreensaverDeactivatedEvent();
void handleSwitchWaitTimeout();
void handleClientDisconnected(BaseClientProxy *client);
void handleClientCloseTimeout(BaseClientProxy *client);
@ -310,8 +308,6 @@ private:
void handleSwitchInDirectionEvent(const Event &event);
void handleKeyboardBroadcastEvent(const Event &event);
void handleLockCursorToScreenEvent(const Event &event);
void handleFakeInputBeginEvent();
void handleFakeInputEndEvent();
// event processing
void onClipboardChanged(const BaseClientProxy *sender, ClipboardID id, uint32_t seqNum);