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;
}

View file

@ -14,7 +14,6 @@ class WaylandIntegration {
public:
[[nodiscard]] static WaylandIntegration *Instance();
[[nodiscard]] QString nativeHandle(QWindow *window);
[[nodiscard]] bool skipTaskbarSupported();
void skipTaskbar(QWindow *window, bool skip);

View file

@ -26,10 +26,6 @@ WaylandIntegration *WaylandIntegration::Instance() {
return &instance;
}
QString WaylandIntegration::nativeHandle(QWindow *window) {
return {};
}
bool WaylandIntegration::skipTaskbarSupported() {
return false;
}

View file

@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/platform_file_utilities.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "platform/linux/linux_wayland_integration.h"
#include "base/platform/linux/base_linux_wayland_integration.h"
#include "storage/localstorage.h"
#include "base/random.h"
@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <glibmm.h>
#include <giomm.h>
using Platform::internal::WaylandIntegration;
using base::Platform::WaylandIntegration;
namespace Platform {
namespace FileDialog {

View file

@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/platform/base_platform_info.h"
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "platform/linux/linux_wayland_integration.h"
#include "base/platform/linux/base_linux_wayland_integration.h"
#include "core/application.h"
#include "window/window_controller.h"
#include "base/random.h"
@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <giomm.h>
#include <private/qguiapplication_p.h>
using Platform::internal::WaylandIntegration;
using base::Platform::WaylandIntegration;
namespace Platform {
namespace File {

View file

@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/random.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/linux/base_linux_wayland_integration.h"
#include "ui/platform/linux/ui_linux_wayland_integration.h"
#include "platform/linux/linux_desktop_environment.h"
#include "platform/linux/linux_wayland_integration.h"
@ -57,6 +58,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <iostream>
using namespace Platform;
using BaseWaylandIntegration = base::Platform::WaylandIntegration;
using UiWaylandIntegration = Ui::Platform::WaylandIntegration;
using Platform::internal::WaylandIntegration;
@ -91,7 +93,7 @@ void PortalAutostart(bool start, bool silent) {
}
const auto window = activeWindow->widget()->windowHandle();
if (const auto integration = WaylandIntegration::Instance()) {
if (const auto integration = BaseWaylandIntegration::Instance()) {
if (const auto handle = integration->nativeHandle(window)
; !handle.isEmpty()) {
result << "wayland:" << handle.toStdString();

@ -1 +1 @@
Subproject commit 0437cd92adc5706c1fe3409a0459c2f70ced21f4
Subproject commit ec756891b0d677ac648d1af926d74c7089118590