From d6881718c9bcbeafa27fa69e1d73eb82b8e2728c Mon Sep 17 00:00:00 2001 From: Dom Rodriguez Date: Wed, 31 Jan 2024 23:47:27 +0000 Subject: [PATCH] fix(wayland-warn): Make Wayland warning a compile-time option Tweak the GUI startup warning regarding Wayland to be a compile-time flag. This is enabled by default, but can be disabled. Signed-off-by: Dom Rodriguez --- CMakeLists.txt | 6 ++++++ src/gui/src/main.cpp | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bf95446a..e216af3e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ option(INPUTLEAP_BUILD_TESTS "Build the tests" ON) option(INPUTLEAP_USE_EXTERNAL_GTEST "Use external installation of Google Test framework" OFF) option(INPUTLEAP_BUILD_X11 "Build with XWindows support" ON) option(INPUTLEAP_BUILD_LIBEI "Build with libei support" OFF) +option(INPUTLEAP_WAYLAND_WARN_USER "Warn upon GUI start about Wayland support" ON) set (CMAKE_EXPORT_COMPILE_COMMANDS ON) set (CMAKE_CXX_STANDARD 14) @@ -66,6 +67,11 @@ if (INPUTLEAP_BUILD_GUI) set(REQUIRED_QT_VERSION 6.2) endif() + if (INPUTLEAP_WAYLAND_WARN_USER) + add_definitions(-DINPUTLEAP_WAYLAND_WARN_USER=1) + set(INPUTLEAP_WAYLAND_WARN_USER 1) + endif() + find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS Core REQUIRED) get_target_property(qmake_executable Qt${QT_DEFAULT_MAJOR_VERSION}::qmake IMPORTED_LOCATION) get_filename_component(_qt_bin_dir "${qmake_executable}" DIRECTORY) diff --git a/src/gui/src/main.cpp b/src/gui/src/main.cpp index 09d48f0ff..44bc8eea1 100644 --- a/src/gui/src/main.cpp +++ b/src/gui/src/main.cpp @@ -62,7 +62,8 @@ void copy_qsettings(const QSettings &src, QSettings &dst) int main(int argc, char* argv[]) { -#if (defined(WINAPI_XWINDOWS) || \ +#if (defined(INPUTLEAP_WAYLAND_WARN_USER) && \ + defined(WINAPI_XWINDOWS) || \ (defined(HAVE_LIBPORTAL_INPUTCAPTURE) || \ defined(HAVE_LIBPORTAL_SESSION_CONNECT_TO_EIS))) const auto platformType = QGuiApplication::platformName();