2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-08 10:35:15 +00:00

Move xdg-foreign support to lib_base

This commit is contained in:
Ilya Fedin
2022-02-04 13:22:17 +04:00
committed by John Preston
parent cd9b3368da
commit 99e8d22c51
7 changed files with 8 additions and 48 deletions

View File

@@ -12,7 +12,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <connection_thread.h>
#include <registry.h>
#include <surface.h>
#include <xdgforeign.h>
#include <plasmashell.h>
using namespace KWayland::Client;
@@ -23,7 +22,6 @@ namespace internal {
struct WaylandIntegration::Private {
std::unique_ptr<ConnectionThread> connection;
Registry registry;
std::unique_ptr<XdgExporter> xdgExporter;
std::unique_ptr<PlasmaShell> plasmaShell;
};
@@ -42,21 +40,6 @@ WaylandIntegration::WaylandIntegration()
&_private->registry,
&Registry::destroy);
QObject::connect(
&_private->registry,
&Registry::exporterUnstableV2Announced,
[=](uint name, uint version) {
_private->xdgExporter = std::unique_ptr<XdgExporter>{
_private->registry.createXdgExporter(name, version),
};
QObject::connect(
_private->connection.get(),
&ConnectionThread::connectionDied,
_private->xdgExporter.get(),
&XdgExporter::destroy);
});
QObject::connect(
&_private->registry,
&Registry::plasmaShellAnnounced,
@@ -81,26 +64,6 @@ WaylandIntegration *WaylandIntegration::Instance() {
return &instance;
}
QString WaylandIntegration::nativeHandle(QWindow *window) {
if (const auto exporter = _private->xdgExporter.get()) {
if (const auto surface = Surface::fromWindow(window)) {
if (const auto exported = exporter->exportTopLevel(
surface,
surface)) {
QEventLoop loop;
QObject::connect(
exported,
&XdgExported::done,
&loop,
&QEventLoop::quit);
loop.exec();
return exported->handle();
}
}
}
return {};
}
bool WaylandIntegration::skipTaskbarSupported() {
return _private->plasmaShell != nullptr;
}