Revert "Apply system background color for top level window"

This reverts commit 2991c66b75.

Reason for revert: it caused a regression with translucent Qt Quick windows. We need to find alternative way how to fix QTBUG-106583
taking into account QQuickWindow's own color property.

Fixes: QTBUG-112473
Fixes: QTBUG-112537
Fixes: QTBUG-111969
Fixes: QTBUG-112524
Pick-to: 6.5
Change-Id: I34258f4c8b045b63c8462e325b09fff927684223
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Vladimir Belyavsky 2023-04-18 15:32:51 +00:00 committed by Volker Hilsheimer
parent 051ba40997
commit bf0f1fa7d1
2 changed files with 1 additions and 17 deletions

View File

@ -31,7 +31,6 @@
#include <private/qguiapplication_p.h>
#include <private/qhighdpiscaling_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformtheme.h>
#include <QtCore/qdebug.h>
#include <QtCore/qlibraryinfo.h>
@ -2344,23 +2343,9 @@ static inline bool isSoftwareGl()
}
bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
WPARAM wParam, LPARAM, LRESULT *result)
WPARAM, LPARAM, LRESULT *result)
{
if (message == WM_ERASEBKGND) { // Backing store - ignored.
if (!m_firstBgDraw) {
// Get window background from the default palette; this will
// usually be the system background color.
const QColor bgColor = QGuiApplication::palette().color(QPalette::Window);
HBRUSH bgBrush = CreateSolidBrush(RGB(bgColor.red(), bgColor.green(), bgColor.blue()));
// Fill rectangle with system background color
RECT rc;
auto hdc = reinterpret_cast<HDC>(wParam);
GetClientRect(hwnd, &rc);
FillRect(hdc, &rc, bgBrush);
DeleteObject(bgBrush);
// Brush the window with system background color only for first time
m_firstBgDraw = true;
}
*result = 1;
return true;
}

View File

@ -377,7 +377,6 @@ private:
HICON m_iconBig = nullptr;
void *m_surface = nullptr;
int m_savedDpi = 96;
bool m_firstBgDraw = false;
static bool m_screenForGLInitialized;