Try to allow native window frame on Wayland for everyone
This commit is contained in:
parent
caff63f284
commit
f317f20ac8
5 changed files with 0 additions and 172 deletions
|
|
@ -107,9 +107,6 @@ PRIVATE
|
|||
ui/paint/blobs.h
|
||||
ui/paint/blobs_linear.cpp
|
||||
ui/paint/blobs_linear.h
|
||||
ui/platform/linux/ui_linux_wayland_integration.cpp
|
||||
ui/platform/linux/ui_linux_wayland_integration_dummy.cpp
|
||||
ui/platform/linux/ui_linux_wayland_integration.h
|
||||
ui/platform/linux/ui_window_linux.cpp
|
||||
ui/platform/linux/ui_window_linux.h
|
||||
ui/platform/linux/ui_window_title_linux.cpp
|
||||
|
|
@ -309,22 +306,6 @@ if (WIN32)
|
|||
nuget_add_winrt(lib_ui)
|
||||
endif()
|
||||
|
||||
if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
|
||||
remove_target_sources(lib_ui ${src_loc} ui/platform/linux/ui_linux_wayland_integration.cpp)
|
||||
elseif(LINUX)
|
||||
remove_target_sources(lib_ui ${src_loc} ui/platform/linux/ui_linux_wayland_integration_dummy.cpp)
|
||||
|
||||
qt_generate_wayland_protocol_client_sources(lib_ui
|
||||
FILES
|
||||
${third_party_loc}/wayland/protocol/wayland.xml
|
||||
)
|
||||
|
||||
target_link_libraries(lib_ui
|
||||
PUBLIC
|
||||
desktop-app::external_wayland_client
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(lib_ui
|
||||
PUBLIC
|
||||
${src_loc}
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "ui/platform/linux/ui_linux_wayland_integration.h"
|
||||
|
||||
#include "base/platform/linux/base_linux_wayland_utilities.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/qt_signal_producer.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QWindow>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include <qpa/qplatformwindow_p.h>
|
||||
#include <qwayland-wayland.h>
|
||||
|
||||
using namespace QNativeInterface;
|
||||
using namespace QNativeInterface::Private;
|
||||
using namespace base::Platform::Wayland;
|
||||
|
||||
namespace Ui {
|
||||
namespace Platform {
|
||||
|
||||
struct WaylandIntegration::Private : public AutoDestroyer<QtWayland::wl_registry> {
|
||||
std::optional<uint32_t> xdgDecoration;
|
||||
|
||||
protected:
|
||||
void registry_global(
|
||||
uint32_t name,
|
||||
const QString &interface,
|
||||
uint32_t version) override {
|
||||
if (interface == qstr("zxdg_decoration_manager_v1")) {
|
||||
xdgDecoration = name;
|
||||
}
|
||||
}
|
||||
|
||||
void registry_global_remove(uint32_t name) override {
|
||||
if (xdgDecoration && name == *xdgDecoration) {
|
||||
xdgDecoration = std::nullopt;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
WaylandIntegration::WaylandIntegration()
|
||||
: _private(std::make_unique<Private>()) {
|
||||
const auto native = qApp->nativeInterface<QWaylandApplication>();
|
||||
if (!native) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto display = native->display();
|
||||
if (!display) {
|
||||
return;
|
||||
}
|
||||
|
||||
_private->init(wl_display_get_registry(display));
|
||||
wl_display_roundtrip(display);
|
||||
}
|
||||
|
||||
WaylandIntegration::~WaylandIntegration() = default;
|
||||
|
||||
WaylandIntegration *WaylandIntegration::Instance() {
|
||||
if (!::Platform::IsWayland()) return nullptr;
|
||||
static std::optional<WaylandIntegration> instance(std::in_place);
|
||||
[[maybe_unused]] static const auto Inited = [] {
|
||||
base::qt_signal_producer(
|
||||
QGuiApplication::platformNativeInterface(),
|
||||
&QObject::destroyed
|
||||
) | rpl::start_with_next([] {
|
||||
instance = std::nullopt;
|
||||
}, instance->_private->lifetime());
|
||||
return true;
|
||||
}();
|
||||
if (!instance) return nullptr;
|
||||
return &*instance;
|
||||
}
|
||||
|
||||
bool WaylandIntegration::xdgDecorationSupported() {
|
||||
return _private->xdgDecoration.has_value();
|
||||
}
|
||||
|
||||
} // namespace Platform
|
||||
} // namespace Ui
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Ui {
|
||||
namespace Platform {
|
||||
|
||||
class WaylandIntegration {
|
||||
public:
|
||||
WaylandIntegration();
|
||||
~WaylandIntegration();
|
||||
|
||||
[[nodiscard]] static WaylandIntegration *Instance();
|
||||
|
||||
[[nodiscard]] bool xdgDecorationSupported();
|
||||
|
||||
private:
|
||||
struct Private;
|
||||
const std::unique_ptr<Private> _private;
|
||||
};
|
||||
|
||||
} // namespace Platform
|
||||
} // namespace Ui
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "ui/platform/linux/ui_linux_wayland_integration.h"
|
||||
|
||||
#include "base/platform/base_platform_info.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Platform {
|
||||
|
||||
struct WaylandIntegration::Private {
|
||||
};
|
||||
|
||||
WaylandIntegration::WaylandIntegration() {
|
||||
}
|
||||
|
||||
WaylandIntegration::~WaylandIntegration() = default;
|
||||
|
||||
WaylandIntegration *WaylandIntegration::Instance() {
|
||||
if (!::Platform::IsWayland()) return nullptr;
|
||||
static WaylandIntegration instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
bool WaylandIntegration::xdgDecorationSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Platform
|
||||
} // namespace Ui
|
||||
|
|
@ -6,8 +6,6 @@
|
|||
//
|
||||
#include "ui/platform/linux/ui_window_linux.h"
|
||||
|
||||
#include "ui/platform/linux/ui_linux_wayland_integration.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Platform {
|
||||
|
||||
|
|
@ -17,9 +15,6 @@ std::unique_ptr<BasicWindowHelper> CreateSpecialWindowHelper(
|
|||
}
|
||||
|
||||
bool NativeWindowFrameSupported() {
|
||||
if (const auto integration = WaylandIntegration::Instance()) {
|
||||
return integration->xdgDecorationSupported();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue