From 68f1684031e24962505a60cd894672b16fd2d4ee Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sun, 4 Feb 2024 16:56:55 +0100 Subject: [PATCH] killer: Initialize Xdg Importer in its constructor Avoids having to do asynchronous code further down. --- src/helpers/killer/killer.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/helpers/killer/killer.cpp b/src/helpers/killer/killer.cpp index 0d54f1e220..f61e18d864 100644 --- a/src/helpers/killer/killer.cpp +++ b/src/helpers/killer/killer.cpp @@ -50,6 +50,7 @@ public: XdgImporter() : QWaylandClientExtensionTemplate(1) { + initialize(); } ~XdgImporter() override { @@ -223,20 +224,13 @@ int main(int argc, char *argv[]) dialog->show(); - auto setTransientParent = [&xdgImporter, &importedParent, dialog, windowHandle] { - if (xdgImporter->isActive()) { - if (auto *waylandWindow = dialog->windowHandle()->nativeInterface()) { - importedParent.reset(xdgImporter->import(windowHandle)); - if (auto *surface = waylandWindow->surface()) { - importedParent->set_parent_of(surface); - } + if (xdgImporter) { + if (auto *waylandWindow = dialog->windowHandle()->nativeInterface()) { + importedParent.reset(xdgImporter->import(windowHandle)); + if (auto *surface = waylandWindow->surface()) { + importedParent->set_parent_of(surface); } } - }; - - if (xdgImporter) { - QObject::connect(xdgImporter.get(), &XdgImporter::activeChanged, dialog, setTransientParent); - setTransientParent(); } dialog->windowHandle()->requestActivate();