From ae4ba8920e6c909ae2cb2112539783eca1e31620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 5 Nov 2015 16:33:12 +0100 Subject: [PATCH] [declarative/core] Use BypassWindowManagerHint only on platform X11 BypassWindowManagerHint is a flag which is X11 specific. Because of that for example QtWayland doesn't create a real window for QWindows with this flag. Using such a window will eventually result in a freeze of the whole application. If one renders with QtQuick to such a window, mesa will request a frame callback from the compositor. Just the compositor will never deliver the frame rendered callback as it doesn't know the window exists in the first place and by that doesn't render it and will never ever deliver the frame rendered callback. If now one tries to render another frame, mesa notices that it hasn't got the frame callback and will block the thread till that happens. With the setup described: that's until eternity. See Qt Bug: https://bugreports.qt.io/browse/QTBUG-49272 REVIEW: 125961 --- src/declarativeimports/core/CMakeLists.txt | 2 ++ .../core/config-x11.h.cmake | 1 + src/declarativeimports/core/tooltipdialog.cpp | 21 +++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/declarativeimports/core/config-x11.h.cmake diff --git a/src/declarativeimports/core/CMakeLists.txt b/src/declarativeimports/core/CMakeLists.txt index 4e0fe8bf9..0265d5999 100644 --- a/src/declarativeimports/core/CMakeLists.txt +++ b/src/declarativeimports/core/CMakeLists.txt @@ -15,6 +15,8 @@ else() add_definitions(-DHAVE_XCB_SHAPE=0) endif() +configure_file(config-x11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-x11.h) + set(corebindings_SRCS corebindingsplugin.cpp colorscope.cpp diff --git a/src/declarativeimports/core/config-x11.h.cmake b/src/declarativeimports/core/config-x11.h.cmake new file mode 100644 index 000000000..89858d17d --- /dev/null +++ b/src/declarativeimports/core/config-x11.h.cmake @@ -0,0 +1 @@ +#cmakedefine01 HAVE_X11 diff --git a/src/declarativeimports/core/tooltipdialog.cpp b/src/declarativeimports/core/tooltipdialog.cpp index 121ccf91b..6c3712e29 100644 --- a/src/declarativeimports/core/tooltipdialog.cpp +++ b/src/declarativeimports/core/tooltipdialog.cpp @@ -26,6 +26,11 @@ #include +#include +#if HAVE_X11 +#include +#endif + ToolTipDialog::ToolTipDialog(QQuickItem *parent) : Dialog(parent), m_qmlObject(0), @@ -35,7 +40,13 @@ ToolTipDialog::ToolTipDialog(QQuickItem *parent) m_animationsEnabled(true), m_owner(Q_NULLPTR) { - setFlags(Qt::ToolTip | Qt::BypassWindowManagerHint); + Qt::WindowFlags flags = Qt::ToolTip; +#if HAVE_X11 + if (QX11Info::isPlatformX11()) { + flags = flags | Qt::BypassWindowManagerHint; + } +#endif + setFlags(flags); setLocation(Plasma::Types::Floating); m_animation = new QPropertyAnimation(this); @@ -107,7 +118,13 @@ bool ToolTipDialog::event(QEvent *e) } bool ret = Dialog::event(e); - setFlags(Qt::ToolTip | Qt::WindowDoesNotAcceptFocus | Qt::WindowStaysOnTopHint | Qt::BypassWindowManagerHint); + Qt::WindowFlags flags = Qt::ToolTip | Qt::WindowDoesNotAcceptFocus | Qt::WindowStaysOnTopHint; +#if HAVE_X11 + if (QX11Info::isPlatformX11()) { + flags = flags | Qt::BypassWindowManagerHint; + } +#endif + setFlags(flags); return ret; }