From 2747cd4c451c8b8badf0a4b109cb98b8e71341ec Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Mon, 28 Oct 2024 12:12:07 +0100 Subject: [PATCH] Add WITH_X11 option to re-enable X11 code after runtime cleanup Amends 0de5e18195acb3145c54d6a59dd6c1fd6ba35e97 See also https://invent.kde.org/frameworks/kglobalaccel/-/merge_requests/96#note_814139 Signed-off-by: Andreas Sturmlechner --- CMakeLists.txt | 6 +----- src/CMakeLists.txt | 2 +- src/config-kglobalaccel.h.cmake | 4 ++-- src/kglobalaccel.cpp | 6 +++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ac86063..2b3aaeab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,11 +42,7 @@ ecm_setup_version(PROJECT VARIABLE_PREFIX KGLOBALACCEL set(REQUIRED_QT_VERSION 6.5.0) find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus Gui Widgets) -set(HAVE_X11 0) - -if(X11_FOUND AND XCB_XCB_FOUND) - set(HAVE_X11 1) -endif() +option(WITH_X11 "Build with X11 support" ON) ecm_set_disabled_deprecation_versions( QT 6.5.0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c81b3ac5..554c4aad 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,7 +47,7 @@ PUBLIC Qt6::Widgets ) -if(HAVE_X11) +if(WITH_X11) target_link_libraries(KF6GlobalAccel PRIVATE Qt6::GuiPrivate) # qtx11extras_p.h endif() diff --git a/src/config-kglobalaccel.h.cmake b/src/config-kglobalaccel.h.cmake index 1d3f01ca..034db6a5 100644 --- a/src/config-kglobalaccel.h.cmake +++ b/src/config-kglobalaccel.h.cmake @@ -1,4 +1,4 @@ /* config-kglobalaccel.h. Generated by cmake from config-kglobalaccel.h.cmake */ -/* Define to 1 if you have the Xlib */ -#cmakedefine01 HAVE_X11 +/* Define to 1 if cmake option selected for Qt6::GuiPrivate */ +#cmakedefine01 WITH_X11 diff --git a/src/kglobalaccel.cpp b/src/kglobalaccel.cpp index d5b1e91b..21ab9920 100644 --- a/src/kglobalaccel.cpp +++ b/src/kglobalaccel.cpp @@ -22,7 +22,7 @@ #include #include -#if HAVE_X11 +#if WITH_X11 #include #endif @@ -403,7 +403,7 @@ QString KGlobalAccelPrivate::componentFriendlyForAction(const QAction *action) return QCoreApplication::applicationName(); } -#if HAVE_X11 +#if WITH_X11 int timestampCompare(unsigned long time1_, unsigned long time2_) // like strcmp() { quint32 time1 = time1_; @@ -442,7 +442,7 @@ void KGlobalAccelPrivate::invokeAction(const QString &componentUnique, const QSt return; } -#if HAVE_X11 +#if WITH_X11 // Update this application's X timestamp if needed. // TODO The 100%-correct solution should probably be handling this action // in the proper place in relation to the X events queue in order to avoid -- GitLab