From 0edfa1c0870d6e381b7f682f9456d591557ba050 Mon Sep 17 00:00:00 2001 From: kleuter Date: Fri, 14 May 2021 17:41:17 +0200 Subject: [PATCH] 5.15.2: fix for QTBUG-90628 (Fix flicker when resizing translucent windows with QSizeGrip) --- .../qtbase/src/widgets/widgets/qsizegrip.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/5.15.2/qtbase/src/widgets/widgets/qsizegrip.cpp b/5.15.2/qtbase/src/widgets/widgets/qsizegrip.cpp index 95a4bee..d16afef 100644 --- a/5.15.2/qtbase/src/widgets/widgets/qsizegrip.cpp +++ b/5.15.2/qtbase/src/widgets/widgets/qsizegrip.cpp @@ -271,6 +271,18 @@ static Qt::Edges edgesFromCorner(Qt::Corner corner) return Qt::Edges{}; } +static bool usePlatformSizeGrip(const QWidget *tlw) +{ + const QString &platformName = QGuiApplication::platformName(); + if (platformName.contains(u"xcb")) // ### FIXME QTBUG-69716 + return false; + if (tlw->testAttribute(Qt::WA_TranslucentBackground) + && platformName == u"windows") { + return false; // QTBUG-90628, flicker when using translucency + } + return true; +} + void QSizeGrip::mousePressEvent(QMouseEvent * e) { if (e->button() != Qt::LeftButton) { @@ -290,11 +302,11 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e) && tlw->windowHandle() && !(tlw->windowFlags() & Qt::X11BypassWindowManagerHint) && !tlw->testAttribute(Qt::WA_DontShowOnScreen) - && !tlw->hasHeightForWidth()) { + && !tlw->hasHeightForWidth() + && usePlatformSizeGrip(tlw)) { QPlatformWindow *platformWindow = tlw->windowHandle()->handle(); const Qt::Edges edges = edgesFromCorner(d->m_corner); - if (!QGuiApplication::platformName().contains(QStringLiteral("xcb"))) // ### FIXME QTBUG-69716 - d->m_platformSizeGrip = platformWindow && platformWindow->startSystemResize(edges); + d->m_platformSizeGrip = platformWindow->startSystemResize(edges); } if (d->m_platformSizeGrip)