diff --git a/src/lib/gui/core/WaylandWarnings.cpp b/src/lib/gui/core/WaylandWarnings.cpp index 3e106414c..2c98ecb5a 100644 --- a/src/lib/gui/core/WaylandWarnings.cpp +++ b/src/lib/gui/core/WaylandWarnings.cpp @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello * SPDX-FileCopyrightText: (C) 2024 Symless Ltd. * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception */ @@ -9,16 +10,14 @@ #include "Messages.h" #include "common/Settings.h" -using namespace deskflow::platform; - namespace deskflow::gui::core { -void WaylandWarnings::showOnce(QWidget *parent, bool hasEi, bool hasPortal, bool hasPortalInputCapture) +void WaylandWarnings::showOnce(QWidget *parent) { const auto mode = Settings::value(Settings::Core::CoreMode).value(); - const bool portalIcProblem = !hasPortalInputCapture && mode == Settings::CoreMode::Server; + const bool portalIcProblem = !m_hasPortalInputCapture && mode == Settings::CoreMode::Server; - if (!hasEi || !hasPortal || portalIcProblem) { + if (!m_hasEi || !m_hasPortal || portalIcProblem) { if (!m_errorShown) { m_errorShown = true; messages::showWaylandLibraryError(parent); diff --git a/src/lib/gui/core/WaylandWarnings.h b/src/lib/gui/core/WaylandWarnings.h index 9aa5ce982..c501b4726 100644 --- a/src/lib/gui/core/WaylandWarnings.h +++ b/src/lib/gui/core/WaylandWarnings.h @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello * SPDX-FileCopyrightText: (C) 2024 Symless Ltd. * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception */ @@ -8,8 +9,6 @@ #include -#include "platform/Wayland.h" - namespace deskflow::gui::core { class WaylandWarnings @@ -17,13 +16,28 @@ class WaylandWarnings public: explicit WaylandWarnings() = default; - void showOnce( - QWidget *parent, bool hasEi = platform::kHasEi, bool hasPortal = platform::kHasPortal, - bool hasPortalInputCapture = platform::kHasPortalInputCapture - ); + void showOnce(QWidget *parent); private: bool m_errorShown{false}; + +#if WINAPI_LIBEI + const bool m_hasEi = true; +#else + const bool m_hasEi = false; +#endif + +#if WINAPI_LIBPORTAL + const bool m_hasPortal = true; +#else + const bool m_hasPortal = false; +#endif + +#if HAVE_LIBPORTAL_INPUTCAPTURE + const bool m_hasPortalInputCapture = true; +#else + const bool m_hasPortalInputCapture = false; +#endif }; } // namespace deskflow::gui::core diff --git a/src/lib/platform/Wayland.h b/src/lib/platform/Wayland.h index 2b1dbf1c4..8aadcae91 100644 --- a/src/lib/platform/Wayland.h +++ b/src/lib/platform/Wayland.h @@ -11,24 +11,6 @@ namespace deskflow::platform { -#if WINAPI_LIBEI -const auto kHasEi = true; -#else -const auto kHasEi = false; -#endif - -#if WINAPI_LIBPORTAL -const auto kHasPortal = true; -#else -const auto kHasPortal = false; -#endif - -#if HAVE_LIBPORTAL_INPUTCAPTURE -const auto kHasPortalInputCapture = true; -#else -const auto kHasPortalInputCapture = false; -#endif - inline bool isWayland() { return qEnvironmentVariable("XDG_SESSION_TYPE") == QStringLiteral("wayland");