mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-03 16:15:13 +00:00
Implement parent setting for portal and gtk dialogs on Wayland via xdg-foreign-v2
This commit is contained in:
@@ -102,18 +102,22 @@ PortalAutostart::PortalAutostart(bool start, bool silent) {
|
||||
|
||||
const auto parentWindowId = [&]() -> Glib::ustring {
|
||||
std::stringstream result;
|
||||
if (const auto activeWindow = Core::App().activeWindow()) {
|
||||
if (IsX11()) {
|
||||
result
|
||||
<< "x11:"
|
||||
<< std::hex
|
||||
<< activeWindow
|
||||
->widget()
|
||||
.get()
|
||||
->windowHandle()
|
||||
->winId();
|
||||
}
|
||||
|
||||
const auto activeWindow = Core::App().activeWindow();
|
||||
if (!activeWindow) {
|
||||
return result.str();
|
||||
}
|
||||
|
||||
const auto window = activeWindow->widget()->windowHandle();
|
||||
if (const auto integration = WaylandIntegration::Instance()) {
|
||||
if (const auto handle = integration->nativeHandle(window)
|
||||
; !handle.isEmpty()) {
|
||||
result << "wayland:" << handle.toStdString();
|
||||
}
|
||||
} else if (IsX11()) {
|
||||
result << "x11:" << std::hex << window->winId();
|
||||
}
|
||||
|
||||
return result.str();
|
||||
}();
|
||||
|
||||
|
Reference in New Issue
Block a user