[ToolTipDialog] Use KWindowSystem::isPlatformX11() which is cached

I think it's wrong to set the flags for *every* event() but at least avoid the
string comparison Qt does internally in QX11Info::isPlatformX11()
Also, removes the need for an ifdef.

Differential Revision: https://phabricator.kde.org/D4019
This commit is contained in:
Kai Uwe Broulik 2017-01-08 18:10:30 +01:00
parent 80de0da1fa
commit a0119858e4

View File

@ -29,11 +29,6 @@
#include <kdeclarative/qmlobjectsharedengine.h>
#include <KWindowSystem>
#include <config-x11.h>
#if HAVE_X11
#include <QX11Info>
#endif
ToolTipDialog::ToolTipDialog(QQuickItem *parent)
: Dialog(parent),
m_qmlObject(0),
@ -42,11 +37,9 @@ ToolTipDialog::ToolTipDialog(QQuickItem *parent)
m_owner(Q_NULLPTR)
{
Qt::WindowFlags flags = Qt::ToolTip;
#if HAVE_X11
if (QX11Info::isPlatformX11()) {
if (KWindowSystem::isPlatformX11()) {
flags = flags | Qt::BypassWindowManagerHint;
}
#endif
setFlags(flags);
setLocation(Plasma::Types::Floating);
@ -120,11 +113,9 @@ bool ToolTipDialog::event(QEvent *e)
bool ret = Dialog::event(e);
Qt::WindowFlags flags = Qt::ToolTip | Qt::WindowDoesNotAcceptFocus | Qt::WindowStaysOnTopHint;
#if HAVE_X11
if (QX11Info::isPlatformX11()) {
if (KWindowSystem::isPlatformX11()) {
flags = flags | Qt::BypassWindowManagerHint;
}
#endif
setFlags(flags);
return ret;
}