killer: Initialize Xdg Importer in its constructor
Avoids having to do asynchronous code further down.
This commit is contained in:
parent
fec39141b5
commit
68f1684031
1 changed files with 6 additions and 12 deletions
|
@ -50,6 +50,7 @@ public:
|
||||||
XdgImporter()
|
XdgImporter()
|
||||||
: QWaylandClientExtensionTemplate(1)
|
: QWaylandClientExtensionTemplate(1)
|
||||||
{
|
{
|
||||||
|
initialize();
|
||||||
}
|
}
|
||||||
~XdgImporter() override
|
~XdgImporter() override
|
||||||
{
|
{
|
||||||
|
@ -223,20 +224,13 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
dialog->show();
|
dialog->show();
|
||||||
|
|
||||||
auto setTransientParent = [&xdgImporter, &importedParent, dialog, windowHandle] {
|
if (xdgImporter) {
|
||||||
if (xdgImporter->isActive()) {
|
if (auto *waylandWindow = dialog->windowHandle()->nativeInterface<QNativeInterface::Private::QWaylandWindow>()) {
|
||||||
if (auto *waylandWindow = dialog->windowHandle()->nativeInterface<QNativeInterface::Private::QWaylandWindow>()) {
|
importedParent.reset(xdgImporter->import(windowHandle));
|
||||||
importedParent.reset(xdgImporter->import(windowHandle));
|
if (auto *surface = waylandWindow->surface()) {
|
||||||
if (auto *surface = waylandWindow->surface()) {
|
importedParent->set_parent_of(surface);
|
||||||
importedParent->set_parent_of(surface);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (xdgImporter) {
|
|
||||||
QObject::connect(xdgImporter.get(), &XdgImporter::activeChanged, dialog, setTransientParent);
|
|
||||||
setTransientParent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->windowHandle()->requestActivate();
|
dialog->windowHandle()->requestActivate();
|
||||||
|
|
Loading…
Reference in a new issue