Make use of the new window-less base::Platform::XDP::ParentWindowID

This commit is contained in:
Ilya Fedin 2023-08-25 03:28:08 +04:00 committed by John Preston
parent 4755be4ace
commit 396635fa1d
3 changed files with 4 additions and 31 deletions

View File

@ -10,8 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/platform/base_platform_info.h"
#include "base/platform/linux/base_linux_xdp_utilities.h"
#include "base/platform/linux/base_linux_wayland_integration.h"
#include "core/application.h"
#include "window/window_controller.h"
#include "base/random.h"
#include <fcntl.h>
@ -60,26 +58,13 @@ bool ShowXDPOpenWithDialog(const QString &filepath) {
const auto fdGuard = gsl::finally([&] { ::close(fd); });
const auto parentWindowId = [&]() -> Glib::ustring {
const auto activeWindow = Core::App().activeWindow();
if (!activeWindow) {
return {};
}
return base::Platform::XDP::ParentWindowID(
activeWindow->widget()->windowHandle());
}();
const auto handleToken = Glib::ustring("tdesktop")
+ std::to_string(base::RandomValue<uint>());
const auto activationToken = []() -> Glib::ustring {
using base::Platform::WaylandIntegration;
if (const auto integration = WaylandIntegration::Instance()) {
if (const auto token = integration->activationToken()
; !token.isNull()) {
return token.toStdString();
}
return integration->activationToken().toStdString();
}
return {};
}();
@ -124,7 +109,7 @@ bool ShowXDPOpenWithDialog(const QString &filepath) {
kXDPOpenURIInterface,
"OpenFile",
Glib::create_variant(std::tuple{
parentWindowId,
base::Platform::XDP::ParentWindowID(),
Glib::DBusHandle(),
std::map<Glib::ustring, Glib::VariantBase>{
{

View File

@ -17,10 +17,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h"
#include "storage/localstorage.h"
#include "core/launcher.h"
#include "core/application.h"
#include "core/core_settings.h"
#include "core/update_checker.h"
#include "window/window_controller.h"
#include "webview/platform/linux/webview_linux_webkitgtk.h"
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
@ -65,16 +63,6 @@ bool PortalAutostart(bool start, bool silent) {
const auto connection = Gio::DBus::Connection::get_sync(
Gio::DBus::BusType::SESSION);
const auto parentWindowId = [&]() -> Glib::ustring {
const auto activeWindow = Core::App().activeWindow();
if (!activeWindow) {
return {};
}
return base::Platform::XDP::ParentWindowID(
activeWindow->widget()->windowHandle());
}();
const auto handleToken = Glib::ustring("tdesktop")
+ std::to_string(base::RandomValue<uint>());
@ -152,7 +140,7 @@ bool PortalAutostart(bool start, bool silent) {
"org.freedesktop.portal.Background",
"RequestBackground",
Glib::create_variant(std::tuple{
parentWindowId,
base::Platform::XDP::ParentWindowID(),
options,
}),
base::Platform::XDP::kService);

@ -1 +1 @@
Subproject commit 0919789bf555c651e32bdbcabc397dbacb6a2545
Subproject commit 35beda8406844808a27deec9ef718c3f2a345a05