Removed incomplete filters and changed the defaults in wobbly windows as suggested by Cedric.
CCMAIL: cedric.borgese@gmail.com svn path=/trunk/KDE/kdebase/workspace/; revision=864934
This commit is contained in:
parent
0e2b190a0e
commit
4430053ef8
5 changed files with 32 additions and 556 deletions
|
@ -38,23 +38,20 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
static const qreal STIFFNESS = 0.06;
|
||||
static const qreal DRAG = 0.92;
|
||||
static const qreal MOVEFACTOR = 0.1;
|
||||
static const qreal STIFFNESS = 0.15;
|
||||
static const qreal DRAG = 0.80;
|
||||
static const qreal MOVEFACTOR = 0.10;
|
||||
|
||||
static const int XTESSELATION = 20;
|
||||
static const int YTESSELATION = 20;
|
||||
|
||||
static const qreal MINVELOCITY = 0.0;
|
||||
static const qreal MAXVELOCITY = 1000.0;
|
||||
static const qreal STOPVELOCITY = 3.0;
|
||||
static const qreal STOPVELOCITY = 0.5;
|
||||
static const qreal MINACCELERATION = 0.0;
|
||||
static const qreal MAXACCELERATION = 1000.0;
|
||||
static const qreal STOPACCELERATION = 5.0;
|
||||
|
||||
static const char* VELOCITYFILTER = "HeightRingLinearMean";
|
||||
static const char* ACCELERATIONFILTER = "HeightRingLinearMean";
|
||||
|
||||
struct ParameterSet
|
||||
{
|
||||
qreal stiffness;
|
||||
|
@ -64,9 +61,6 @@ struct ParameterSet
|
|||
qreal xTesselation;
|
||||
qreal yTesselation;
|
||||
|
||||
WobblyWindowsEffect::GridFilter velocityFilter;
|
||||
WobblyWindowsEffect::GridFilter accelerationFilter;
|
||||
|
||||
qreal minVelocity;
|
||||
qreal maxVelocity;
|
||||
qreal stopVelocity;
|
||||
|
@ -81,13 +75,11 @@ struct ParameterSet
|
|||
|
||||
ParameterSet set_0 =
|
||||
{
|
||||
0.1,
|
||||
0.8,
|
||||
0.1,
|
||||
0.15,
|
||||
0.80,
|
||||
0.10,
|
||||
20.0,
|
||||
20.0,
|
||||
WobblyWindowsEffect::FourRingLinearMean,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
|
@ -101,13 +93,11 @@ ParameterSet set_0 =
|
|||
|
||||
ParameterSet set_1 =
|
||||
{
|
||||
0.15,
|
||||
0.10,
|
||||
0.85,
|
||||
0.1,
|
||||
0.10,
|
||||
20.0,
|
||||
20.0,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
WobblyWindowsEffect::MeanWithMean,
|
||||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
|
@ -122,12 +112,10 @@ ParameterSet set_1 =
|
|||
ParameterSet set_2 =
|
||||
{
|
||||
0.06,
|
||||
0.9,
|
||||
0.1,
|
||||
0.90,
|
||||
0.10,
|
||||
20.0,
|
||||
20.0,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
WobblyWindowsEffect::NoFilter,
|
||||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
|
@ -143,11 +131,9 @@ ParameterSet set_3 =
|
|||
{
|
||||
0.03,
|
||||
0.92,
|
||||
0.2,
|
||||
0.20,
|
||||
20.0,
|
||||
20.0,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
|
@ -166,8 +152,6 @@ ParameterSet set_4 =
|
|||
0.25,
|
||||
20.0,
|
||||
20.0,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
|
@ -191,7 +175,7 @@ WobblyWindowsEffect::WobblyWindowsEffect()
|
|||
QString settingsMode = conf.readEntry("Settings", "Auto");
|
||||
if (settingsMode != "Custom")
|
||||
{
|
||||
unsigned int wobblynessLevel = conf.readEntry("WobblynessLevel", 1);
|
||||
unsigned int wobblynessLevel = conf.readEntry("WobblynessLevel", 0);
|
||||
if (wobblynessLevel > 4)
|
||||
{
|
||||
kDebug() << "Wrong value for \"WobblynessLevel\" : " << wobblynessLevel;
|
||||
|
@ -204,9 +188,6 @@ WobblyWindowsEffect::WobblyWindowsEffect()
|
|||
m_stiffness = conf.readEntry("Stiffness", STIFFNESS * 100.0) / 100.0;
|
||||
m_drag = conf.readEntry("Drag", DRAG * 100.0) / 100.0;
|
||||
m_move_factor = conf.readEntry("MoveFactor", MOVEFACTOR * 100.0) / 100.0;
|
||||
|
||||
m_velocityFilter = GridFilter(conf.readEntry("VelocityFilterEnum", int(HeightRingLinearMean)));
|
||||
m_accelerationFilter = GridFilter(conf.readEntry("AccelerationFilterEnum", int(HeightRingLinearMean)));
|
||||
}
|
||||
}
|
||||
else // Custom method, read all values from config file.
|
||||
|
@ -225,60 +206,6 @@ WobblyWindowsEffect::WobblyWindowsEffect()
|
|||
m_maxAcceleration = conf.readEntry("MaxAcceleration", MAXACCELERATION);
|
||||
m_stopAcceleration = conf.readEntry("StopAcceleration", STOPACCELERATION);
|
||||
|
||||
QString velFilter = conf.readEntry("VelocityFilter", VELOCITYFILTER);
|
||||
if (velFilter == "NoFilter")
|
||||
{
|
||||
m_velocityFilter = NoFilter;
|
||||
}
|
||||
else if (velFilter == "FourRingLinearMean")
|
||||
{
|
||||
m_velocityFilter = FourRingLinearMean;
|
||||
}
|
||||
else if (velFilter == "HeightRingLinearMean")
|
||||
{
|
||||
m_velocityFilter = HeightRingLinearMean;
|
||||
}
|
||||
else if (velFilter == "MeanWithMean")
|
||||
{
|
||||
m_velocityFilter = MeanWithMean;
|
||||
}
|
||||
else if (velFilter == "MeanWithMedian")
|
||||
{
|
||||
m_velocityFilter = MeanWithMedian;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_velocityFilter = FourRingLinearMean;
|
||||
kDebug() << "Unknown config value for VelocityFilter : " << velFilter;
|
||||
}
|
||||
|
||||
QString accFilter = conf.readEntry("AccelerationFilter", ACCELERATIONFILTER);
|
||||
if (accFilter == "NoFilter")
|
||||
{
|
||||
m_accelerationFilter = NoFilter;
|
||||
}
|
||||
else if (accFilter == "FourRingLinearMean")
|
||||
{
|
||||
m_accelerationFilter = FourRingLinearMean;
|
||||
}
|
||||
else if (accFilter == "HeightRingLinearMean")
|
||||
{
|
||||
m_accelerationFilter = HeightRingLinearMean;
|
||||
}
|
||||
else if (accFilter == "MeanWithMean")
|
||||
{
|
||||
m_accelerationFilter = MeanWithMean;
|
||||
}
|
||||
else if (accFilter == "MeanWithMedian")
|
||||
{
|
||||
m_accelerationFilter = MeanWithMedian;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_accelerationFilter = NoFilter;
|
||||
kDebug() << "Unknown config value for accelerationFilter : " << accFilter;
|
||||
}
|
||||
|
||||
m_moveEffectEnabled = conf.readEntry("MoveEffect", true);
|
||||
m_openEffectEnabled = conf.readEntry("OpenEffect", false);
|
||||
// disable close effect by default for now as it doesn't do what I want.
|
||||
|
@ -322,9 +249,6 @@ void WobblyWindowsEffect::setParameterSet(ParameterSet& pset)
|
|||
m_xTesselation = pset.xTesselation;
|
||||
m_yTesselation = pset.yTesselation;
|
||||
|
||||
m_velocityFilter = pset.velocityFilter ;
|
||||
m_accelerationFilter = pset.accelerationFilter;
|
||||
|
||||
m_minVelocity = pset.minVelocity;
|
||||
m_maxVelocity = pset.maxVelocity;
|
||||
m_stopVelocity = pset.stopVelocity;
|
||||
|
@ -352,26 +276,6 @@ void WobblyWindowsEffect::setStiffness(qreal stiffness)
|
|||
m_stiffness = stiffness;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::setVelocityFilter(GridFilter filter)
|
||||
{
|
||||
m_velocityFilter = filter;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::setAccelerationFilter(GridFilter filter)
|
||||
{
|
||||
m_accelerationFilter = filter;
|
||||
}
|
||||
|
||||
WobblyWindowsEffect::GridFilter WobblyWindowsEffect::velocityFilter() const
|
||||
{
|
||||
return m_velocityFilter;
|
||||
}
|
||||
|
||||
WobblyWindowsEffect::GridFilter WobblyWindowsEffect::accelerationFilter() const
|
||||
{
|
||||
return m_accelerationFilter;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::setDrag(qreal drag)
|
||||
{
|
||||
m_drag = drag;
|
||||
|
@ -1078,30 +982,7 @@ bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time)
|
|||
}
|
||||
}
|
||||
|
||||
switch (m_accelerationFilter)
|
||||
{
|
||||
case NoFilter:
|
||||
break;
|
||||
|
||||
case FourRingLinearMean:
|
||||
fourRingLinearMean(&wwi.acceleration, wwi);
|
||||
break;
|
||||
|
||||
case HeightRingLinearMean:
|
||||
heightRingLinearMean(&wwi.acceleration, wwi);
|
||||
break;
|
||||
|
||||
case MeanWithMean:
|
||||
meanWithMean(&wwi.acceleration, wwi);
|
||||
break;
|
||||
|
||||
case MeanWithMedian:
|
||||
meanWithMedian(&wwi.acceleration, wwi);
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT1(false);
|
||||
}
|
||||
heightRingLinearMean(&wwi.acceleration, wwi);
|
||||
|
||||
#if defined COMPUTE_STATS
|
||||
Pair accBound = {m_maxAcceleration, m_minAcceleration};
|
||||
|
@ -1125,31 +1006,7 @@ bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time)
|
|||
acc_sum += fabs(acc.x) + fabs(acc.y);
|
||||
}
|
||||
|
||||
|
||||
switch (m_velocityFilter)
|
||||
{
|
||||
case NoFilter:
|
||||
break;
|
||||
|
||||
case FourRingLinearMean:
|
||||
fourRingLinearMean(&wwi.velocity, wwi);
|
||||
break;
|
||||
|
||||
case HeightRingLinearMean:
|
||||
heightRingLinearMean(&wwi.velocity, wwi);
|
||||
break;
|
||||
|
||||
case MeanWithMean:
|
||||
meanWithMean(&wwi.velocity, wwi);
|
||||
break;
|
||||
|
||||
case MeanWithMedian:
|
||||
meanWithMedian(&wwi.velocity, wwi);
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT1(false);
|
||||
}
|
||||
heightRingLinearMean(&wwi.velocity, wwi);
|
||||
|
||||
Pair topLeftCorner = {-10000.0, -10000.0};
|
||||
Pair bottomRightCorner = {10000.0, 10000.0};
|
||||
|
@ -1228,204 +1085,6 @@ bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time)
|
|||
return true;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::fourRingLinearMean(Pair** datas_pointer, WindowWobblyInfos& wwi)
|
||||
{
|
||||
Pair* datas = *datas_pointer;
|
||||
Pair neibourgs[4];
|
||||
|
||||
// for corners
|
||||
|
||||
// top-left
|
||||
{
|
||||
Pair& res = wwi.buffer[0];
|
||||
Pair vit = datas[0];
|
||||
neibourgs[0] = datas[1];
|
||||
neibourgs[1] = datas[wwi.width];
|
||||
|
||||
res.x = (neibourgs[0].x + neibourgs[1].x + 2.0*vit.x) / 4.0;
|
||||
res.y = (neibourgs[0].y + neibourgs[1].y + 2.0*vit.y) / 4.0;
|
||||
}
|
||||
|
||||
|
||||
// top-right
|
||||
{
|
||||
Pair& res = wwi.buffer[wwi.width-1];
|
||||
Pair vit = datas[wwi.width-1];
|
||||
neibourgs[0] = datas[wwi.width-2];
|
||||
neibourgs[1] = datas[2*wwi.width-1];
|
||||
|
||||
res.x = (neibourgs[0].x + neibourgs[1].x + 2.0*vit.x) / 4.0;
|
||||
res.y = (neibourgs[0].y + neibourgs[1].y + 2.0*vit.y) / 4.0;
|
||||
}
|
||||
|
||||
|
||||
// bottom-left
|
||||
{
|
||||
Pair& res = wwi.buffer[wwi.width*(wwi.height-1)];
|
||||
Pair vit = datas[wwi.width*(wwi.height-1)];
|
||||
neibourgs[0] = datas[wwi.width*(wwi.height-1)+1];
|
||||
neibourgs[1] = datas[wwi.width*(wwi.height-2)];
|
||||
|
||||
res.x = (neibourgs[0].x + neibourgs[1].x + 2.0*vit.x) / 4.0;
|
||||
res.y = (neibourgs[0].y + neibourgs[1].y + 2.0*vit.y) / 4.0;
|
||||
}
|
||||
|
||||
|
||||
// bottom-right
|
||||
{
|
||||
Pair& res = wwi.buffer[wwi.count-1];
|
||||
Pair vit = datas[wwi.count-1];
|
||||
neibourgs[0] = datas[wwi.count-2];
|
||||
neibourgs[1] = datas[wwi.width*(wwi.height-1)-1];
|
||||
|
||||
res.x = (neibourgs[0].x + neibourgs[1].x + 2.0*vit.x) / 4.0;
|
||||
res.y = (neibourgs[0].y + neibourgs[1].y + 2.0*vit.y) / 4.0;
|
||||
}
|
||||
|
||||
|
||||
// for borders
|
||||
|
||||
// top border
|
||||
for (unsigned int i=1; i<wwi.width-1; ++i)
|
||||
{
|
||||
Pair& res = wwi.buffer[i];
|
||||
Pair vit = datas[i];
|
||||
neibourgs[0] = datas[i-1];
|
||||
neibourgs[1] = datas[i+1];
|
||||
neibourgs[2] = datas[i+wwi.width];
|
||||
|
||||
res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0*vit.x) / 6.0;
|
||||
res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0*vit.y) / 6.0;
|
||||
}
|
||||
|
||||
// bottom border
|
||||
for (unsigned int i=wwi.width*(wwi.height-1)+1; i<wwi.count-1; ++i)
|
||||
{
|
||||
Pair& res = wwi.buffer[i];
|
||||
Pair vit = datas[i];
|
||||
neibourgs[0] = datas[i-1];
|
||||
neibourgs[1] = datas[i+1];
|
||||
neibourgs[2] = datas[i-wwi.width];
|
||||
|
||||
res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0*vit.x) / 6.0;
|
||||
res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0*vit.y) / 6.0;
|
||||
}
|
||||
|
||||
// left border
|
||||
for (unsigned int i=wwi.width; i<wwi.width*(wwi.height-1); i+=wwi.width)
|
||||
{
|
||||
Pair& res = wwi.buffer[i];
|
||||
Pair vit = datas[i];
|
||||
neibourgs[0] = datas[i+1];
|
||||
neibourgs[1] = datas[i-wwi.width];
|
||||
neibourgs[2] = datas[i+wwi.width];
|
||||
|
||||
res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0*vit.x) / 6.0;
|
||||
res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0*vit.y) / 6.0;
|
||||
}
|
||||
|
||||
// right border
|
||||
for (unsigned int i=2*wwi.width-1; i<wwi.count-1; i+=wwi.width)
|
||||
{
|
||||
Pair& res = wwi.buffer[i];
|
||||
Pair vit = datas[i];
|
||||
neibourgs[0] = datas[i-1];
|
||||
neibourgs[1] = datas[i-wwi.width];
|
||||
neibourgs[2] = datas[i+wwi.width];
|
||||
|
||||
res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + 3.0*vit.x) / 6.0;
|
||||
res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + 3.0*vit.y) / 6.0;
|
||||
}
|
||||
|
||||
// for the inner points
|
||||
for (unsigned int j=1; j<wwi.height-1; ++j)
|
||||
{
|
||||
for (unsigned int i=1; i<wwi.width-1; ++i)
|
||||
{
|
||||
unsigned int index = i+j*wwi.width;
|
||||
|
||||
Pair& res = wwi.buffer[index];
|
||||
Pair& vit = datas[index];
|
||||
neibourgs[0] = datas[index-1];
|
||||
neibourgs[1] = datas[index+1];
|
||||
neibourgs[2] = datas[index-wwi.width];
|
||||
neibourgs[3] = datas[index+wwi.width];
|
||||
|
||||
res.x = (neibourgs[0].x + neibourgs[1].x + neibourgs[2].x + neibourgs[3].x + 4.0*vit.x) / 8.0;
|
||||
res.y = (neibourgs[0].y + neibourgs[1].y + neibourgs[2].y + neibourgs[3].y + 4.0*vit.y) / 8.0;
|
||||
}
|
||||
}
|
||||
|
||||
Pair* tmp = datas;
|
||||
*datas_pointer = wwi.buffer;
|
||||
wwi.buffer = tmp;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::meanWithMean(Pair** datas_pointer, WindowWobblyInfos& wwi)
|
||||
{
|
||||
Pair* datas = *datas_pointer;
|
||||
|
||||
Pair mean = {0.0, 0.0};
|
||||
for (unsigned int i = 0; i < wwi.count; ++i)
|
||||
{
|
||||
mean.x += datas[i].x;
|
||||
mean.y += datas[i].y;
|
||||
}
|
||||
|
||||
mean.x /= wwi.count;
|
||||
mean.y /= wwi.count;
|
||||
|
||||
for (unsigned int i = 0; i < wwi.count; ++i)
|
||||
{
|
||||
wwi.buffer[i].x = (datas[i].x + mean.x) / 2.0;
|
||||
wwi.buffer[i].y = (datas[i].y + mean.y) / 2.0;
|
||||
}
|
||||
|
||||
Pair* tmp = datas;
|
||||
*datas_pointer = wwi.buffer;
|
||||
wwi.buffer = tmp;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::meanWithMedian(Pair** datas_pointer, WindowWobblyInfos& wwi)
|
||||
{
|
||||
Pair* datas = *datas_pointer;
|
||||
|
||||
qreal xmin = datas[0].x, ymin = datas[0].y;
|
||||
qreal xmax = datas[0].x, ymax = datas[0].y;
|
||||
for (unsigned int i = 1; i < wwi.count; ++i)
|
||||
{
|
||||
if (datas[i].x < xmin)
|
||||
{
|
||||
xmin = datas[i].x;
|
||||
}
|
||||
if (datas[i].x > xmax)
|
||||
{
|
||||
xmax = datas[i].x;
|
||||
}
|
||||
|
||||
if (datas[i].y < ymin)
|
||||
{
|
||||
ymin = datas[i].y;
|
||||
}
|
||||
if (datas[i].y > ymax)
|
||||
{
|
||||
ymax = datas[i].y;
|
||||
}
|
||||
}
|
||||
|
||||
Pair median = {(xmin + xmax)/2.0, (ymin + ymax)/2.0};
|
||||
|
||||
for (unsigned int i = 0; i < wwi.count; ++i)
|
||||
{
|
||||
wwi.buffer[i].x = (datas[i].x + median.x) / 2.0;
|
||||
wwi.buffer[i].y = (datas[i].y + median.y) / 2.0;
|
||||
}
|
||||
|
||||
Pair* tmp = datas;
|
||||
*datas_pointer = wwi.buffer;
|
||||
wwi.buffer = tmp;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::heightRingLinearMean(Pair** datas_pointer, WindowWobblyInfos& wwi)
|
||||
{
|
||||
Pair* datas = *datas_pointer;
|
||||
|
|
|
@ -26,16 +26,6 @@ class WobblyWindowsEffect : public Effect
|
|||
{
|
||||
public:
|
||||
|
||||
enum GridFilter
|
||||
{
|
||||
NoFilter,
|
||||
FourRingLinearMean,
|
||||
HeightRingLinearMean,
|
||||
MeanWithMean,
|
||||
MeanWithMedian
|
||||
};
|
||||
|
||||
|
||||
WobblyWindowsEffect();
|
||||
virtual ~WobblyWindowsEffect();
|
||||
|
||||
|
@ -53,11 +43,6 @@ class WobblyWindowsEffect : public Effect
|
|||
void setVelocityThreshold(qreal velocityThreshold);
|
||||
void setMoveFactor(qreal factor);
|
||||
|
||||
void setVelocityFilter(GridFilter filter);
|
||||
void setAccelerationFilter(GridFilter filter);
|
||||
GridFilter velocityFilter() const;
|
||||
GridFilter accelerationFilter() const;
|
||||
|
||||
struct Pair
|
||||
{
|
||||
qreal x;
|
||||
|
@ -118,9 +103,6 @@ class WobblyWindowsEffect : public Effect
|
|||
qreal m_xTesselation;
|
||||
qreal m_yTesselation;
|
||||
|
||||
GridFilter m_velocityFilter;
|
||||
GridFilter m_accelerationFilter;
|
||||
|
||||
qreal m_minVelocity;
|
||||
qreal m_maxVelocity;
|
||||
qreal m_stopVelocity;
|
||||
|
@ -142,10 +124,7 @@ class WobblyWindowsEffect : public Effect
|
|||
|
||||
WobblyWindowsEffect::Pair computeBezierPoint(const WindowWobblyInfos& wwi, Pair point) const;
|
||||
|
||||
static void fourRingLinearMean(Pair** datas, WindowWobblyInfos& wwi);
|
||||
static void heightRingLinearMean(Pair** datas, WindowWobblyInfos& wwi);
|
||||
static void meanWithMean(Pair** datas, WindowWobblyInfos& wwi);
|
||||
static void meanWithMedian(Pair** datas, WindowWobblyInfos& wwi);
|
||||
|
||||
void setParameterSet(ParameterSet& pset);
|
||||
};
|
||||
|
|
|
@ -43,54 +43,41 @@ struct ParameterSet
|
|||
int stiffness;
|
||||
int drag;
|
||||
int move_factor;
|
||||
|
||||
WobblyWindowsEffect::GridFilter velocityFilter;
|
||||
WobblyWindowsEffect::GridFilter accelerationFilter;
|
||||
};
|
||||
|
||||
ParameterSet set_0 =
|
||||
{
|
||||
10,
|
||||
15,
|
||||
80,
|
||||
10,
|
||||
WobblyWindowsEffect::FourRingLinearMean,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
10
|
||||
};
|
||||
|
||||
ParameterSet set_1 =
|
||||
{
|
||||
15,
|
||||
85,
|
||||
10,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
WobblyWindowsEffect::MeanWithMean,
|
||||
85,
|
||||
10
|
||||
};
|
||||
|
||||
ParameterSet set_2 =
|
||||
{
|
||||
6,
|
||||
90,
|
||||
10,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
WobblyWindowsEffect::NoFilter,
|
||||
10
|
||||
};
|
||||
|
||||
ParameterSet set_3 =
|
||||
{
|
||||
3,
|
||||
92,
|
||||
20,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
20
|
||||
};
|
||||
|
||||
ParameterSet set_4 =
|
||||
{
|
||||
1,
|
||||
97,
|
||||
25,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
WobblyWindowsEffect::HeightRingLinearMean,
|
||||
25
|
||||
};
|
||||
|
||||
ParameterSet pset[5] = { set_0, set_1, set_2, set_3, set_4 };
|
||||
|
@ -111,8 +98,6 @@ KCModule(EffectFactory::componentData(), parent, args)
|
|||
connect(m_ui.stiffnessSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui.dragSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui.moveFactorSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui.velocityCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui.accelerationCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
|
||||
|
||||
load();
|
||||
}
|
||||
|
@ -128,11 +113,11 @@ void WobblyWindowsEffectConfig::load()
|
|||
KConfigGroup conf = EffectsHandler::effectConfig("Wobbly");
|
||||
bool change = true;
|
||||
|
||||
unsigned int wobblynessLevel = 1;
|
||||
unsigned int wobblynessLevel = 0;
|
||||
QString settingsMode = conf.readEntry("Settings", "Auto");
|
||||
if (settingsMode != "Custom")
|
||||
{
|
||||
wobblynessLevel = conf.readEntry("WobblynessLevel", 1);
|
||||
wobblynessLevel = conf.readEntry("WobblynessLevel", 0);
|
||||
change = false;
|
||||
}
|
||||
if (wobblynessLevel > 4)
|
||||
|
@ -146,12 +131,9 @@ void WobblyWindowsEffectConfig::load()
|
|||
m_ui.resizeBox->setChecked(conf.readEntry("ResizeWobble", true));
|
||||
m_ui.advancedBox->setChecked(conf.readEntry("AdvancedMode", false));
|
||||
|
||||
m_ui.stiffnessSlider->setValue(conf.readEntry("Stiffness", pset[1].stiffness));
|
||||
m_ui.dragSlider->setValue(conf.readEntry("Drag", pset[1].drag));
|
||||
m_ui.moveFactorSlider->setValue(conf.readEntry("MoveFactor", pset[1].move_factor));
|
||||
|
||||
m_ui.velocityCombo->setCurrentIndex(conf.readEntry("VelocityFilterEnum", int(WobblyWindowsEffect::HeightRingLinearMean)));
|
||||
m_ui.accelerationCombo->setCurrentIndex(conf.readEntry("AccelerationFilterEnum", int(WobblyWindowsEffect::MeanWithMean)));
|
||||
m_ui.stiffnessSlider->setValue(conf.readEntry("Stiffness", pset[0].stiffness));
|
||||
m_ui.dragSlider->setValue(conf.readEntry("Drag", pset[0].drag));
|
||||
m_ui.moveFactorSlider->setValue(conf.readEntry("MoveFactor", pset[0].move_factor));
|
||||
|
||||
advancedChanged();
|
||||
|
||||
|
@ -173,27 +155,21 @@ void WobblyWindowsEffectConfig::save()
|
|||
conf.writeEntry("Drag", m_ui.dragSpin->value());
|
||||
conf.writeEntry("MoveFactor", m_ui.moveFactorSpin->value());
|
||||
|
||||
conf.writeEntry("VelocityFilterEnum", m_ui.velocityCombo->currentIndex());
|
||||
conf.writeEntry("AccelerationFilterEnum", m_ui.accelerationCombo->currentIndex());
|
||||
|
||||
emit changed(false);
|
||||
EffectsHandler::sendReloadMessage("wobblywindows");
|
||||
}
|
||||
|
||||
void WobblyWindowsEffectConfig::defaults()
|
||||
{
|
||||
m_ui.wobblinessSlider->setSliderPosition(1);
|
||||
m_ui.wobblinessSlider->setSliderPosition(0);
|
||||
|
||||
m_ui.moveBox->setChecked(true);
|
||||
m_ui.resizeBox->setChecked(true);
|
||||
m_ui.advancedBox->setChecked(false);
|
||||
|
||||
m_ui.stiffnessSlider->setValue(pset[1].stiffness);
|
||||
m_ui.dragSlider->setValue(pset[1].drag);
|
||||
m_ui.moveFactorSlider->setValue(pset[1].move_factor);
|
||||
|
||||
m_ui.velocityCombo->setCurrentIndex(int(WobblyWindowsEffect::HeightRingLinearMean));
|
||||
m_ui.accelerationCombo->setCurrentIndex(int(WobblyWindowsEffect::MeanWithMean));
|
||||
m_ui.stiffnessSlider->setValue(pset[0].stiffness);
|
||||
m_ui.dragSlider->setValue(pset[0].drag);
|
||||
m_ui.moveFactorSlider->setValue(pset[0].move_factor);
|
||||
|
||||
emit changed(true);
|
||||
}
|
||||
|
@ -213,9 +189,6 @@ void WobblyWindowsEffectConfig::wobblinessChanged()
|
|||
m_ui.stiffnessSlider->setValue(preset.stiffness);
|
||||
m_ui.dragSlider->setValue(preset.drag);
|
||||
m_ui.moveFactorSlider->setValue(preset.move_factor);
|
||||
|
||||
m_ui.velocityCombo->setCurrentIndex(preset.velocityFilter);
|
||||
m_ui.accelerationCombo->setCurrentIndex(preset.accelerationFilter);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>410</width>
|
||||
<height>300</height>
|
||||
<height>240</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
|
@ -82,102 +82,6 @@
|
|||
<string>Advanced</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3" >
|
||||
<item row="5" column="0" >
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Velocity filter:</string>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags" >
|
||||
<set>Qt::LinksAccessibleByMouse</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>velocityCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" >
|
||||
<widget class="QComboBox" name="velocityCombo" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Four Ring Linear Mean</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Height Ring Linear Mean</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Mean With Mean</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Mean With Median</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" >
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Acceleration &filter:</string>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags" >
|
||||
<set>Qt::LinksAccessibleByMouse</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>velocityCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" >
|
||||
<widget class="QComboBox" name="accelerationCombo" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Four Ring Linear Mean</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Height Ring Linear Mean</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Mean With Mean</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Mean With Median</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2" >
|
||||
<layout class="QGridLayout" name="gridLayout_4" >
|
||||
<item row="0" column="0" >
|
||||
|
@ -349,8 +253,6 @@
|
|||
<tabstop>dragSpin</tabstop>
|
||||
<tabstop>moveFactorSlider</tabstop>
|
||||
<tabstop>moveFactorSpin</tabstop>
|
||||
<tabstop>velocityCombo</tabstop>
|
||||
<tabstop>accelerationCombo</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2008 Cédric Borgese <cedric.borgese@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
|
||||
static const qreal STIFFNESS = 0.06;
|
||||
static const qreal DRAG = 0.92;
|
||||
static const qreal MOVEFACTOR = 0.1;
|
||||
|
||||
static const int XTESSELATION = 20;
|
||||
static const int YTESSELATION = 20;
|
||||
|
||||
static const qreal MINVELOCITY = 0.0;
|
||||
static const qreal MAXVELOCITY = 1000.0;
|
||||
static const qreal STOPVELOCITY = 3.0;
|
||||
static const qreal MINACCELERATION = 0.0;
|
||||
static const qreal MAXACCELERATION = 1000.0;
|
||||
static const qreal STOPACCELERATION = 5.0;
|
||||
|
||||
static const char* VELOCITYFILTER = "FourRingLinearMean";
|
||||
static const char* ACCELERATIONFILTER = "FourRingLinearMean";
|
Loading…
Reference in a new issue