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
|
* Deskflow -- mouse and keyboard sharing utility
|
||||||
|
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||||
* SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
|
* SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
|
||||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,16 +10,14 @@
|
||||||
#include "Messages.h"
|
#include "Messages.h"
|
||||||
#include "common/Settings.h"
|
#include "common/Settings.h"
|
||||||
|
|
||||||
using namespace deskflow::platform;
|
|
||||||
|
|
||||||
namespace deskflow::gui::core {
|
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 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) {
|
if (!m_errorShown) {
|
||||||
m_errorShown = true;
|
m_errorShown = true;
|
||||||
messages::showWaylandLibraryError(parent);
|
messages::showWaylandLibraryError(parent);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Deskflow -- mouse and keyboard sharing utility
|
* Deskflow -- mouse and keyboard sharing utility
|
||||||
|
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||||
* SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
|
* SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
|
||||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||||
*/
|
*/
|
||||||
|
|
@ -8,8 +9,6 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "platform/Wayland.h"
|
|
||||||
|
|
||||||
namespace deskflow::gui::core {
|
namespace deskflow::gui::core {
|
||||||
|
|
||||||
class WaylandWarnings
|
class WaylandWarnings
|
||||||
|
|
@ -17,13 +16,28 @@ class WaylandWarnings
|
||||||
public:
|
public:
|
||||||
explicit WaylandWarnings() = default;
|
explicit WaylandWarnings() = default;
|
||||||
|
|
||||||
void showOnce(
|
void showOnce(QWidget *parent);
|
||||||
QWidget *parent, bool hasEi = platform::kHasEi, bool hasPortal = platform::kHasPortal,
|
|
||||||
bool hasPortalInputCapture = platform::kHasPortalInputCapture
|
|
||||||
);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_errorShown{false};
|
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
|
} // namespace deskflow::gui::core
|
||||||
|
|
|
||||||
|
|
@ -11,24 +11,6 @@
|
||||||
|
|
||||||
namespace deskflow::platform {
|
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()
|
inline bool isWayland()
|
||||||
{
|
{
|
||||||
return qEnvironmentVariable("XDG_SESSION_TYPE") == QStringLiteral("wayland");
|
return qEnvironmentVariable("XDG_SESSION_TYPE") == QStringLiteral("wayland");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue