diff --git a/krunner/view.cpp b/krunner/view.cpp --- a/krunner/view.cpp +++ b/krunner/view.cpp @@ -226,33 +226,24 @@ } if (setState) { KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager); - } - - if (m_plasmaShell && event->type() == QEvent::Expose) { - using namespace KWayland::Client; - auto ee = static_cast(event); - - if (ee->region().isNull()) { - return retval; - } - if (!m_plasmaShellSurface && isVisible()) { - Surface *s = Surface::fromWindow(this); - if (!s) { - return retval; + if (m_plasmaShell && !m_plasmaShellSurface) { + using namespace KWayland::Client; + if (Surface *s = Surface::fromWindow(this)) { + m_plasmaShellSurface = m_plasmaShell->createSurface(s, this); + m_plasmaShellSurface->setRole(PlasmaShellSurface::Role::Panel); + m_plasmaShellSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::WindowsGoBelow); + m_plasmaShellSurface->setPanelTakesFocus(true); + KWindowSystem::setOnAllDesktops(winId(), true); + positionOnScreen(); + requestActivate(); + //positionOnScreen tried to position it in the position it already had, so no moveevent happens and we need to manually posiyion the surface + m_plasmaShellSurface->setPosition(position()); } - m_plasmaShellSurface = m_plasmaShell->createSurface(s, this); - m_plasmaShellSurface->setRole(PlasmaShellSurface::Role::Panel); - m_plasmaShellSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::WindowsGoBelow); - m_plasmaShellSurface->setPanelTakesFocus(true); - //this should be on showEvent, but it was too soon so none of those had any effect - KWindowSystem::setOnAllDesktops(winId(), true); - positionOnScreen(); - requestActivate(); - //positionOnScreen tried to position it in the position it already had, so no moveevent happens and we need to manually posiyion the surface - m_plasmaShellSurface->setPosition(position()); } - } else if (event->type() == QEvent::Hide) { + } + + if (event->type() == QEvent::Hide) { delete m_plasmaShellSurface; } else if (m_plasmaShellSurface && event->type() == QEvent::Move) { QMoveEvent *me = static_cast(event);