Set Tooltip window type on ToolTipDialog through KWindowSystem API

In order to have support for tooltip window type in Wayland, the
window type NET::Tooltip is also set through KWindowSystem API once
the platform surface is created.

REVIEW: 128300
This commit is contained in:
Martin Gräßlin 2016-06-28 13:41:11 +02:00
parent fb3e8d5fc5
commit 7f3aa5344a

View File

@ -22,8 +22,12 @@
#include <QQmlEngine>
#include <QQuickItem>
#include <QDebug>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
#include <QPlatformSurfaceEvent>
#endif
#include <kdeclarative/qmlobjectsharedengine.h>
#include <KWindowSystem>
#include <config-x11.h>
#if HAVE_X11
@ -105,6 +109,15 @@ 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 HAVE_X11