diff options
author | Yuhang Zhao <2546789017@qq.com> | 2020-11-27 16:30:41 +0800 |
---|---|---|
committer | Yuhang Zhao <2546789017@qq.com> | 2020-11-30 15:17:55 +0800 |
commit | 18bee52fe48500bca46de7e47d134940c48b524c (patch) | |
tree | ced76f72ab518b588adbb7f10d7cfc442e69cda0 /src | |
parent | d74d3191f93cac78aec4da072fdf68fe0ecdb040 (diff) |
Remove deprecated functions
According to Microsoft's documentation, DwmIsCompositionEnabled()
will always return true since Windows 8 [1].
And the DWM composition can't be disabled programmatically since
Windows 8 as well [2].
Since Qt 6 will only support Windows 10, it's apparently these two
functions and their usages are totally useless.
[1] https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmiscompositionenabled
[2] https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmenablecomposition
Change-Id: Ia4040118b719fa8edd8504f9112fbe7e3844e0fa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/winextras/plugins.qmltypes | 1 | ||||
-rw-r--r-- | src/imports/winextras/qquickdwmfeatures.cpp | 19 | ||||
-rw-r--r-- | src/imports/winextras/qquickdwmfeatures_p.h | 4 | ||||
-rw-r--r-- | src/winextras/qwinevent.cpp | 4 | ||||
-rw-r--r-- | src/winextras/qwinevent.h | 7 | ||||
-rw-r--r-- | src/winextras/qwineventfilter.cpp | 2 | ||||
-rw-r--r-- | src/winextras/qwinfunctions.cpp | 34 | ||||
-rw-r--r-- | src/winextras/qwinfunctions.h | 2 |
8 files changed, 7 insertions, 66 deletions
diff --git a/src/imports/winextras/plugins.qmltypes b/src/imports/winextras/plugins.qmltypes index fff1181..a23a7b1 100644 --- a/src/imports/winextras/plugins.qmltypes +++ b/src/imports/winextras/plugins.qmltypes @@ -14,7 +14,6 @@ Module { prototype: "QQuickItem" exports: ["QtWinExtras/DwmFeatures 1.0"] exportMetaObjectRevisions: [0] - Property { name: "compositionEnabled"; type: "bool" } Property { name: "colorizationColor"; type: "QColor"; isReadonly: true } Property { name: "realColorizationColor"; type: "QColor"; isReadonly: true } Property { name: "colorizationOpaqueBlend"; type: "bool"; isReadonly: true } diff --git a/src/imports/winextras/qquickdwmfeatures.cpp b/src/imports/winextras/qquickdwmfeatures.cpp index 124d957..7baf536 100644 --- a/src/imports/winextras/qquickdwmfeatures.cpp +++ b/src/imports/winextras/qquickdwmfeatures.cpp @@ -73,16 +73,6 @@ QQuickDwmFeatures::QQuickDwmFeatures(QQuickItem *parent) : QQuickDwmFeatures::~QQuickDwmFeatures() = default; -void QQuickDwmFeatures::setCompositionEnabled(bool enabled) -{ - QtWin::setCompositionEnabled(enabled); -} - -bool QQuickDwmFeatures::isCompositionEnabled() const -{ - return QtWin::isCompositionEnabled(); -} - QColor QQuickDwmFeatures::colorizationColor() const { return QtWin::colorizationColor(); @@ -325,9 +315,7 @@ bool QQuickDwmFeatures::eventFilter(QObject *object, QEvent *event) if (object == window()) { if (event->type() == QWinEvent::CompositionChange) { d->updateSurfaceFormat(); - if (static_cast<QWinCompositionChangeEvent *>(event)->isCompositionEnabled()) - d->updateAll(); - emit compositionEnabledChanged(); + d->updateAll(); } else if (event->type() == QWinEvent::ColorizationChange) { emit colorizationColorChanged(); emit realColorizationColorChanged(); @@ -388,11 +376,10 @@ void QQuickDwmFeaturesPrivate::updateSurfaceFormat() { Q_Q(QQuickDwmFeatures); if (q->window()) { - const bool compositionEnabled = q->isCompositionEnabled(); QSurfaceFormat format = q->window()->format(); - format.setAlphaBufferSize(compositionEnabled ? 8 : 0); + format.setAlphaBufferSize(8); q->window()->setFormat(format); - q->window()->setColor(compositionEnabled ? QColor(Qt::transparent) : originalSurfaceColor); + q->window()->setColor(Qt::transparent); } } diff --git a/src/imports/winextras/qquickdwmfeatures_p.h b/src/imports/winextras/qquickdwmfeatures_p.h index 3887d24..c420659 100644 --- a/src/imports/winextras/qquickdwmfeatures_p.h +++ b/src/imports/winextras/qquickdwmfeatures_p.h @@ -65,7 +65,6 @@ class QQuickDwmFeaturesPrivate; class QQuickDwmFeatures : public QQuickItem { Q_OBJECT - Q_PROPERTY(bool compositionEnabled READ isCompositionEnabled WRITE setCompositionEnabled NOTIFY compositionEnabledChanged) Q_PROPERTY(QColor colorizationColor READ colorizationColor NOTIFY colorizationColorChanged) Q_PROPERTY(QColor realColorizationColor READ realColorizationColor NOTIFY realColorizationColorChanged) Q_PROPERTY(bool colorizationOpaqueBlend READ colorizationOpaqueBlend NOTIFY colorizationOpaqueBlendChanged) @@ -83,8 +82,6 @@ public: explicit QQuickDwmFeatures(QQuickItem *parent = nullptr); ~QQuickDwmFeatures(); - void setCompositionEnabled(bool enabled); - bool isCompositionEnabled() const; QColor colorizationColor() const; QColor realColorizationColor() const; bool colorizationOpaqueBlend() const; @@ -116,7 +113,6 @@ public: Q_SIGNALS: void colorizationColorChanged(); void realColorizationColorChanged(); - void compositionEnabledChanged(); void colorizationOpaqueBlendChanged(); void topGlassMarginChanged(); void rightGlassMarginChanged(); diff --git a/src/winextras/qwinevent.cpp b/src/winextras/qwinevent.cpp index a1e77b4..6d5dbcb 100644 --- a/src/winextras/qwinevent.cpp +++ b/src/winextras/qwinevent.cpp @@ -58,8 +58,8 @@ QWinColorizationChangeEvent::QWinColorizationChangeEvent(QRgb color, bool opaque QWinColorizationChangeEvent::~QWinColorizationChangeEvent() = default; -QWinCompositionChangeEvent::QWinCompositionChangeEvent(bool enabled) - : QWinEvent(CompositionChange), enabled(enabled) +QWinCompositionChangeEvent::QWinCompositionChangeEvent() + : QWinEvent(CompositionChange) { } diff --git a/src/winextras/qwinevent.h b/src/winextras/qwinevent.h index ad77eb3..f4212fd 100644 --- a/src/winextras/qwinevent.h +++ b/src/winextras/qwinevent.h @@ -76,13 +76,8 @@ private: class Q_WINEXTRAS_EXPORT QWinCompositionChangeEvent : public QWinEvent { public: - explicit QWinCompositionChangeEvent(bool enabled); + explicit QWinCompositionChangeEvent(); ~QWinCompositionChangeEvent(); - - inline bool isCompositionEnabled() const { return enabled; } - -private: - bool enabled; }; QT_END_NAMESPACE diff --git a/src/winextras/qwineventfilter.cpp b/src/winextras/qwineventfilter.cpp index 4b88f54..db264b6 100644 --- a/src/winextras/qwineventfilter.cpp +++ b/src/winextras/qwineventfilter.cpp @@ -79,7 +79,7 @@ bool QWinEventFilter::nativeEventFilter(const QByteArray &, void *message, long event = new QWinColorizationChangeEvent(QRgb(msg->wParam), msg->lParam); break; case WM_DWMCOMPOSITIONCHANGED : - event = new QWinCompositionChangeEvent(QtWin::isCompositionEnabled()); + event = new QWinCompositionChangeEvent(); break; case WM_THEMECHANGED : event = new QWinEvent(QWinEvent::ThemeChange); diff --git a/src/winextras/qwinfunctions.cpp b/src/winextras/qwinfunctions.cpp index b0e0ff4..77e5733 100644 --- a/src/winextras/qwinfunctions.cpp +++ b/src/winextras/qwinfunctions.cpp @@ -1835,40 +1835,6 @@ void QtWin::disableBlurBehindWindow(QWindow *window) /*! \since 5.2 - Returns the DWM composition state. - */ -bool QtWin::isCompositionEnabled() -{ - QWinEventFilter::setup(); - - BOOL enabled = FALSE; - DwmIsCompositionEnabled(&enabled); - return enabled; -} - -/*! - \since 5.2 - - Sets whether the Windows Desktop composition is \a enabled. - - \note The underlying function was declared deprecated as of Windows 8 and - takes no effect. - */ - -QT_WARNING_PUSH -QT_WARNING_DISABLE_MSVC(4995) -void QtWin::setCompositionEnabled(bool enabled) -{ - QWinEventFilter::setup(); - - UINT compositionEnabled = enabled; - DwmEnableComposition(compositionEnabled); -} -QT_WARNING_POP - -/*! - \since 5.2 - Returns whether the colorization color is an opaque blend. */ bool QtWin::isCompositionOpaque() diff --git a/src/winextras/qwinfunctions.h b/src/winextras/qwinfunctions.h index 8f27a6f..dd17cef 100644 --- a/src/winextras/qwinfunctions.h +++ b/src/winextras/qwinfunctions.h @@ -118,8 +118,6 @@ namespace QtWin Q_WINEXTRAS_EXPORT void enableBlurBehindWindow(QWindow *window); Q_WINEXTRAS_EXPORT void disableBlurBehindWindow(QWindow *window); - Q_WINEXTRAS_EXPORT bool isCompositionEnabled(); - Q_WINEXTRAS_EXPORT void setCompositionEnabled(bool enabled); Q_WINEXTRAS_EXPORT bool isCompositionOpaque(); Q_WINEXTRAS_EXPORT void setCurrentProcessExplicitAppUserModelID(const QString &id); |