From ac36e123ec4cb1fe5bd58fca41a62712acbc516f Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 10 Jun 2023 22:04:39 +0300 Subject: [PATCH] generic: remove redundant X11 checks and headers inclusions Signed-off-by: Ivailo Monev --- CMakeLists.txt | 42 +++++++++++++++++--------------------- plasma/CMakeLists.txt | 4 +--- plasma/dialog.cpp | 7 ------- plasma/popupapplet.cpp | 4 ---- plasma/private/tooltip.cpp | 4 ---- plasma/theme.cpp | 1 - 6 files changed, 20 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e20f0fb7..19361290 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,13 +35,15 @@ set(LIBRARY_TYPE SHARED) find_package(KDE4Internal REQUIRED) include(KDE4Defaults) -if(UNIX AND Q_WS_X11) - #X11 Session Management (SM) is required - #X11_SM_FOUND is set in FindX11, which is required by KDE4Internal - if(NOT X11_SM_FOUND) - message(FATAL_ERROR "\nThe X11 Session Management (SM) development package could not be found.\nPlease install libSM.\n") - endif(NOT X11_SM_FOUND) -endif(UNIX AND Q_WS_X11) +# X11 Session Management (SM) is required +# X11_SM_FOUND is set in FindX11, which is required by KDE4Internal +if(NOT X11_SM_FOUND) + message(FATAL_ERROR "\nThe X11 Session Management (SM) development package could not be found.\nPlease install libSM.\n") +endif(NOT X11_SM_FOUND) + +if(NOT X11_XSync_FOUND AND NOT X11_Xscreensaver_FOUND) + message(FATAL_ERROR "\nNeither the XSync (libXext) nor XScreensaver (libXss) development package was found.\nPlease install one of them (XSync is recommended)\n") +endif(NOT X11_XSync_FOUND AND NOT X11_Xscreensaver_FOUND) if(ENABLE_TESTING) set(CMAKE_THREAD_PREFER_PTHREAD TRUE) @@ -89,23 +91,17 @@ set_package_properties(CURL PROPERTIES ) # optional features -if(X11_FOUND) - kde4_bool_to_01(X11_XTest_FOUND HAVE_XTEST) - kde4_bool_to_01(X11_Xcursor_FOUND HAVE_XCURSOR) - kde4_bool_to_01(X11_Xfixes_FOUND HAVE_XFIXES) - kde4_bool_to_01(X11_Xscreensaver_FOUND HAVE_XSCREENSAVER) - kde4_bool_to_01(X11_XSync_FOUND HAVE_XSYNC) +kde4_bool_to_01(X11_XTest_FOUND HAVE_XTEST) +kde4_bool_to_01(X11_Xcursor_FOUND HAVE_XCURSOR) +kde4_bool_to_01(X11_Xfixes_FOUND HAVE_XFIXES) +kde4_bool_to_01(X11_Xscreensaver_FOUND HAVE_XSCREENSAVER) +kde4_bool_to_01(X11_XSync_FOUND HAVE_XSYNC) - add_feature_info("X Test Extension (libXTest)" HAVE_XTEST "Support for notfication restriction") - add_feature_info("X Cursor Extension (Xcursor)" HAVE_XCURSOR "Support for loading cursors depending on theme") - add_feature_info("X Fixes Extension (libXfixes)" HAVE_XFIXES "Support for damage/fixes cursor and window management") - add_feature_info("X Screensaver Extension (libXss)" HAVE_XSCREENSAVER "Support for KIdleTime (fallback mode)") - add_feature_info("X Sync Extension (libXext)" HAVE_XSYNC "Efficient operation of KIdleTime") - - if(NOT HAVE_XSYNC AND NOT HAVE_XSCREENSAVER) - message(FATAL_ERROR "\nNeither the XSync (libXext) nor XScreensaver (libXss) development package was found.\nPlease install one of them (XSync is recommended)\n") - endif(NOT HAVE_XSYNC AND NOT HAVE_XSCREENSAVER) -endif(X11_FOUND) +add_feature_info("X Test Extension (libXTest)" HAVE_XTEST "Support for notfication restriction") +add_feature_info("X Cursor Extension (Xcursor)" HAVE_XCURSOR "Support for loading cursors depending on theme") +add_feature_info("X Fixes Extension (libXfixes)" HAVE_XFIXES "Support for damage/fixes cursor and window management") +add_feature_info("X Screensaver Extension (libXss)" HAVE_XSCREENSAVER "Support for KIdleTime (fallback mode)") +add_feature_info("X Sync Extension (libXext)" HAVE_XSYNC "Efficient operation of KIdleTime") kde4_optional_find_package(MPV 0.23.0) set_package_properties(MPV PROPERTIES diff --git a/plasma/CMakeLists.txt b/plasma/CMakeLists.txt index cd683c70..dae0b8c1 100644 --- a/plasma/CMakeLists.txt +++ b/plasma/CMakeLists.txt @@ -155,9 +155,7 @@ target_link_libraries(plasma PUBLIC ${PLASMA_EXTRA_LIBS} ) -if(X11_FOUND) - target_link_libraries(plasma PRIVATE ${X11_LIBRARIES}) -endif(X11_FOUND) +target_link_libraries(plasma PRIVATE ${X11_LIBRARIES}) set_target_properties(plasma PROPERTIES VERSION ${GENERIC_LIB_VERSION} diff --git a/plasma/dialog.cpp b/plasma/dialog.cpp index a3271896..358f4b8f 100644 --- a/plasma/dialog.cpp +++ b/plasma/dialog.cpp @@ -25,9 +25,6 @@ #include #include -#ifdef Q_WS_X11 -#include -#endif #include #include #include @@ -53,10 +50,6 @@ #include "plasma/widgets/scrollwidget.h" #include "plasma/windoweffects.h" -#ifdef Q_WS_X11 -#include -#endif - namespace Plasma { diff --git a/plasma/popupapplet.cpp b/plasma/popupapplet.cpp index 7bcc9428..4cf5bc83 100644 --- a/plasma/popupapplet.cpp +++ b/plasma/popupapplet.cpp @@ -29,10 +29,6 @@ #include #include -#ifdef Q_WS_X11 -#include -#endif - #include #include #include diff --git a/plasma/private/tooltip.cpp b/plasma/private/tooltip.cpp index d9718fc3..7d78e9b1 100644 --- a/plasma/private/tooltip.cpp +++ b/plasma/private/tooltip.cpp @@ -31,10 +31,6 @@ #include #include #include -#ifdef Q_WS_X11 -#include -#include -#endif #include #include diff --git a/plasma/theme.cpp b/plasma/theme.cpp index a4e21375..c9117b86 100644 --- a/plasma/theme.cpp +++ b/plasma/theme.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include