Windows: Fix flicker when resizing translucent windows with QSizeGrip

Do not use the startSystemResize() functionality in that case.

Fixes: QTBUG-90628
Fixes: QTBUG-73011
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I8d4843c1715c7f75f9b41c904e6f1aebbf0e02d7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Friedemann Kleint 2021-01-29 12:48:36 +01:00
parent c5e9708ce6
commit 90dc13ae5f

View File

@ -268,6 +268,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) {
@ -287,11 +299,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)