diff --git a/krunner/view.cpp b/krunner/view.cpp --- a/krunner/view.cpp +++ b/krunner/view.cpp @@ -222,9 +222,7 @@ const bool retval = Dialog::event(event); bool setState = event->type() == QEvent::Show; if (event->type() == QEvent::PlatformSurface) { - if (auto e = dynamic_cast(event)) { - setState = e->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated; - } + setState = (static_cast(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated); } if (setState) { KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager); diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -224,17 +224,15 @@ bool KSMShutdownDlg::event(QEvent *e) { if (e->type() == QEvent::PlatformSurface) { - if (auto pe = dynamic_cast(e)) { - switch (pe->surfaceEventType()) { - case QPlatformSurfaceEvent::SurfaceCreated: - setupWaylandIntegration(); - KWindowEffects::enableBlurBehind(winId(), true); - break; - case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: - delete m_shellSurface; - m_shellSurface = nullptr; - break; - } + switch (static_cast(e)->surfaceEventType()) { + case QPlatformSurfaceEvent::SurfaceCreated: + setupWaylandIntegration(); + KWindowEffects::enableBlurBehind(winId(), true); + break; + case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: + delete m_shellSurface; + m_shellSurface = nullptr; + break; } } return QQuickView::event(e); diff --git a/ksmserver/switchuserdialog.cpp b/ksmserver/switchuserdialog.cpp --- a/ksmserver/switchuserdialog.cpp +++ b/ksmserver/switchuserdialog.cpp @@ -130,17 +130,15 @@ bool KSMSwitchUserDialog::event(QEvent *e) { if (e->type() == QEvent::PlatformSurface) { - if (auto pe = dynamic_cast(e)) { - switch (pe->surfaceEventType()) { - case QPlatformSurfaceEvent::SurfaceCreated: - setupWaylandIntegration(); - KWindowEffects::enableBlurBehind(winId(), true); - break; - case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: - delete m_shellSurface; - m_shellSurface = nullptr; - break; - } + switch (static_cast(e)->surfaceEventType()) { + case QPlatformSurfaceEvent::SurfaceCreated: + setupWaylandIntegration(); + KWindowEffects::enableBlurBehind(winId(), true); + break; + case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: + delete m_shellSurface; + m_shellSurface = nullptr; + break; } } return QQuickView::event(e); diff --git a/shell/desktopview.cpp b/shell/desktopview.cpp --- a/shell/desktopview.cpp +++ b/shell/desktopview.cpp @@ -198,17 +198,15 @@ bool DesktopView::event(QEvent *e) { if (e->type() == QEvent::PlatformSurface) { - if (auto pe = dynamic_cast(e)) { - switch (pe->surfaceEventType()) { - case QPlatformSurfaceEvent::SurfaceCreated: - setupWaylandIntegration(); - ensureWindowType(); - break; - case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: - delete m_shellSurface; - m_shellSurface = nullptr; - break; - } + switch (static_cast(e)->surfaceEventType()) { + case QPlatformSurfaceEvent::SurfaceCreated: + setupWaylandIntegration(); + ensureWindowType(); + break; + case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: + delete m_shellSurface; + m_shellSurface = nullptr; + break; } } diff --git a/shell/panelconfigview.cpp b/shell/panelconfigview.cpp --- a/shell/panelconfigview.cpp +++ b/shell/panelconfigview.cpp @@ -236,31 +236,29 @@ bool PanelConfigView::event(QEvent *e) { if (e->type() == QEvent::PlatformSurface) { - if (auto pe = dynamic_cast(e)) { - switch (pe->surfaceEventType()) { - case QPlatformSurfaceEvent::SurfaceCreated: - if (m_shellSurface) { + switch (static_cast(e)->surfaceEventType()) { + case QPlatformSurfaceEvent::SurfaceCreated: + if (m_shellSurface) { + break; + } + if (ShellCorona *c = qobject_cast(m_containment->corona())) { + using namespace KWayland::Client; + PlasmaShell *interface = c->waylandPlasmaShellInterface(); + if (!interface) { break; } - if (ShellCorona *c = qobject_cast(m_containment->corona())) { - using namespace KWayland::Client; - PlasmaShell *interface = c->waylandPlasmaShellInterface(); - if (!interface) { - break; - } - Surface *s = Surface::fromWindow(this); - if (!s) { - break; - } - m_shellSurface = interface->createSurface(s, this); + Surface *s = Surface::fromWindow(this); + if (!s) { + break; } - break; - case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: - delete m_shellSurface; - m_shellSurface = nullptr; - PanelShadows::self()->removeWindow(this); - break; + m_shellSurface = interface->createSurface(s, this); } + break; + case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: + delete m_shellSurface; + m_shellSurface = nullptr; + PanelShadows::self()->removeWindow(this); + break; } } diff --git a/shell/panelview.cpp b/shell/panelview.cpp --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -899,18 +899,16 @@ break; } case QEvent::PlatformSurface: - if (auto pe = dynamic_cast(e)) { - switch (pe->surfaceEventType()) { - case QPlatformSurfaceEvent::SurfaceCreated: - setupWaylandIntegration(); - PanelShadows::self()->addWindow(this, enabledBorders()); - break; - case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: - delete m_shellSurface; - m_shellSurface = nullptr; - PanelShadows::self()->removeWindow(this); - break; - } + switch (static_cast(e)->surfaceEventType()) { + case QPlatformSurfaceEvent::SurfaceCreated: + setupWaylandIntegration(); + PanelShadows::self()->addWindow(this, enabledBorders()); + break; + case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: + delete m_shellSurface; + m_shellSurface = nullptr; + PanelShadows::self()->removeWindow(this); + break; } break; default: