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
This commit is contained in:
Marco Martin 2017-05-12 16:52:58 +02:00
parent 028d7fec2a
commit fd2e850156
2 changed files with 25 additions and 18 deletions

View File

@ -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<QPlatformSurfaceEvent*>(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()) {

View File

@ -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<QExposeEvent*>(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<QPlatformSurfaceEvent *>(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<QMoveEvent *>(event);
#if HAVE_KWAYLAND