mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Stop using the plasma-shell protocol
Looks like this isn't really correct in combination with xdg-shell
This commit is contained in:
parent
3d994b58a0
commit
9046b2cafb
8 changed files with 0 additions and 259 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -82,9 +82,6 @@
|
|||
[submodule "Telegram/ThirdParty/dispatch"]
|
||||
path = Telegram/ThirdParty/dispatch
|
||||
url = https://github.com/apple/swift-corelibs-libdispatch
|
||||
[submodule "Telegram/ThirdParty/plasma-wayland-protocols"]
|
||||
path = Telegram/ThirdParty/plasma-wayland-protocols
|
||||
url = https://github.com/KDE/plasma-wayland-protocols.git
|
||||
[submodule "Telegram/ThirdParty/wayland-protocols"]
|
||||
path = Telegram/ThirdParty/wayland-protocols
|
||||
url = https://github.com/gitlab-freedesktop-mirrors/wayland-protocols.git
|
||||
|
|
|
@ -1199,9 +1199,6 @@ PRIVATE
|
|||
payments/payments_checkout_process.h
|
||||
payments/payments_form.cpp
|
||||
payments/payments_form.h
|
||||
platform/linux/linux_wayland_integration_dummy.cpp
|
||||
platform/linux/linux_wayland_integration.cpp
|
||||
platform/linux/linux_wayland_integration.h
|
||||
platform/linux/file_utilities_linux.cpp
|
||||
platform/linux/file_utilities_linux.h
|
||||
platform/linux/launcher_linux.cpp
|
||||
|
@ -1554,16 +1551,6 @@ if (NOT build_winstore)
|
|||
)
|
||||
endif()
|
||||
|
||||
if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
|
||||
remove_target_sources(Telegram ${src_loc}
|
||||
platform/linux/linux_wayland_integration.cpp
|
||||
)
|
||||
else()
|
||||
remove_target_sources(Telegram ${src_loc}
|
||||
platform/linux/linux_wayland_integration_dummy.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (DESKTOP_APP_USE_PACKAGED)
|
||||
remove_target_sources(Telegram ${src_loc}
|
||||
platform/mac/mac_iconv_helper.c
|
||||
|
@ -1701,19 +1688,6 @@ else()
|
|||
desktop-app::external_xcb
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
|
||||
qt_generate_wayland_protocol_client_sources(Telegram
|
||||
FILES
|
||||
${third_party_loc}/wayland/protocol/wayland.xml
|
||||
${third_party_loc}/plasma-wayland-protocols/src/protocols/plasma-shell.xml
|
||||
)
|
||||
|
||||
target_link_libraries(Telegram
|
||||
PRIVATE
|
||||
desktop-app::external_wayland_client
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (build_macstore)
|
||||
|
|
|
@ -1,150 +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 "platform/linux/linux_wayland_integration.h"
|
||||
|
||||
#include "base/platform/linux/base_linux_wayland_utilities.h"
|
||||
#include "base/qt_signal_producer.h"
|
||||
#include "base/flat_map.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QWindow>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include <qpa/qplatformwindow_p.h>
|
||||
|
||||
#include <qwayland-wayland.h>
|
||||
#include <qwayland-plasma-shell.h>
|
||||
|
||||
using QWlApp = QNativeInterface::QWaylandApplication;
|
||||
using namespace QNativeInterface::Private;
|
||||
using namespace base::Platform::Wayland;
|
||||
|
||||
namespace Platform {
|
||||
namespace internal {
|
||||
namespace {
|
||||
|
||||
class PlasmaShell : public Global<QtWayland::org_kde_plasma_shell> {
|
||||
public:
|
||||
using Global::Global;
|
||||
|
||||
using Surface = AutoDestroyer<QtWayland::org_kde_plasma_surface>;
|
||||
base::flat_map<wl_surface*, Surface> surfaces;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
struct WaylandIntegration::Private
|
||||
: public AutoDestroyer<QtWayland::wl_registry> {
|
||||
Private(not_null<QWlApp*> native)
|
||||
: AutoDestroyer(wl_display_get_registry(native->display()))
|
||||
, display(native->display()) {
|
||||
wl_display_roundtrip(display);
|
||||
}
|
||||
|
||||
QtWayland::org_kde_plasma_surface plasmaSurface(QWindow *window);
|
||||
|
||||
const not_null<wl_display*> display;
|
||||
std::optional<PlasmaShell> plasmaShell;
|
||||
|
||||
protected:
|
||||
void registry_global(
|
||||
uint32_t name,
|
||||
const QString &interface,
|
||||
uint32_t version) override {
|
||||
if (interface == qstr("org_kde_plasma_shell")) {
|
||||
plasmaShell.emplace(object(), name, version);
|
||||
}
|
||||
}
|
||||
|
||||
void registry_global_remove(uint32_t name) override {
|
||||
if (plasmaShell && name == plasmaShell->id()) {
|
||||
plasmaShell = std::nullopt;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
QtWayland::org_kde_plasma_surface WaylandIntegration::Private::plasmaSurface(
|
||||
QWindow *window) {
|
||||
if (!plasmaShell) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto native = window->nativeInterface<QWaylandWindow>();
|
||||
if (!native) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto surface = native->surface();
|
||||
if (!surface) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto it = plasmaShell->surfaces.find(surface);
|
||||
if (it != plasmaShell->surfaces.cend()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
const auto plasmaSurface = plasmaShell->get_surface(surface);
|
||||
if (!plasmaSurface) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto result = plasmaShell->surfaces.emplace(surface, plasmaSurface);
|
||||
|
||||
base::qt_signal_producer(
|
||||
native,
|
||||
&QWaylandWindow::surfaceDestroyed
|
||||
) | rpl::start_with_next([=] {
|
||||
auto it = plasmaShell->surfaces.find(surface);
|
||||
if (it != plasmaShell->surfaces.cend()) {
|
||||
plasmaShell->surfaces.erase(it);
|
||||
}
|
||||
}, result.first->second.lifetime());
|
||||
|
||||
return result.first->second;
|
||||
}
|
||||
|
||||
WaylandIntegration::WaylandIntegration()
|
||||
: _private(std::make_unique<Private>(qApp->nativeInterface<QWlApp>())) {
|
||||
}
|
||||
|
||||
WaylandIntegration::~WaylandIntegration() = default;
|
||||
|
||||
WaylandIntegration *WaylandIntegration::Instance() {
|
||||
const auto native = qApp->nativeInterface<QWlApp>();
|
||||
if (!native) return nullptr;
|
||||
static std::optional<WaylandIntegration> instance;
|
||||
if (instance && native->display() != instance->_private->display) {
|
||||
instance.reset();
|
||||
}
|
||||
if (!instance) {
|
||||
instance.emplace();
|
||||
base::qt_signal_producer(
|
||||
QGuiApplication::platformNativeInterface(),
|
||||
&QObject::destroyed
|
||||
) | rpl::start_with_next([] {
|
||||
instance = std::nullopt;
|
||||
}, instance->_private->lifetime());
|
||||
}
|
||||
return &*instance;
|
||||
}
|
||||
|
||||
bool WaylandIntegration::skipTaskbarSupported() {
|
||||
return _private->plasmaShell.has_value();
|
||||
}
|
||||
|
||||
void WaylandIntegration::skipTaskbar(QWindow *window, bool skip) {
|
||||
auto plasmaSurface = _private->plasmaSurface(window);
|
||||
if (!plasmaSurface.isInitialized()) {
|
||||
return;
|
||||
}
|
||||
|
||||
plasmaSurface.set_skip_taskbar(skip);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace Platform
|
|
@ -1,29 +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 Platform {
|
||||
namespace internal {
|
||||
|
||||
class WaylandIntegration {
|
||||
public:
|
||||
WaylandIntegration();
|
||||
~WaylandIntegration();
|
||||
|
||||
[[nodiscard]] static WaylandIntegration *Instance();
|
||||
|
||||
[[nodiscard]] bool skipTaskbarSupported();
|
||||
void skipTaskbar(QWindow *window, bool skip);
|
||||
|
||||
private:
|
||||
struct Private;
|
||||
const std::unique_ptr<Private> _private;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace Platform
|
|
@ -1,37 +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 "platform/linux/linux_wayland_integration.h"
|
||||
|
||||
#include "base/platform/base_platform_info.h"
|
||||
|
||||
namespace Platform {
|
||||
namespace internal {
|
||||
|
||||
struct WaylandIntegration::Private {
|
||||
};
|
||||
|
||||
WaylandIntegration::WaylandIntegration() {
|
||||
}
|
||||
|
||||
WaylandIntegration::~WaylandIntegration() = default;
|
||||
|
||||
WaylandIntegration *WaylandIntegration::Instance() {
|
||||
if (!IsWayland()) return nullptr;
|
||||
static WaylandIntegration instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
bool WaylandIntegration::skipTaskbarSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void WaylandIntegration::skipTaskbar(QWindow *window, bool skip) {
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace Platform
|
|
@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "styles/style_window.h"
|
||||
#include "platform/linux/specific_linux.h"
|
||||
#include "platform/linux/linux_wayland_integration.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_widget.h"
|
||||
#include "history/history_inner_widget.h"
|
||||
|
@ -48,7 +47,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Platform {
|
||||
namespace {
|
||||
|
||||
using internal::WaylandIntegration;
|
||||
using WorkMode = Core::Settings::WorkMode;
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
|
@ -102,11 +100,6 @@ void XCBSkipTaskbar(QWindow *window, bool skip) {
|
|||
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
|
||||
void SkipTaskbar(QWindow *window, bool skip) {
|
||||
if (const auto integration = WaylandIntegration::Instance()) {
|
||||
integration->skipTaskbar(window, skip);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
if (IsX11()) {
|
||||
XCBSkipTaskbar(window, skip);
|
||||
|
|
|
@ -12,7 +12,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/platform/linux/base_linux_dbus_utilities.h"
|
||||
#include "base/platform/linux/base_linux_xdp_utilities.h"
|
||||
#include "ui/platform/ui_platform_window_title.h"
|
||||
#include "platform/linux/linux_wayland_integration.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwindow.h"
|
||||
#include "storage/localstorage.h"
|
||||
|
@ -53,7 +52,6 @@ namespace {
|
|||
using namespace gi::repository;
|
||||
namespace GObject = gi::repository::GObject;
|
||||
using namespace Platform;
|
||||
using Platform::internal::WaylandIntegration;
|
||||
|
||||
void PortalAutostart(bool enabled, Fn<void(bool)> done) {
|
||||
const auto executable = ExecutablePathForShortcuts();
|
||||
|
@ -563,10 +561,6 @@ bool TrayIconSupported() {
|
|||
}
|
||||
|
||||
bool SkipTaskbarSupported() {
|
||||
if (const auto integration = WaylandIntegration::Instance()) {
|
||||
return integration->skipTaskbarSupported();
|
||||
}
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||
if (IsX11()) {
|
||||
return base::Platform::XCB::IsSupportedByWM(
|
||||
|
|
1
Telegram/ThirdParty/plasma-wayland-protocols
vendored
1
Telegram/ThirdParty/plasma-wayland-protocols
vendored
|
@ -1 +0,0 @@
|
|||
Subproject commit 78fc6ee77334a147986f01c6d3c6e1b99af1a333
|
Loading…
Add table
Reference in a new issue