mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Make use of the new window-less base::Platform::XDP::ParentWindowID
This commit is contained in:
parent
4755be4ace
commit
396635fa1d
3 changed files with 4 additions and 31 deletions
|
@ -10,8 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/platform/linux/base_linux_xdp_utilities.h"
|
#include "base/platform/linux/base_linux_xdp_utilities.h"
|
||||||
#include "base/platform/linux/base_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"
|
#include "base/random.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -60,26 +58,13 @@ bool ShowXDPOpenWithDialog(const QString &filepath) {
|
||||||
|
|
||||||
const auto fdGuard = gsl::finally([&] { ::close(fd); });
|
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")
|
const auto handleToken = Glib::ustring("tdesktop")
|
||||||
+ std::to_string(base::RandomValue<uint>());
|
+ std::to_string(base::RandomValue<uint>());
|
||||||
|
|
||||||
const auto activationToken = []() -> Glib::ustring {
|
const auto activationToken = []() -> Glib::ustring {
|
||||||
using base::Platform::WaylandIntegration;
|
using base::Platform::WaylandIntegration;
|
||||||
if (const auto integration = WaylandIntegration::Instance()) {
|
if (const auto integration = WaylandIntegration::Instance()) {
|
||||||
if (const auto token = integration->activationToken()
|
return integration->activationToken().toStdString();
|
||||||
; !token.isNull()) {
|
|
||||||
return token.toStdString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}();
|
}();
|
||||||
|
@ -124,7 +109,7 @@ bool ShowXDPOpenWithDialog(const QString &filepath) {
|
||||||
kXDPOpenURIInterface,
|
kXDPOpenURIInterface,
|
||||||
"OpenFile",
|
"OpenFile",
|
||||||
Glib::create_variant(std::tuple{
|
Glib::create_variant(std::tuple{
|
||||||
parentWindowId,
|
base::Platform::XDP::ParentWindowID(),
|
||||||
Glib::DBusHandle(),
|
Glib::DBusHandle(),
|
||||||
std::map<Glib::ustring, Glib::VariantBase>{
|
std::map<Glib::ustring, Glib::VariantBase>{
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,10 +17,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "core/launcher.h"
|
#include "core/launcher.h"
|
||||||
#include "core/application.h"
|
|
||||||
#include "core/core_settings.h"
|
#include "core/core_settings.h"
|
||||||
#include "core/update_checker.h"
|
#include "core/update_checker.h"
|
||||||
#include "window/window_controller.h"
|
|
||||||
#include "webview/platform/linux/webview_linux_webkitgtk.h"
|
#include "webview/platform/linux/webview_linux_webkitgtk.h"
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
@ -65,16 +63,6 @@ bool PortalAutostart(bool start, bool silent) {
|
||||||
const auto connection = Gio::DBus::Connection::get_sync(
|
const auto connection = Gio::DBus::Connection::get_sync(
|
||||||
Gio::DBus::BusType::SESSION);
|
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")
|
const auto handleToken = Glib::ustring("tdesktop")
|
||||||
+ std::to_string(base::RandomValue<uint>());
|
+ std::to_string(base::RandomValue<uint>());
|
||||||
|
|
||||||
|
@ -152,7 +140,7 @@ bool PortalAutostart(bool start, bool silent) {
|
||||||
"org.freedesktop.portal.Background",
|
"org.freedesktop.portal.Background",
|
||||||
"RequestBackground",
|
"RequestBackground",
|
||||||
Glib::create_variant(std::tuple{
|
Glib::create_variant(std::tuple{
|
||||||
parentWindowId,
|
base::Platform::XDP::ParentWindowID(),
|
||||||
options,
|
options,
|
||||||
}),
|
}),
|
||||||
base::Platform::XDP::kService);
|
base::Platform::XDP::kService);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0919789bf555c651e32bdbcabc397dbacb6a2545
|
Subproject commit 35beda8406844808a27deec9ef718c3f2a345a05
|
Loading…
Add table
Reference in a new issue