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
This commit is contained in:
Vlad Zahorodnii 2023-08-21 22:23:58 +03:00
parent 54b3c2c6b6
commit 2f6f1d9822

View file

@ -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);