From ec27e22a8c48b526c8747669a0ebaa31bf3570c8 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 15 Jul 2024 09:45:20 +0300 Subject: [PATCH] Remove parent for DropMenu QWidget::winId() will force creating window handles for all its ancestor widgets unless the Qt::WA_DontCreateNativeAncestors flag is set. For example, on wayland, this would result in creating sub-surfaces, and depending on the client, it's likely that there are going to be issues with painting. On the other hand, since the DropJob takes care of setting the transient parent for the DropMenu, the parent can be simply omitted. BUG: 490183 (cherry picked from commit e0ea91afdf0dccef7e3afbf23a159bf5a8d6b249) --- src/widgets/dropjob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/dropjob.cpp b/src/widgets/dropjob.cpp index e11e762bd..f4a23f568 100644 --- a/src/widgets/dropjob.cpp +++ b/src/widgets/dropjob.cpp @@ -520,8 +520,7 @@ void DropJobPrivate::slotDropActionDetermined(int error) // There was an error, handle it if (error == KIO::ERR_UNKNOWN) { - auto *window = KJobWidgets::window(q); - KIO::DropMenu *menu = new KIO::DropMenu(window); + KIO::DropMenu *menu = new KIO::DropMenu(); QObject::connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); // If the user clicks outside the menu, it will be destroyed without emitting the triggered signal. @@ -541,6 +540,7 @@ void DropJobPrivate::slotDropActionDetermined(int error) menu->windowHandle()->setTransientParent(transientParent); } } + auto *window = KJobWidgets::window(q); menu->popup(window ? window->mapToGlobal(m_relativePos) : QCursor::pos()); } m_menus.insert(menu); -- 2.45.2