diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ option(DESKTOP_ENABLED "Build and install The Desktop style" ON) option(STATIC_LIBRARY "Build as a static library (deprecated, use BUILD_SHARED_LIBS instead)" OFF) option(BUILD_EXAMPLES "Build and install examples" OFF) +option(DISABLE_DBUS "Build without D-Bus support" OFF) if(NOT BUILD_SHARED_LIBS) set(STATIC_LIBRARY 1) @@ -100,8 +101,9 @@ ) #use dbus on linux, bsd etc, but not andoid and apple stuff -if (UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT(APPLE)) +if (UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT(APPLE) AND NOT(DISABLE_DBUS)) find_package(Qt5DBus) + add_definitions(-DKIRIGAMI_ENABLE_DBUS) endif() if(BUILD_EXAMPLES AND CMAKE_SYSTEM_NAME STREQUAL "Android") diff --git a/src/libkirigami/CMakeLists.txt b/src/libkirigami/CMakeLists.txt --- a/src/libkirigami/CMakeLists.txt +++ b/src/libkirigami/CMakeLists.txt @@ -8,7 +8,7 @@ ) #use dbus on linux, bsd etc, but not andoid and apple stuff -if (UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT(APPLE)) +if (UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT(APPLE) AND NOT(DISABLE_DBUS)) qt5_add_dbus_interface(libkirigami_SRCS org.kde.KWin.TabletModeManager.xml tabletmodemanager_interface) set(LIBKIRIGAMKI_EXTRA_LIBS Qt5::DBus) endif() diff --git a/src/libkirigami/tabletmodewatcher.cpp b/src/libkirigami/tabletmodewatcher.cpp --- a/src/libkirigami/tabletmodewatcher.cpp +++ b/src/libkirigami/tabletmodewatcher.cpp @@ -21,7 +21,7 @@ #include "tabletmodewatcher.h" -#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(Q_OS_MACOS) +#if defined(KIRIGAMI_ENABLE_DBUS) #include "tabletmodemanager_interface.h" #include #endif @@ -45,13 +45,11 @@ TabletModeWatcherPrivate(TabletModeWatcher *watcher) : q(watcher) { -#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) + +#if !defined(KIRIGAMI_ENABLE_DBUS) && (defined(Q_OS_ANDROID) || defined(Q_OS_IOS)) isTabletModeAvailable = true; isTabletMode = true; -#elif defined(Q_OS_MACOS) - isTabletModeAvailable = false; - isTabletMode = false; -#elif defined(Q_OS_LINUX) || defined(Q_OS_UNIX) +#elif defined(KIRIGAMI_ENABLE_DBUS) //Mostly for debug purposes and for platforms which are always mobile, //such as Plasma Mobile if (qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MOBILE") || @@ -92,7 +90,7 @@ void setIsTablet(bool tablet); TabletModeWatcher *q; -#if (defined(Q_OS_LINUX) || defined(Q_OS_UNIX)) && !defined(Q_OS_ANDROID) && !defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if defined(KIRIGAMI_ENABLE_DBUS) OrgKdeKWinTabletModeManagerInterface *m_interface = nullptr; #endif bool isTabletModeAvailable = false;