refactor: platform/wayland move consts kHasEI etc into wayland Warnings
This commit is contained in:
parent
0a67f63af6
commit
c18e3c9ef2
3 changed files with 24 additions and 29 deletions
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* 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<Settings::CoreMode>();
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
|
|
@ -8,8 +9,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue