From fd2e850156ac7aa9c9dc2cf46652b2a1f1fc3a07 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 12 May 2017 16:52:58 +0200 Subject: [PATCH] recreate plasmashellsurf on exposed, destoy on hidden Summary: every time the window gets shown the wayland surfaces get created, when hidden, they get destroyed showevent is too early for it as they aren't there yet, use :Exposed instead, but only the first time when the surface isn't there yet Test Plan: popup applets always have correct blur in a wayland session Reviewers: #plasma, #plasma_on_wayland, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: davidedmundson, plasma-devel, #frameworks Tags: #frameworks, #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5745 --- src/declarativeimports/core/tooltipdialog.cpp | 9 ----- src/plasmaquick/dialog.cpp | 34 ++++++++++++++----- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/declarativeimports/core/tooltipdialog.cpp b/src/declarativeimports/core/tooltipdialog.cpp index 3d1491135..9779dfbe7 100644 --- a/src/declarativeimports/core/tooltipdialog.cpp +++ b/src/declarativeimports/core/tooltipdialog.cpp @@ -102,15 +102,6 @@ bool ToolTipDialog::event(QEvent *e) dismiss(); } -#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - if (e->type() == QEvent::PlatformSurface) { - auto pe = static_cast(e); - if (pe->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) { - KWindowSystem::setType(winId(), NET::Tooltip); - } - } -#endif - bool ret = Dialog::event(e); Qt::WindowFlags flags = Qt::ToolTip | Qt::WindowDoesNotAcceptFocus | Qt::WindowStaysOnTopHint; if (KWindowSystem::isPlatformX11()) { diff --git a/src/plasmaquick/dialog.cpp b/src/plasmaquick/dialog.cpp index 6fc3fc896..0948807e8 100644 --- a/src/plasmaquick/dialog.cpp +++ b/src/plasmaquick/dialog.cpp @@ -1120,27 +1120,43 @@ void Dialog::showEvent(QShowEvent *event) bool Dialog::event(QEvent *event) { if (event->type() == QEvent::Expose) { - // FIXME TODO: We can remove this once we depend on Qt 5.6.1+. - // See: https://bugreports.qt.io/browse/QTBUG-26978 - KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager); + auto ee = static_cast(event); + + if (ee->region().isNull()) { + return QQuickWindow::event(event); + } + + /* + * expose event is the only place where to correctly + * register our wayland extensions, as showevent is a bit too + * soon and the platform window isn't shown yet + * create a shell surface every time the window gets exposed + * (only the first expose event, guarded by shelldurface existence) + * and tear it down when the window gets hidden + * see https://phabricator.kde.org/T6064 + */ + if (!d->shellSurface) { + KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager); + d->setupWaylandIntegration(); + d->updateVisibility(true); + } #if (QT_VERSION > QT_VERSION_CHECK(5, 5, 0)) } else if (event->type() == QEvent::PlatformSurface) { const QPlatformSurfaceEvent *pSEvent = static_cast(event); if (pSEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) { KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager); - d->setupWaylandIntegration(); - } else if (pSEvent->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) { -#if HAVE_KWAYLAND - delete d->shellSurface; - d->shellSurface = nullptr; -#endif } #endif } else if (event->type() == QEvent::Show) { d->updateVisibility(true); } else if (event->type() == QEvent::Hide) { d->updateVisibility(false); +#if HAVE_KWAYLAND + delete d->shellSurface; + d->shellSurface = nullptr; +#endif + } else if (event->type() == QEvent::Move) { QMoveEvent *me = static_cast(event); #if HAVE_KWAYLAND