Windows: Fix window opacity for non-translucent windows.
Use the UpdateLayeredWindow() functions only for windows with alpha. Task-number: QTBUG-33025 Change-Id: I64b0c28ee0997cd3d09dc76babe105ed474c6835 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
fad6aa619b
commit
b7b573ad6d
@ -88,8 +88,10 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion,
|
|||||||
QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window);
|
QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window);
|
||||||
|
|
||||||
#ifndef Q_OS_WINCE
|
#ifndef Q_OS_WINCE
|
||||||
|
const bool hasAlpha = rw->format().hasAlpha();
|
||||||
const Qt::WindowFlags flags = window->flags();
|
const Qt::WindowFlags flags = window->flags();
|
||||||
if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, rw->format().hasAlpha(), rw->opacity())) {
|
if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, hasAlpha, rw->opacity()) && hasAlpha) {
|
||||||
|
// Windows with alpha: Use blend function to update.
|
||||||
QRect r = window->frameGeometry();
|
QRect r = window->frameGeometry();
|
||||||
QPoint frameOffset(window->frameMargins().left(), window->frameMargins().top());
|
QPoint frameOffset(window->frameMargins().left(), window->frameMargins().top());
|
||||||
QRect dirtyRect = br.translated(offset + frameOffset);
|
QRect dirtyRect = br.translated(offset + frameOffset);
|
||||||
|
@ -250,7 +250,8 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qr
|
|||||||
Q_UNUSED(level);
|
Q_UNUSED(level);
|
||||||
#else
|
#else
|
||||||
if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) {
|
if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) {
|
||||||
if (flags & Qt::FramelessWindowHint) {
|
if (hasAlpha && (flags & Qt::FramelessWindowHint)) {
|
||||||
|
// Windows with alpha: Use blend function to update.
|
||||||
BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * level), AC_SRC_ALPHA};
|
BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * level), AC_SRC_ALPHA};
|
||||||
QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA);
|
QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user