summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-06-03 02:45:38 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-06-08 22:32:12 +0200
commit7029547647d2d66596b8bb4307500376edad11a9 (patch)
tree0c3d85c14eef98048041dd57a5513a7490879c9f
parentRemove WinMain (diff)
downloadnheko-7029547647d2d66596b8bb4307500376edad11a9.tar.xz
Link XCB always if X11 support is on
-rw-r--r--CMakeLists.txt21
-rw-r--r--README.md2
-rw-r--r--src/ui/NhekoGlobalObject.cpp4
3 files changed, 18 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb75f1ac..f0aecc8e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,7 +72,11 @@ if (APPLE OR WIN32)
 	set(VOIP_DEFAULT OFF)
 endif()
 option(VOIP "Whether to enable voip support. Disable this, if you don't have gstreamer." ${VOIP_DEFAULT})
-cmake_dependent_option(SCREENSHARE_X11 "Whether to enable screenshare support on X11." ON "VOIP" OFF)
+set(X11_DEFAULT)
+if (WIN32 OR APPLE OR HAIKU)
+	set(X11_DEFAULT OFF)
+endif()
+option(X11 "Whether to enable X11 specific features (screenshare, window roles)." ${X11_DEFAULT})
 cmake_dependent_option(SCREENSHARE_XDP "Whether to enable screenshare support using xdg-desktop-portal." ON "VOIP" OFF)
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
@@ -615,9 +619,10 @@ endif()
 if (VOIP)
 	include(FindPkgConfig)
 	pkg_check_modules(GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18)
-	if (SCREENSHARE_X11 AND NOT WIN32 AND NOT APPLE)
-		pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb xcb-ewmh)
-	endif()
+endif()
+
+if (X11 AND NOT WIN32 AND NOT APPLE AND NOT HAIKU)
+	pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb xcb-ewmh)
 endif()
 
 # single instance functionality
@@ -767,10 +772,10 @@ endif()
 if (TARGET PkgConfig::GSTREAMER)
 	target_link_libraries(nheko PRIVATE PkgConfig::GSTREAMER)
 	target_compile_definitions(nheko PRIVATE GSTREAMER_AVAILABLE)
-	if (TARGET PkgConfig::XCB)
-		target_link_libraries(nheko PRIVATE PkgConfig::XCB)
-		target_compile_definitions(nheko PRIVATE XCB_AVAILABLE)
-	endif()
+endif()
+if (TARGET PkgConfig::XCB)
+	target_link_libraries(nheko PRIVATE PkgConfig::XCB)
+	target_compile_definitions(nheko PRIVATE XCB_AVAILABLE)
 endif()
 
 if(MSVC)
diff --git a/README.md b/README.md
index 46e6b9a2..73f8587d 100644
--- a/README.md
+++ b/README.md
@@ -249,7 +249,7 @@ KDE has similar plugins, that can extend the supported image types even more.
     - Voice call support: dtls, opus, rtpmanager, srtp, webrtc
     - Video call support (optional): compositor, opengl, qmlgl, rtp, vpx
     - [libnice](https://gitlab.freedesktop.org/libnice/libnice)
-- XCB, XCB-EWMH: For screensharing support on X11. VOIP needs to be enabled. Can be disabled with `-DSCREENSHARE_X11=OFF`.
+- XCB, XCB-EWMH: For screensharing support on X11 and setting window roles. Can be disabled with `-DSCREENSHARE_X11=OFF`.
 - [qtkeychain](https://github.com/frankosterfeld/qtkeychain) (You need at least version 0.12 for proper Gnome Keychain support. The bundled version requires libsecret, unless you pass `-DLIBSECRET_SUPPORT=OFF`.)
 - A compiler that supports C++ 20:
     - Clang 16 (Only clazy 16 is tested in CI)
diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp
index 0bdb45f4..1bab73b5 100644
--- a/src/ui/NhekoGlobalObject.cpp
+++ b/src/ui/NhekoGlobalObject.cpp
@@ -18,7 +18,9 @@
 #include "Utils.h"
 #include "voip/WebRTCSession.h"
 
+#if XCB_AVAILABLE
 #include <xcb/xproto.h>
+#endif
 
 Nheko::Nheko()
 {
@@ -184,6 +186,7 @@ Nheko::createRoom(bool space,
 void
 Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString newRole) const
 {
+#if XCB_AVAILABLE
     const QNativeInterface::QX11Application *x11Interface =
       qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
 
@@ -208,4 +211,5 @@ Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString new
                         8,
                         role.size(),
                         role.data());
+#endif
 }