1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
diff --git a/kwin/effects/magiclamp/magiclamp.cpp b/kwin/effects/magiclamp/magiclamp.cpp
index e1572cb..44406a2 100644
--- a/kwin/effects/magiclamp/magiclamp.cpp
+++ b/kwin/effects/magiclamp/magiclamp.cpp
@@ -301,6 +301,11 @@ void MagicLampEffect::postPaintScreen()
effects->postPaintScreen();
}
+void MagicLampEffect::windowDeleted( EffectWindow* w )
+{
+ mTimeLineWindows.remove( w );
+}
+
void MagicLampEffect::windowMinimized( EffectWindow* w )
{
mTimeLineWindows[w].setCurveShape(TimeLine::LinearCurve);
diff --git a/kwin/effects/magiclamp/magiclamp.h b/kwin/effects/magiclamp/magiclamp.h
index a7f134d..84bfa7e 100644
--- a/kwin/effects/magiclamp/magiclamp.h
+++ b/kwin/effects/magiclamp/magiclamp.h
@@ -38,6 +38,7 @@ class MagicLampEffect
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
virtual void postPaintScreen();
+ virtual void windowDeleted( EffectWindow* c );
virtual void windowMinimized( EffectWindow* c );
virtual void windowUnminimized( EffectWindow* c );
diff --git a/kwin/effects/minimizeanimation/minimizeanimation.cpp b/kwin/effects/minimizeanimation/minimizeanimation.cpp
index 9432504..905a64b 100644
--- a/kwin/effects/minimizeanimation/minimizeanimation.cpp
+++ b/kwin/effects/minimizeanimation/minimizeanimation.cpp
@@ -39,34 +39,39 @@ void MinimizeAnimationEffect::prePaintScreen( ScreenPrePaintData& data, int time
// whole screen won't be repainted, resulting in artefacts
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
- effects->prePaintScreen(data, time);
- }
-
-void MinimizeAnimationEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
- {
- if( mTimeLineWindows.contains( w ))
+ QHash< EffectWindow*, TimeLine >::iterator entry = mTimeLineWindows.begin();
+ bool erase = false;
+ while( entry != mTimeLineWindows.end() )
{
- if( w->isMinimized() )
+ TimeLine &timeline = entry.value();
+ if( entry.key()->isMinimized() )
{
- mTimeLineWindows[w].addTime(time);
- if( mTimeLineWindows[w].progress() >= 1.0f )
- mTimeLineWindows.remove( w );
+ timeline.addTime(time);
+ erase = (timeline.progress() >= 1.0f);
}
else
{
- mTimeLineWindows[w].removeTime(time);
- if( mTimeLineWindows[w].progress() <= 0.0f )
- mTimeLineWindows.remove( w );
+ timeline.removeTime(time);
+ erase = (timeline.progress() <= 0.0f);
}
+ if( erase )
+ entry = mTimeLineWindows.erase( entry );
+ else
+ ++entry;
+ }
- // Schedule window for transformation if the animation is still in
- // progress
- if( mTimeLineWindows.contains( w ))
- {
- // We'll transform this window
- data.setTransformed();
- w->enablePainting( EffectWindow::PAINT_DISABLED_BY_MINIMIZE );
- }
+ effects->prePaintScreen(data, time);
+ }
+
+void MinimizeAnimationEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
+ {
+ // Schedule window for transformation if the animation is still in
+ // progress
+ if( mTimeLineWindows.contains( w ) )
+ {
+ // We'll transform this window
+ data.setTransformed();
+ w->enablePainting( EffectWindow::PAINT_DISABLED_BY_MINIMIZE );
}
effects->prePaintWindow( w, data, time );
@@ -74,10 +79,11 @@ void MinimizeAnimationEffect::prePaintWindow( EffectWindow* w, WindowPrePaintDat
void MinimizeAnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
{
- if( mTimeLineWindows.contains( w ))
+ QHash< EffectWindow*, TimeLine >::const_iterator entry = mTimeLineWindows.find(w);
+ if( entry != mTimeLineWindows.constEnd() )
{
// 0 = not minimized, 1 = fully minimized
- double progress = mTimeLineWindows[w].value();
+ double progress = entry->value();
QRect geo = w->geometry();
QRect icon = w->iconGeometry();
@@ -107,18 +113,25 @@ void MinimizeAnimationEffect::postPaintScreen()
effects->postPaintScreen();
}
+void MinimizeAnimationEffect::windowDeleted( EffectWindow* w )
+ {
+ mTimeLineWindows.remove( w );
+ }
+
void MinimizeAnimationEffect::windowMinimized( EffectWindow* w )
{
- mTimeLineWindows[w].setCurveShape(TimeLine::EaseInCurve);
- mTimeLineWindows[w].setDuration( animationTime( 250 ));
- mTimeLineWindows[w].setProgress(0.0f);
+ TimeLine &timeline = mTimeLineWindows[w];
+ timeline.setCurveShape(TimeLine::EaseInCurve);
+ timeline.setDuration( animationTime( 250 ));
+ timeline.setProgress(0.0f);
}
void MinimizeAnimationEffect::windowUnminimized( EffectWindow* w )
{
- mTimeLineWindows[w].setCurveShape(TimeLine::EaseOutCurve);
- mTimeLineWindows[w].setDuration( animationTime( 250 ));
- mTimeLineWindows[w].setProgress(1.0f);
+ TimeLine &timeline = mTimeLineWindows[w];
+ timeline.setCurveShape(TimeLine::EaseOutCurve);
+ timeline.setDuration( animationTime( 250 ));
+ timeline.setProgress(1.0f);
}
} // namespace
diff --git a/kwin/effects/minimizeanimation/minimizeanimation.h b/kwin/effects/minimizeanimation/minimizeanimation.h
index d8abd8c..96e4578 100644
--- a/kwin/effects/minimizeanimation/minimizeanimation.h
+++ b/kwin/effects/minimizeanimation/minimizeanimation.h
@@ -42,6 +42,7 @@ class MinimizeAnimationEffect
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
virtual void postPaintScreen();
+ virtual void windowDeleted( EffectWindow* c );
virtual void windowMinimized( EffectWindow* c );
virtual void windowUnminimized( EffectWindow* c );
|