From 2f6f1d98221eb907f3ec89787ecd16556da76319 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 21 Aug 2023 22:23:58 +0300 Subject: [PATCH] wayland: Keep popups on their parents' desktops At the moment, popups are assigned to the current desktop and activity. However, a toplevel can be on several virtual desktops. If user switches between virtual desktops and the active window does not change, it can result in not being able to dismiss or open new popups depending on the toolkit implementation details. To prevent that, keep popups on same virtual desktops as their parents. BUG: 398628 --- src/xdgshellwindow.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/xdgshellwindow.cpp b/src/xdgshellwindow.cpp index 19125da1fd..78f969f3e6 100644 --- a/src/xdgshellwindow.cpp +++ b/src/xdgshellwindow.cpp @@ -1587,12 +1587,6 @@ XdgPopupWindow::XdgPopupWindow(XdgPopupInterface *shellSurface) , m_shellSurface(shellSurface) { m_windowType = NET::Unknown; - setDesktops({VirtualDesktopManager::self()->currentDesktop()}); -#if KWIN_BUILD_ACTIVITIES - if (auto a = Workspace::self()->activities()) { - setOnActivities({a->current()}); - } -#endif connect(shellSurface, &XdgPopupInterface::grabRequested, this, &XdgPopupWindow::handleGrabRequested); @@ -1859,6 +1853,10 @@ void XdgPopupWindow::initialize() Window *parent = waylandServer()->findWindow(m_shellSurface->parentSurface()); parent->addTransient(this); setTransientFor(parent); + setDesktops(parent->desktops()); +#if KWIN_BUILD_ACTIVITIES + setOnActivities(parent->activities()); +#endif updateRelativePlacement(); connect(parent, &Window::frameGeometryChanged, this, &XdgPopupWindow::relayout);