From 7682e17afe57ad8fa892a2f43ee5b229144d17a1 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Tue, 30 Dec 2025 11:29:12 -0500 Subject: [PATCH] refactor: Move src/lib/Config => src/lib/platform/XWindowsConfig This file is used only in XWindows related platform code. --- cmake/Libraries.cmake | 8 +------- src/lib/gui/MainWindow.cpp | 4 ---- src/lib/platform/CMakeLists.txt | 2 ++ .../XWindowsConfig.h.in} | 16 +++++++--------- src/lib/platform/XWindowsKeyState.h | 2 +- src/lib/platform/XWindowsScreen.cpp | 3 +-- src/lib/platform/XWindowsScreen.h | 3 +-- src/lib/platform/XWindowsScreenSaver.cpp | 3 +-- 8 files changed, 14 insertions(+), 27 deletions(-) rename src/lib/{Config.h.in => platform/XWindowsConfig.h.in} (61%) diff --git a/cmake/Libraries.cmake b/cmake/Libraries.cmake index cc045fa79..65dcdb572 100644 --- a/cmake/Libraries.cmake +++ b/cmake/Libraries.cmake @@ -164,13 +164,7 @@ macro(configure_unix_libs) endif() endif() - # Unix only: For config.h, save the results based on a template (config.h.in). - # Note that this won't work on Windows because filenames are not case sensitive, - # and we have header files named "Config.h" (upper case 'C'). - configure_file(${CMAKE_SOURCE_DIR}/src/lib/Config.h.in - ${CMAKE_BINARY_DIR}/src/lib/Config.h @ONLY) - - add_definitions(-DSYSAPI_UNIX=1 -DHAVE_CONFIG_H) + add_definitions(-DSYSAPI_UNIX=1) endmacro() diff --git a/src/lib/gui/MainWindow.cpp b/src/lib/gui/MainWindow.cpp index 0fcd03084..8167dfa3d 100644 --- a/src/lib/gui/MainWindow.cpp +++ b/src/lib/gui/MainWindow.cpp @@ -28,10 +28,6 @@ #include "gui/widgets/LogDock.h" #include "net/FingerprintDatabase.h" -#if defined(Q_OS_LINUX) -#include "Config.h" -#endif - #include #include #include diff --git a/src/lib/platform/CMakeLists.txt b/src/lib/platform/CMakeLists.txt index 0d0efe6ce..46f65c2cf 100644 --- a/src/lib/platform/CMakeLists.txt +++ b/src/lib/platform/CMakeLists.txt @@ -101,6 +101,7 @@ elseif(UNIX) XDGKeyUtil.cpp ) if (BUILD_X11_SUPPORT) + configure_file(XWindowsConfig.h.in XWindowsConfig.h @ONLY) list(APPEND PLATFORM_SOURCES XWindowsClipboard.cpp XWindowsClipboard.h @@ -126,6 +127,7 @@ elseif(UNIX) XWindowsScreenSaver.h XWindowsUtil.cpp XWindowsUtil.h + ${CMAKE_CURRENT_BINARY_DIR}/XWindowsConfig.h ) endif() diff --git a/src/lib/Config.h.in b/src/lib/platform/XWindowsConfig.h.in similarity index 61% rename from src/lib/Config.h.in rename to src/lib/platform/XWindowsConfig.h.in index 7197fe893..f795ad849 100644 --- a/src/lib/Config.h.in +++ b/src/lib/platform/XWindowsConfig.h.in @@ -5,24 +5,22 @@ * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception */ -// clang-format off +#pragma once /* Define to 1 if you have the header file. */ -#cmakedefine HAVE_X11_EXTENSIONS_XRANDR_H @HAVE_X11_EXTENSIONS_XRANDR_H@ +#define HAVE_X11_EXTENSIONS_XRANDR_H @HAVE_X11_EXTENSIONS_XRANDR_H@ /* Define to 1 if you have the header file. */ -#cmakedefine HAVE_X11_EXTENSIONS_DPMS_H @HAVE_X11_EXTENSIONS_DPMS_H@ +#define HAVE_X11_EXTENSIONS_DPMS_H @HAVE_X11_EXTENSIONS_DPMS_H@ /* Define to 1 if you have the header file. */ -#cmakedefine HAVE_X11_EXTENSIONS_XINERAMA_H @HAVE_X11_EXTENSIONS_XINERAMA_H@ +#define HAVE_X11_EXTENSIONS_XINERAMA_H @HAVE_X11_EXTENSIONS_XINERAMA_H@ /* Define to 1 if you have the header file. */ -#cmakedefine HAVE_X11_EXTENSIONS_XTEST_H @HAVE_X11_EXTENSIONS_XTEST_H@ +#define HAVE_X11_EXTENSIONS_XTEST_H @HAVE_X11_EXTENSIONS_XTEST_H@ /* Define to 1 if you have the header file. */ -#cmakedefine HAVE_XI2 @HAVE_XI2@ +#define HAVE_XI2 @HAVE_XI2@ /* Define this if the XKB extension is available. */ -#cmakedefine HAVE_XKB_EXTENSION @HAVE_XKB_EXTENSION@ - -// clang-format on +#define HAVE_XKB_EXTENSION @HAVE_XKB_EXTENSION@ diff --git a/src/lib/platform/XWindowsKeyState.h b/src/lib/platform/XWindowsKeyState.h index b777f59e6..c36853cf7 100644 --- a/src/lib/platform/XWindowsKeyState.h +++ b/src/lib/platform/XWindowsKeyState.h @@ -7,8 +7,8 @@ #pragma once -#include "Config.h" #include "deskflow/KeyState.h" +#include "platform/XWindowsConfig.h" #include #include diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index e544ae930..c57ebf847 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -21,13 +21,12 @@ #include "deskflow/ScreenException.h" #include "platform/XDGKeyUtil.h" #include "platform/XWindowsClipboard.h" +#include "platform/XWindowsConfig.h" #include "platform/XWindowsEventQueueBuffer.h" #include "platform/XWindowsKeyState.h" #include "platform/XWindowsScreenSaver.h" #include "platform/XWindowsUtil.h" -#include "Config.h" - #include #include #include diff --git a/src/lib/platform/XWindowsScreen.h b/src/lib/platform/XWindowsScreen.h index 72f8f0317..4c436028e 100644 --- a/src/lib/platform/XWindowsScreen.h +++ b/src/lib/platform/XWindowsScreen.h @@ -11,8 +11,7 @@ #include "deskflow/KeyMap.h" #include "deskflow/PlatformScreen.h" #include "platform/XDGPowerManager.h" - -#include "Config.h" +#include "platform/XWindowsConfig.h" #include #include diff --git a/src/lib/platform/XWindowsScreenSaver.cpp b/src/lib/platform/XWindowsScreenSaver.cpp index 4211e3a6a..32c1f4a3b 100644 --- a/src/lib/platform/XWindowsScreenSaver.cpp +++ b/src/lib/platform/XWindowsScreenSaver.cpp @@ -12,10 +12,9 @@ #include "base/Event.h" #include "base/IEventQueue.h" +#include "platform/XWindowsConfig.h" #include "platform/XWindowsUtil.h" -#include "Config.h" - #include #if HAVE_X11_EXTENSIONS_XTEST_H #include