Windows QPA: Enable toggling Windows transparency

Change QWindowsWindow::format() to return the QWindow's requested
format instead of storing it as do the other platforms. This will
cause the alpha (layered flag) to be adapted in
QWindowsBackingStore::flush(). Note that it does not fix
the issue; the window does not update correctly after
changing WS_EX_LAYERED.

Pick-to: 5.15
Task-number: QTBUG-60822
Change-Id: I3facd93f993b3b422b6818d55c1bce884fb57234
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Friedemann Kleint 2020-09-04 13:01:08 +02:00
parent e18cb8b535
commit d9d18596e2
2 changed files with 7 additions and 4 deletions

View File

@ -1356,8 +1356,7 @@ bool QWindowsWindow::m_borderInFullScreenDefault = false;
QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) : QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) :
QWindowsBaseWindow(aWindow), QWindowsBaseWindow(aWindow),
m_data(data), m_data(data),
m_cursor(new CursorHandle), m_cursor(new CursorHandle)
m_format(aWindow->requestedFormat())
#if QT_CONFIG(vulkan) #if QT_CONFIG(vulkan)
, m_vkSurface(VK_NULL_HANDLE) , m_vkSurface(VK_NULL_HANDLE)
#endif #endif
@ -1431,6 +1430,11 @@ void QWindowsWindow::initialize()
} }
} }
QSurfaceFormat QWindowsWindow::format() const
{
return window()->requestedFormat();
}
void QWindowsWindow::fireExpose(const QRegion &region, bool force) void QWindowsWindow::fireExpose(const QRegion &region, bool force)
{ {
if (region.isEmpty() && !force) if (region.isEmpty() && !force)

View File

@ -249,7 +249,7 @@ public:
using QPlatformWindow::screenForGeometry; using QPlatformWindow::screenForGeometry;
QSurfaceFormat format() const override { return m_format; } QSurfaceFormat format() const override;
void setGeometry(const QRect &rect) override; void setGeometry(const QRect &rect) override;
QRect geometry() const override { return m_data.geometry; } QRect geometry() const override { return m_data.geometry; }
QRect normalGeometry() const override; QRect normalGeometry() const override;
@ -402,7 +402,6 @@ private:
QWindowsOleDropTarget *m_dropTarget = nullptr; QWindowsOleDropTarget *m_dropTarget = nullptr;
unsigned m_savedStyle = 0; unsigned m_savedStyle = 0;
QRect m_savedFrameGeometry; QRect m_savedFrameGeometry;
const QSurfaceFormat m_format;
HICON m_iconSmall = nullptr; HICON m_iconSmall = nullptr;
HICON m_iconBig = nullptr; HICON m_iconBig = nullptr;
void *m_surface = nullptr; void *m_surface = nullptr;