From 0aff9830df0c87d7cfc8738f059b932b531d6974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Mon, 4 Aug 2014 21:12:34 +0200 Subject: [PATCH] Remove the decoration opacity property It has been broken since cross-fading was introduced, and no one has filed any bug reports about it. --- autotests/test_window_paint_data.cpp | 23 -- .../package/contents/code/main.js | 24 -- .../package/contents/config/main.xml | 3 - .../package/contents/ui/config.ui | 343 ++++++++---------- libkwineffects/kwinanimationeffect.cpp | 5 +- libkwineffects/kwinanimationeffect.h | 2 +- libkwineffects/kwineffects.cpp | 19 - libkwineffects/kwineffects.h | 12 - scene_xrender.cpp | 2 +- 9 files changed, 155 insertions(+), 278 deletions(-) diff --git a/autotests/test_window_paint_data.cpp b/autotests/test_window_paint_data.cpp index b1b48191f7..ceb2067a72 100644 --- a/autotests/test_window_paint_data.cpp +++ b/autotests/test_window_paint_data.cpp @@ -167,7 +167,6 @@ private Q_SLOTS: void testOperatorMultiplyAssign(); void testOperatorPlus(); void testMultiplyOpacity(); - void testMultiplyDecorationOpacity(); void testMultiplySaturation(); void testMultiplyBrightness(); }; @@ -189,7 +188,6 @@ void TestWindowPaintData::testCtor() QCOMPARE(data.rotationOrigin(), QVector3D()); QCOMPARE(data.rotationAxis(), QVector3D(0.0, 0.0, 1.0)); QCOMPARE(data.opacity(), 0.5); - QCOMPARE(data.decorationOpacity(), 1.0); QCOMPARE(data.brightness(), 1.0); QCOMPARE(data.saturation(), 1.0); } @@ -212,7 +210,6 @@ void TestWindowPaintData::testCopyCtor() QCOMPARE(data2.rotationOrigin(), QVector3D()); QCOMPARE(data2.rotationAxis(), QVector3D(0.0, 0.0, 1.0)); QCOMPARE(data2.opacity(), 1.0); - QCOMPARE(data2.decorationOpacity(), 1.0); QCOMPARE(data2.brightness(), 1.0); QCOMPARE(data2.saturation(), 1.0); @@ -222,7 +219,6 @@ void TestWindowPaintData::testCopyCtor() data2.setRotationOrigin(QVector3D(1.0, 2.0, 3.0)); data2.setRotationAxis(QVector3D(1.0, 1.0, 0.0)); data2.setOpacity(0.1); - data2.setDecorationOpacity(0.2); data2.setBrightness(0.3); data2.setSaturation(0.4); @@ -238,7 +234,6 @@ void TestWindowPaintData::testCopyCtor() QCOMPARE(data3.rotationOrigin(), QVector3D(1.0, 2.0, 3.0)); QCOMPARE(data3.rotationAxis(), QVector3D(1.0, 1.0, 0.0)); QCOMPARE(data3.opacity(), 0.1); - QCOMPARE(data3.decorationOpacity(), 0.2); QCOMPARE(data3.brightness(), 0.3); QCOMPARE(data3.saturation(), 0.4); } @@ -303,22 +298,6 @@ void TestWindowPaintData::testMultiplyBrightness() QCOMPARE(0.6, data.brightness()); // just for safety QCOMPARE(1.0, data.opacity()); - QCOMPARE(1.0, data.decorationOpacity()); - QCOMPARE(1.0, data.saturation()); -} - -void TestWindowPaintData::testMultiplyDecorationOpacity() -{ - MockEffectWindowHelper helper; - MockEffectWindow w(&helper); - WindowPaintData data(&w); - QCOMPARE(0.2, data.multiplyDecorationOpacity(0.2)); - QCOMPARE(0.2, data.decorationOpacity()); - QCOMPARE(0.6, data.multiplyDecorationOpacity(3.0)); - QCOMPARE(0.6, data.decorationOpacity()); - // just for safety - QCOMPARE(1.0, data.brightness()); - QCOMPARE(1.0, data.opacity()); QCOMPARE(1.0, data.saturation()); } @@ -333,7 +312,6 @@ void TestWindowPaintData::testMultiplyOpacity() QCOMPARE(0.6, data.opacity()); // just for safety QCOMPARE(1.0, data.brightness()); - QCOMPARE(1.0, data.decorationOpacity()); QCOMPARE(1.0, data.saturation()); } @@ -349,7 +327,6 @@ void TestWindowPaintData::testMultiplySaturation() // just for safety QCOMPARE(1.0, data.brightness()); QCOMPARE(1.0, data.opacity()); - QCOMPARE(1.0, data.decorationOpacity()); } QTEST_MAIN(TestWindowPaintData) diff --git a/effects/translucency/package/contents/code/main.js b/effects/translucency/package/contents/code/main.js index 27ccbe3433..f6468a946e 100644 --- a/effects/translucency/package/contents/code/main.js +++ b/effects/translucency/package/contents/code/main.js @@ -21,7 +21,6 @@ var translucencyEffect = { activeWindow: effects.activeWindow, settings: { duration: animationTime(250), - decoration: 100, moveresize: 100, dialogs: 100, inactive: 100, @@ -35,7 +34,6 @@ var translucencyEffect = { "use strict"; var i, individualMenu, windows; // TODO: add animation duration - translucencyEffect.settings.decoration = effect.readConfig("Decoration", 100); translucencyEffect.settings.moveresize = effect.readConfig("MoveResize", 80); translucencyEffect.settings.dialogs = effect.readConfig("Dialogs", 100); translucencyEffect.settings.inactive = effect.readConfig("Inactive", 100); @@ -97,24 +95,6 @@ var translucencyEffect = { } else if (window.menu === true) { checkWindow(window, translucencyEffect.settings.tornoffmenus); } - translucencyEffect.startDecorationAnimation(window); - }, - startDecorationAnimation: function (window) { - "use strict"; - var ids; - if (translucencyEffect.settings.decoration === 100 || window.hasDecoration === false) { - return; - } - ids = set({ - window: window, - duration: 1, - animations: [{ - type: Effect.DecorationOpacity, - from: translucencyEffect.settings.decoration / 100.0, - to: translucencyEffect.settings.decoration / 100.0 - }] - }); - window.decorationOpacityAnimation = ids; }, /** * @brief Cancels all animations for window type and inactive window @@ -130,10 +110,6 @@ var translucencyEffect = { cancel(window.translucencyInactiveAnimation); window.translucencyInactiveAnimation = undefined; } - if (window.decorationOpacityAnimation !== undefined) { - cancel(window.decorationOpacityAnimation); - window.decorationOpacityAnimation = undefined; - } }, moveResize: { start: function (window) { diff --git a/effects/translucency/package/contents/config/main.xml b/effects/translucency/package/contents/config/main.xml index e876421e7d..31124425e2 100644 --- a/effects/translucency/package/contents/config/main.xml +++ b/effects/translucency/package/contents/config/main.xml @@ -5,9 +5,6 @@ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > - - 100 - 80 diff --git a/effects/translucency/package/contents/ui/config.ui b/effects/translucency/package/contents/ui/config.ui index 56734b9793..30d517e3d4 100644 --- a/effects/translucency/package/contents/ui/config.ui +++ b/effects/translucency/package/contents/ui/config.ui @@ -20,83 +20,7 @@ General Translucency Settings - - - - 10 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 10 - - - - - - - - 0 - 0 - - - - Dialogs: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_Dialogs - - - - - - - - 0 - 0 - - - - Decorations: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_Decoration - - - - - - 10 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 10 - - - - 10 @@ -115,45 +39,20 @@ - - - - - 0 - 0 - + + + + Qt::Vertical - - Inactive windows: + + + 20 + 0 + - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_Inactive - - + - - - - - 0 - 0 - - - - Moving windows: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_MoveResize - - - - + @@ -172,7 +71,26 @@ - + + + + 10 + + + 100 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 10 + + + + 10 @@ -191,21 +109,132 @@ - - + + + + + 0 + 0 + + + + Opaque + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Dialogs: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + kcfg_Dialogs + + + + + + + + 0 + 0 + + + + Transparent + + + + + + + 10 + + + 100 + - Qt::Vertical + Qt::Horizontal - - - 20 - 0 - + + QSlider::TicksBelow - + + 10 + + + + + + + + 0 + 0 + + + + Menus: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + kcfg_Menus + + + + + + + + 0 + 0 + + + + Moving windows: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + kcfg_MoveResize + + + + + + + + 0 + 0 + + + + Inactive windows: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + kcfg_Inactive + + - + 170 @@ -229,73 +258,6 @@ - - - - 10 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 10 - - - - - - - - 0 - 0 - - - - Transparent - - - - - - - - 0 - 0 - - - - Opaque - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Menus: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_Menus - - - @@ -479,7 +441,6 @@ - kcfg_Decoration kcfg_Inactive kcfg_MoveResize kcfg_Dialogs diff --git a/libkwineffects/kwinanimationeffect.cpp b/libkwineffects/kwinanimationeffect.cpp index bd40c4a06f..8c4c0ef653 100644 --- a/libkwineffects/kwinanimationeffect.cpp +++ b/libkwineffects/kwinanimationeffect.cpp @@ -441,7 +441,7 @@ void AnimationEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, continue; isUsed = true; - if (anim->attribute == Opacity || anim->attribute == DecorationOpacity || anim->attribute == CrossFadePrevious) + if (anim->attribute == Opacity || anim->attribute == CrossFadePrevious) data.setTranslucent(); else if (!(anim->attribute == Brightness || anim->attribute == Saturation)) { data.setTransformed(); @@ -488,8 +488,6 @@ void AnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi switch (anim->attribute) { case Opacity: data.multiplyOpacity(interpolated(*anim)); break; - case DecorationOpacity: - data.multiplyDecorationOpacity(interpolated(*anim)); break; case Brightness: data.multiplyBrightness(interpolated(*anim)); break; case Saturation: @@ -746,7 +744,6 @@ void AnimationEffect::updateLayerRepaints() continue; switch (anim->attribute) { case Opacity: - case DecorationOpacity: case Brightness: case Saturation: case CrossFadePrevious: diff --git a/libkwineffects/kwinanimationeffect.h b/libkwineffects/kwinanimationeffect.h index ea0fad1ae4..0384c71943 100644 --- a/libkwineffects/kwinanimationeffect.h +++ b/libkwineffects/kwinanimationeffect.h @@ -100,7 +100,7 @@ public: enum Anchor { Left = 1<<0, Top = 1<<1, Right = 1<<2, Bottom = 1<<3, Horizontal = Left|Right, Vertical = Top|Bottom, Mouse = 1<<4 }; enum Attribute { - Opacity = 0, Brightness, Saturation, Scale, Rotation, DecorationOpacity, + Opacity = 0, Brightness, Saturation, Scale, Rotation, Position, Size, Translation, Clip, Generic, CrossFadePrevious, NonFloatBase = Position }; diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 45e30c02e6..cb4dc29a5d 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -226,7 +226,6 @@ void PaintData::setRotationOrigin(const QVector3D &origin) class WindowPaintDataPrivate { public: qreal opacity; - qreal decorationOpacity; qreal saturation; qreal brightness; int screen; @@ -240,7 +239,6 @@ WindowPaintData::WindowPaintData(EffectWindow* w) { quads = w->buildQuads(); setOpacity(w->opacity()); - setDecorationOpacity(1.0); setSaturation(1.0); setBrightness(1.0); setScreen(0); @@ -261,7 +259,6 @@ WindowPaintData::WindowPaintData(const WindowPaintData &other) setRotationAxis(other.rotationAxis()); setRotationAngle(other.rotationAngle()); setOpacity(other.opacity()); - setDecorationOpacity(other.decorationOpacity()); setSaturation(other.saturation()); setBrightness(other.brightness()); setScreen(other.screen()); @@ -273,11 +270,6 @@ WindowPaintData::~WindowPaintData() delete d; } -qreal WindowPaintData::decorationOpacity() const -{ - return d->decorationOpacity; -} - qreal WindowPaintData::opacity() const { return d->opacity; @@ -298,11 +290,6 @@ int WindowPaintData::screen() const return d->screen; } -void WindowPaintData::setDecorationOpacity(qreal opacity) -{ - d->decorationOpacity = opacity; -} - void WindowPaintData::setOpacity(qreal opacity) { d->opacity = opacity; @@ -333,12 +320,6 @@ void WindowPaintData::setCrossFadeProgress(qreal factor) d->crossFadeProgress = qBound(qreal(0.0), factor, qreal(1.0)); } -qreal WindowPaintData::multiplyDecorationOpacity(qreal factor) -{ - d->decorationOpacity *= factor; - return d->decorationOpacity; -} - qreal WindowPaintData::multiplyOpacity(qreal factor) { d->opacity *= factor; diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 9f612b78b7..9582515d19 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -2224,14 +2224,10 @@ public: WindowPaintData& operator+=(const QVector3D &translation); /** * Window opacity, in range 0 = transparent to 1 = fully opaque - * Opacity for decoration is opacity*decorationOpacity - * @see decorationOpacity * @see setOpacity - * @see setDecorationOpacity * @since 4.10 */ qreal opacity() const; - qreal decorationOpacity() const; /** * Sets the window opacity to the new @p opacity. * If you want to modify the existing opacity level consider using multiplyOpacity. @@ -2239,7 +2235,6 @@ public: * @since 4.10 **/ void setOpacity(qreal opacity); - void setDecorationOpacity(qreal opacity); /** * Multiplies the current opacity with the @p factor. * @param factor Factor with which the opacity should be multiplied @@ -2247,13 +2242,6 @@ public: * @since 4.10 **/ qreal multiplyOpacity(qreal factor); - /** - * Multiplies the current decoration opacity with the @p factor. - * @param factor Factor with which the opacity should be multiplied - * @return New decoration opacity level - * @since 4.10 - **/ - qreal multiplyDecorationOpacity(qreal factor); /** * Saturation of the window, in range [0; 1] * 1 means that the window is unchanged, 0 means that it's completely diff --git a/scene_xrender.cpp b/scene_xrender.cpp index ed45a8fb82..de01b125a6 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -847,7 +847,7 @@ xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, m_xrenderShadow->pic if (client || deleted) { if (!noBorder) { - xcb_render_picture_t decorationAlpha = xRenderBlendPicture(data.opacity() * data.decorationOpacity()); + xcb_render_picture_t decorationAlpha = xRenderBlendPicture(data.opacity()); auto renderDeco = [decorationAlpha, renderTarget](xcb_render_picture_t deco, const QRect &rect) { if (deco == XCB_RENDER_PICTURE_NONE) { return;