Remove the decoration opacity property

It has been broken since cross-fading was introduced, and no one has
filed any bug reports about it.
This commit is contained in:
Fredrik Höglund 2014-08-04 21:12:34 +02:00
parent 70d35d602f
commit 0aff9830df
9 changed files with 155 additions and 278 deletions

View file

@ -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)

View file

@ -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) {

View file

@ -5,9 +5,6 @@
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="">
<entry name="Decoration" type="Int">
<default>100</default>
</entry>
<entry name="MoveResize" type="Int">
<default>80</default>
</entry>

View file

@ -20,83 +20,7 @@
<string>General Translucency Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="1" colspan="2">
<widget class="QSlider" name="kcfg_Dialogs">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="dialogs_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Dialogs:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Dialogs</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="decorations_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Decorations:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Decoration</cstring>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QSlider" name="kcfg_ComboboxPopups">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2">
<widget class="QSlider" name="kcfg_Menus">
<property name="minimum">
<number>10</number>
@ -115,45 +39,20 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="inactive_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="6" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="text">
<string>Inactive windows:</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Inactive</cstring>
</property>
</widget>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="moveresize_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Moving windows:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_MoveResize</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="4" column="0">
<widget class="QLabel" name="comboboxpopup_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@ -172,7 +71,26 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<item row="4" column="1" colspan="2">
<widget class="QSlider" name="kcfg_ComboboxPopups">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QSlider" name="kcfg_MoveResize">
<property name="minimum">
<number>10</number>
@ -191,21 +109,132 @@
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Opaque</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="dialogs_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Dialogs:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Dialogs</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Transparent</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QSlider" name="kcfg_Dialogs">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</spacer>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="menus_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Menus:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Menus</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="moveresize_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Moving windows:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_MoveResize</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="inactive_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Inactive windows:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Inactive</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QSlider" name="kcfg_Decoration">
<widget class="QSlider" name="kcfg_Inactive">
<property name="minimumSize">
<size>
<width>170</width>
@ -229,73 +258,6 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QSlider" name="kcfg_Inactive">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Transparent</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Opaque</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="menus_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Menus:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Menus</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -479,7 +441,6 @@
</layout>
</widget>
<tabstops>
<tabstop>kcfg_Decoration</tabstop>
<tabstop>kcfg_Inactive</tabstop>
<tabstop>kcfg_MoveResize</tabstop>
<tabstop>kcfg_Dialogs</tabstop>

View file

@ -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:

View file

@ -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
};

View file

@ -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;

View file

@ -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

View file

@ -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;