From c09c5b61a8fc8c3210755752fef873a735a197d0 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 6 May 2023 02:23:41 +0400 Subject: [PATCH] Get rid of DESKTOP_APP_DISABLE_DBUS_INTEGRATION Desktop App Toolkit uses GLib as the D-Bus library for quite long time, but GLib is not only a D-Bus library, it's more a basic library providing native Linux APIs implementing various specs. The situation right now is that DESKTOP_APP_DISABLE_DBUS_INTEGRATION disables not only D-Bus code but all the native API integration such as MIME handling or .desktop file parsing. In other words, the option disables native Linux APIs on Linux what is absurd and doesn't have any sense. --- external/CMakeLists.txt | 4 ++-- external/kcoreaddons/CMakeLists.txt | 2 +- external/qt/package.cmake | 6 +----- external/qt/qt_static_plugins/CMakeLists.txt | 2 +- external/qt/qt_static_plugins/qt_static_plugins.cpp | 8 ++++---- options.cmake | 7 ------- variables.cmake | 1 - 7 files changed, 9 insertions(+), 21 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 9be0e5a..563732f 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -21,14 +21,14 @@ if (LINUX) add_checked_subdirectory(dispatch) endif() add_checked_subdirectory(expected) -if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) +if (LINUX AND TARGET Qt::DBus) add_checked_subdirectory(fcitx_qt5) if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) add_checked_subdirectory(fcitx5_qt) endif() endif() add_checked_subdirectory(ffmpeg) -if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) +if (LINUX) add_checked_subdirectory(glib) add_checked_subdirectory(glibmm) endif() diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt index 07514e9..dcf4da9 100644 --- a/external/kcoreaddons/CMakeLists.txt +++ b/external/kcoreaddons/CMakeLists.txt @@ -47,7 +47,7 @@ if (NOT LINUX) ) endif() -if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) +if (TARGET Qt::DBus) set_source_files_properties(${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml PROPERTIES INCLUDE ${kcoreaddons_src}/io/dbustypes_p.h) qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml org.freedesktop.portal.FileTransfer) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 7e56ab3..4c30efd 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -51,11 +51,7 @@ if (LINUX) find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS WaylandCompositor QUIET) endif() - if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED) - elseif (NOT DESKTOP_APP_USE_PACKAGED) - find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus QUIET) - endif() + find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus QUIET) endif() set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "(gen)") diff --git a/external/qt/qt_static_plugins/CMakeLists.txt b/external/qt/qt_static_plugins/CMakeLists.txt index ce2fa82..a1dd245 100644 --- a/external/qt/qt_static_plugins/CMakeLists.txt +++ b/external/qt/qt_static_plugins/CMakeLists.txt @@ -25,7 +25,7 @@ if (LINUX) desktop-app::external_nimf_qt5 ) - if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) + if (TARGET Qt::DBus) target_link_libraries(external_qt_static_plugins PUBLIC desktop-app::external_fcitx_qt5 diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index c78d931..4f8abdd 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -34,14 +34,14 @@ Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) Q_IMPORT_PLUGIN(QXcbEglIntegrationPlugin) Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) Q_IMPORT_PLUGIN(QSvgIconPlugin) -#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#ifdef QT_DBUS_LIB #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) Q_IMPORT_PLUGIN(QConnmanEnginePlugin) Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) #endif // Qt < 6.0.0 Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin) -#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#endif // QT_DBUS_LIB #ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin) @@ -62,12 +62,12 @@ Q_IMPORT_PLUGIN(QJpegXLPlugin) #if defined Q_OS_UNIX && !defined Q_OS_MAC Q_IMPORT_PLUGIN(NimfInputContextPlugin) -#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#ifdef QT_DBUS_LIB Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION -#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#endif // QT_DBUS_LIB #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION diff --git a/options.cmake b/options.cmake index c1dcbea..91f5eff 100644 --- a/options.cmake +++ b/options.cmake @@ -23,13 +23,6 @@ if (DESKTOP_APP_DISABLE_CRASH_REPORTS) ) endif() -if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_DISABLE_DBUS_INTEGRATION - ) -endif() - if (DESKTOP_APP_DISABLE_X11_INTEGRATION) target_compile_definitions(common_options INTERFACE diff --git a/variables.cmake b/variables.cmake index 91b7027..fd9aabf 100644 --- a/variables.cmake +++ b/variables.cmake @@ -20,7 +20,6 @@ if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "" endif() option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON) -cmake_dependent_option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration." OFF LINUX ON) cmake_dependent_option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration." OFF LINUX ON) cmake_dependent_option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer." OFF LINUX OFF) cmake_dependent_option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages." OFF LINUX OFF)