Set parent window ID for portal autostart dialog

This commit is contained in:
Ilya Fedin 2020-11-08 10:47:51 +04:00 committed by John Preston
parent acaf8e4931
commit 3a45957ceb
1 changed files with 14 additions and 1 deletions

View File

@ -20,6 +20,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/localstorage.h"
#include "core/crash_reports.h"
#include "core/update_checker.h"
#include "window/window_controller.h"
#include "core/application.h"
#include <QtWidgets/QApplication>
#include <QtWidgets/QDesktopWidget>
@ -108,8 +110,19 @@ void PortalAutostart(bool autostart, bool silent = false) {
qsl("org.freedesktop.portal.Background"),
qsl("RequestBackground"));
const auto parentWindowId = [&] {
if (const auto activeWindow = Core::App().activeWindow()) {
if (!IsWayland()) {
return qsl("x11:%1").arg(QString::number(
activeWindow->widget().get()->windowHandle()->winId(),
16));
}
}
return QString();
}();
message.setArguments({
QString(),
parentWindowId,
options
});