From c7da833f07d9e5f5b16456587ebc70d683ee152a Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sat, 3 Jan 2026 08:58:28 -0500 Subject: [PATCH] refactor: use ArchDaemonWindows::daemonRunning directly removes: unused DAEMON_RUNNING define in App.h unused ArchMiscWindows::daemonRunning update copyright years --- src/lib/arch/IArchDaemon.h | 6 +++--- src/lib/arch/win32/ArchMiscWindows.cpp | 6 +----- src/lib/arch/win32/ArchMiscWindows.h | 7 +------ src/lib/deskflow/App.h | 7 +------ src/lib/deskflow/ClientApp.cpp | 12 ++++++++---- src/lib/deskflow/DaemonApp.cpp | 7 +++---- src/lib/deskflow/ServerApp.cpp | 12 ++++++++---- 7 files changed, 25 insertions(+), 32 deletions(-) diff --git a/src/lib/arch/IArchDaemon.h b/src/lib/arch/IArchDaemon.h index 883c2edf2..44a63e09e 100644 --- a/src/lib/arch/IArchDaemon.h +++ b/src/lib/arch/IArchDaemon.h @@ -1,6 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers + * SPDX-FileCopyrightText: (C) 2025 - 2026 Deskflow Developers * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd. * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception @@ -43,9 +43,9 @@ public: \c func is only called when the service is actually started. \c func must call \c ArchMiscWindows::runDaemon() to finally becoming a service. The \c runFunc function passed to \c runDaemon() - must call \c ArchMiscWindows::daemonRunning(true) when it + must call \c ArchDaemonWindows::daemonRunning(true) when it enters the main loop (i.e. after initialization) and - \c ArchMiscWindows::daemonRunning(false) when it leaves + \c ArchDaemonWindows::daemonRunning(false) when it leaves the main loop. The \c stopFunc function passed to \c runDaemon() is called when the daemon must exit the main loop and it must cause \c runFunc to return. \c func should return what \c runDaemon() diff --git a/src/lib/arch/win32/ArchMiscWindows.cpp b/src/lib/arch/win32/ArchMiscWindows.cpp index bfe4ae40b..2b2c9632c 100644 --- a/src/lib/arch/win32/ArchMiscWindows.cpp +++ b/src/lib/arch/win32/ArchMiscWindows.cpp @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2026 Deskflow Developers * SPDX-FileCopyrightText: (C) 2012 - 2016, 2024 - 2025 Symless Ltd. * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception @@ -69,11 +70,6 @@ int ArchMiscWindows::runDaemon(RunFunc runFunc) return ArchDaemonWindows::runDaemon(runFunc); } -void ArchMiscWindows::daemonRunning(bool running) -{ - ArchDaemonWindows::daemonRunning(running); -} - void ArchMiscWindows::daemonFailed(int result) { ArchDaemonWindows::daemonFailed(result); diff --git a/src/lib/arch/win32/ArchMiscWindows.h b/src/lib/arch/win32/ArchMiscWindows.h index 23c3f621e..27b3257ab 100644 --- a/src/lib/arch/win32/ArchMiscWindows.h +++ b/src/lib/arch/win32/ArchMiscWindows.h @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2026 Deskflow Developers * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd. * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception @@ -46,12 +47,6 @@ public: */ static int runDaemon(RunFunc runFunc); - //! Indicate daemon is in main loop - /*! - Delegates to ArchDaemonWindows. - */ - static void daemonRunning(bool running); - //! Indicate failure of running daemon /*! Delegates to ArchDaemonWindows. diff --git a/src/lib/deskflow/App.h b/src/lib/deskflow/App.h index 9fbee9afd..5a310a1d9 100644 --- a/src/lib/deskflow/App.h +++ b/src/lib/deskflow/App.h @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2026 Deskflow Developers * SPDX-FileCopyrightText: (C) 2012 - 2025 Symless Ltd. * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception @@ -118,12 +119,6 @@ private: QString m_pname; }; -#if WINAPI_MSWINDOWS -#define DAEMON_RUNNING(running_) ArchMiscWindows::daemonRunning(running_) -#else -#define DAEMON_RUNNING(running_) -#endif - #if !defined(WINAPI_LIBEI) && WINAPI_XWINDOWS constexpr static auto s_helpNoWayland = // "\nYour Linux distribution does not support Wayland EI (emulated input)\n" diff --git a/src/lib/deskflow/ClientApp.cpp b/src/lib/deskflow/ClientApp.cpp index 8c630a173..200a1e2d2 100644 --- a/src/lib/deskflow/ClientApp.cpp +++ b/src/lib/deskflow/ClientApp.cpp @@ -1,6 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers + * SPDX-FileCopyrightText: (C) 2025 - 2026 Deskflow Developers * SPDX-FileCopyrightText: (C) 2012 Symless Ltd. * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception @@ -23,7 +23,7 @@ #include "net/TCPSocketFactory.h" #if SYSAPI_WIN32 -#include "arch/win32/ArchMiscWindows.h" +#include "arch/win32/ArchDaemonWindows.h" #endif #if WINAPI_MSWINDOWS @@ -306,7 +306,9 @@ int ClientApp::mainLoop() // run event loop. if startClient() failed we're supposed to retry // later. the timer installed by startClient() will take care of // that. - DAEMON_RUNNING(true); +#if SYSAPI_WIN32 + ArchDaemonWindows::daemonRunning(true); +#endif #if WINAPI_CARBON @@ -321,7 +323,9 @@ int ClientApp::mainLoop() getEvents()->loop(); #endif - DAEMON_RUNNING(false); +#if SYSAPI_WIN32 + ArchDaemonWindows::daemonRunning(false); +#endif // close down LOG_DEBUG1("stopping client"); diff --git a/src/lib/deskflow/DaemonApp.cpp b/src/lib/deskflow/DaemonApp.cpp index 7259e23b0..750b35259 100644 --- a/src/lib/deskflow/DaemonApp.cpp +++ b/src/lib/deskflow/DaemonApp.cpp @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2026 Deskflow Developers * SPDX-FileCopyrightText: (C) 2012 - 2025 Symless Ltd. * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception */ @@ -12,7 +13,6 @@ #include "base/LogOutputters.h" #include "common/ExitCodes.h" #include "common/Settings.h" -#include "deskflow/App.h" #include "deskflow/ipc/DaemonIpcServer.h" #if SYSAPI_WIN32 @@ -177,10 +177,9 @@ int DaemonApp::mainLoop() LOG_ERR("watchdog not initialized"); return s_exitFailed; } + ArchDaemonWindows::daemonRunning(true); #endif - DAEMON_RUNNING(true); - try { #if SYSAPI_WIN32 // Install the platform event queue to handle service stop events. @@ -211,9 +210,9 @@ int DaemonApp::mainLoop() } catch (...) { // NOSONAR - Catching remaining exceptions LOG_CRIT("daemon stop watchdog unknown error"); } + ArchDaemonWindows::daemonRunning(false); #endif - DAEMON_RUNNING(false); return s_exitSuccess; } diff --git a/src/lib/deskflow/ServerApp.cpp b/src/lib/deskflow/ServerApp.cpp index 405da2482..f57f0abbf 100644 --- a/src/lib/deskflow/ServerApp.cpp +++ b/src/lib/deskflow/ServerApp.cpp @@ -1,6 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers + * SPDX-FileCopyrightText: (C) 2025 - 2026 Deskflow Developers * SPDX-FileCopyrightText: (C) 2012 Symless Ltd. * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception @@ -31,7 +31,7 @@ #include #if SYSAPI_WIN32 -#include "arch/win32/ArchMiscWindows.h" +#include "arch/win32/ArchDaemonWindows.h" #endif #if WINAPI_MSWINDOWS @@ -556,7 +556,9 @@ int ServerApp::mainLoop() // run event loop. if startServer() failed we're supposed to retry // later. the timer installed by startServer() will take care of // that. - DAEMON_RUNNING(true); +#if SYSAPI_WIN32 + ArchDaemonWindows::daemonRunning(true); +#endif #if WINAPI_CARBON @@ -571,7 +573,9 @@ int ServerApp::mainLoop() getEvents()->loop(); #endif - DAEMON_RUNNING(false); +#if SYSAPI_WIN32 + ArchDaemonWindows::daemonRunning(false); +#endif // close down LOG_DEBUG1("stopping server");