Link XCB always if X11 support is on

This commit is contained in:
Nicolas Werner 2023-06-03 02:45:38 +02:00
parent 3b4daca53e
commit 7029547647
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
3 changed files with 18 additions and 9 deletions

View file

@ -72,7 +72,11 @@ if (APPLE OR WIN32)
set(VOIP_DEFAULT OFF) set(VOIP_DEFAULT OFF)
endif() endif()
option(VOIP "Whether to enable voip support. Disable this, if you don't have gstreamer." ${VOIP_DEFAULT}) 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) 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") list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
@ -615,9 +619,10 @@ endif()
if (VOIP) if (VOIP)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18) 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) endif()
if (X11 AND NOT WIN32 AND NOT APPLE AND NOT HAIKU)
pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb xcb-ewmh) pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb xcb-ewmh)
endif()
endif() endif()
# single instance functionality # single instance functionality
@ -767,10 +772,10 @@ endif()
if (TARGET PkgConfig::GSTREAMER) if (TARGET PkgConfig::GSTREAMER)
target_link_libraries(nheko PRIVATE PkgConfig::GSTREAMER) target_link_libraries(nheko PRIVATE PkgConfig::GSTREAMER)
target_compile_definitions(nheko PRIVATE GSTREAMER_AVAILABLE) target_compile_definitions(nheko PRIVATE GSTREAMER_AVAILABLE)
if (TARGET PkgConfig::XCB) endif()
if (TARGET PkgConfig::XCB)
target_link_libraries(nheko PRIVATE PkgConfig::XCB) target_link_libraries(nheko PRIVATE PkgConfig::XCB)
target_compile_definitions(nheko PRIVATE XCB_AVAILABLE) target_compile_definitions(nheko PRIVATE XCB_AVAILABLE)
endif()
endif() endif()
if(MSVC) if(MSVC)

View file

@ -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 - Voice call support: dtls, opus, rtpmanager, srtp, webrtc
- Video call support (optional): compositor, opengl, qmlgl, rtp, vpx - Video call support (optional): compositor, opengl, qmlgl, rtp, vpx
- [libnice](https://gitlab.freedesktop.org/libnice/libnice) - [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`.) - [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: - A compiler that supports C++ 20:
- Clang 16 (Only clazy 16 is tested in CI) - Clang 16 (Only clazy 16 is tested in CI)

View file

@ -18,7 +18,9 @@
#include "Utils.h" #include "Utils.h"
#include "voip/WebRTCSession.h" #include "voip/WebRTCSession.h"
#if XCB_AVAILABLE
#include <xcb/xproto.h> #include <xcb/xproto.h>
#endif
Nheko::Nheko() Nheko::Nheko()
{ {
@ -184,6 +186,7 @@ Nheko::createRoom(bool space,
void void
Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString newRole) const Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString newRole) const
{ {
#if XCB_AVAILABLE
const QNativeInterface::QX11Application *x11Interface = const QNativeInterface::QX11Application *x11Interface =
qGuiApp->nativeInterface<QNativeInterface::QX11Application>(); qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
@ -208,4 +211,5 @@ Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString new
8, 8,
role.size(), role.size(),
role.data()); role.data());
#endif
} }