Lines 95-101
Link Here
|
95 |
, fullscreen_effect(0) |
95 |
, fullscreen_effect(0) |
96 |
, next_window_quad_type(EFFECT_QUAD_TYPE_START) |
96 |
, next_window_quad_type(EFFECT_QUAD_TYPE_START) |
97 |
, mouse_poll_ref_count(0) |
97 |
, mouse_poll_ref_count(0) |
98 |
, current_paint_effectframe(0) |
|
|
99 |
{ |
98 |
{ |
100 |
Workspace *ws = Workspace::self(); |
99 |
Workspace *ws = Workspace::self(); |
101 |
connect(ws, SIGNAL(currentDesktopChanged(int)), this, SLOT(slotDesktopChanged(int))); |
100 |
connect(ws, SIGNAL(currentDesktopChanged(int)), this, SLOT(slotDesktopChanged(int))); |
Lines 199-252
Link Here
|
199 |
// the idea is that effects call this function again which calls the next one |
198 |
// the idea is that effects call this function again which calls the next one |
200 |
void EffectsHandlerImpl::prePaintScreen(ScreenPrePaintData& data, int time) |
199 |
void EffectsHandlerImpl::prePaintScreen(ScreenPrePaintData& data, int time) |
201 |
{ |
200 |
{ |
202 |
if (current_paint_screen < loaded_effects.size()) { |
201 |
if (m_currentPaintScreenIterator != m_activeEffects.end()) { |
203 |
loaded_effects.at(current_paint_screen++).second->prePaintScreen(data, time); |
202 |
(*m_currentPaintScreenIterator++)->prePaintScreen(data, time); |
204 |
--current_paint_screen; |
203 |
--m_currentPaintScreenIterator; |
205 |
} |
204 |
} |
206 |
// no special final code |
205 |
// no special final code |
207 |
} |
206 |
} |
208 |
|
207 |
|
209 |
void EffectsHandlerImpl::paintScreen(int mask, QRegion region, ScreenPaintData& data) |
208 |
void EffectsHandlerImpl::paintScreen(int mask, QRegion region, ScreenPaintData& data) |
210 |
{ |
209 |
{ |
211 |
if (current_paint_screen < loaded_effects.size()) { |
210 |
if (m_currentPaintScreenIterator != m_activeEffects.end()) { |
212 |
loaded_effects.at(current_paint_screen++).second->paintScreen(mask, region, data); |
211 |
(*m_currentPaintScreenIterator++)->paintScreen(mask, region, data); |
213 |
--current_paint_screen; |
212 |
--m_currentPaintScreenIterator; |
214 |
} else |
213 |
} else |
215 |
scene->finalPaintScreen(mask, region, data); |
214 |
scene->finalPaintScreen(mask, region, data); |
216 |
} |
215 |
} |
217 |
|
216 |
|
218 |
void EffectsHandlerImpl::postPaintScreen() |
217 |
void EffectsHandlerImpl::postPaintScreen() |
219 |
{ |
218 |
{ |
220 |
if (current_paint_screen < loaded_effects.size()) { |
219 |
if (m_currentPaintScreenIterator != m_activeEffects.end()) { |
221 |
loaded_effects.at(current_paint_screen++).second->postPaintScreen(); |
220 |
(*m_currentPaintScreenIterator++)->postPaintScreen(); |
222 |
--current_paint_screen; |
221 |
--m_currentPaintScreenIterator; |
223 |
} |
222 |
} |
224 |
// no special final code |
223 |
// no special final code |
225 |
} |
224 |
} |
226 |
|
225 |
|
227 |
void EffectsHandlerImpl::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) |
226 |
void EffectsHandlerImpl::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) |
228 |
{ |
227 |
{ |
229 |
if (current_paint_window < loaded_effects.size()) { |
228 |
if (m_currentPaintWindowIterator != m_activeEffects.end()) { |
230 |
loaded_effects.at(current_paint_window++).second->prePaintWindow(w, data, time); |
229 |
(*m_currentPaintWindowIterator++)->prePaintWindow(w, data, time); |
231 |
--current_paint_window; |
230 |
--m_currentPaintWindowIterator; |
232 |
} |
231 |
} |
233 |
// no special final code |
232 |
// no special final code |
234 |
} |
233 |
} |
235 |
|
234 |
|
236 |
void EffectsHandlerImpl::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) |
235 |
void EffectsHandlerImpl::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) |
237 |
{ |
236 |
{ |
238 |
if (current_paint_window < loaded_effects.size()) { |
237 |
if (m_currentPaintWindowIterator != m_activeEffects.end()) { |
239 |
loaded_effects.at(current_paint_window++).second->paintWindow(w, mask, region, data); |
238 |
(*m_currentPaintWindowIterator++)->paintWindow(w, mask, region, data); |
240 |
--current_paint_window; |
239 |
--m_currentPaintWindowIterator; |
241 |
} else |
240 |
} else |
242 |
scene->finalPaintWindow(static_cast<EffectWindowImpl*>(w), mask, region, data); |
241 |
scene->finalPaintWindow(static_cast<EffectWindowImpl*>(w), mask, region, data); |
243 |
} |
242 |
} |
244 |
|
243 |
|
245 |
void EffectsHandlerImpl::paintEffectFrame(EffectFrame* frame, QRegion region, double opacity, double frameOpacity) |
244 |
void EffectsHandlerImpl::paintEffectFrame(EffectFrame* frame, QRegion region, double opacity, double frameOpacity) |
246 |
{ |
245 |
{ |
247 |
if (current_paint_effectframe < loaded_effects.size()) { |
246 |
if (m_currentPaintEffectFrameIterator != m_activeEffects.end()) { |
248 |
loaded_effects.at(current_paint_effectframe++).second->paintEffectFrame(frame, region, opacity, frameOpacity); |
247 |
(*m_currentPaintEffectFrameIterator++)->paintEffectFrame(frame, region, opacity, frameOpacity); |
249 |
--current_paint_effectframe; |
248 |
--m_currentPaintEffectFrameIterator; |
250 |
} else { |
249 |
} else { |
251 |
const EffectFrameImpl* frameImpl = static_cast<const EffectFrameImpl*>(frame); |
250 |
const EffectFrameImpl* frameImpl = static_cast<const EffectFrameImpl*>(frame); |
252 |
frameImpl->finalRender(region, opacity, frameOpacity); |
251 |
frameImpl->finalRender(region, opacity, frameOpacity); |
Lines 255-263
Link Here
|
255 |
|
254 |
|
256 |
void EffectsHandlerImpl::postPaintWindow(EffectWindow* w) |
255 |
void EffectsHandlerImpl::postPaintWindow(EffectWindow* w) |
257 |
{ |
256 |
{ |
258 |
if (current_paint_window < loaded_effects.size()) { |
257 |
if (m_currentPaintWindowIterator != m_activeEffects.end()) { |
259 |
loaded_effects.at(current_paint_window++).second->postPaintWindow(w); |
258 |
(*m_currentPaintWindowIterator++)->postPaintWindow(w); |
260 |
--current_paint_window; |
259 |
--m_currentPaintWindowIterator; |
261 |
} |
260 |
} |
262 |
// no special final code |
261 |
// no special final code |
263 |
} |
262 |
} |
Lines 272-289
Link Here
|
272 |
|
271 |
|
273 |
void EffectsHandlerImpl::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) |
272 |
void EffectsHandlerImpl::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) |
274 |
{ |
273 |
{ |
275 |
if (current_draw_window < loaded_effects.size()) { |
274 |
if (m_currentDrawWindowIterator != m_activeEffects.end()) { |
276 |
loaded_effects.at(current_draw_window++).second->drawWindow(w, mask, region, data); |
275 |
(*m_currentDrawWindowIterator++)->drawWindow(w, mask, region, data); |
277 |
--current_draw_window; |
276 |
--m_currentDrawWindowIterator; |
278 |
} else |
277 |
} else |
279 |
scene->finalDrawWindow(static_cast<EffectWindowImpl*>(w), mask, region, data); |
278 |
scene->finalDrawWindow(static_cast<EffectWindowImpl*>(w), mask, region, data); |
280 |
} |
279 |
} |
281 |
|
280 |
|
282 |
void EffectsHandlerImpl::buildQuads(EffectWindow* w, WindowQuadList& quadList) |
281 |
void EffectsHandlerImpl::buildQuads(EffectWindow* w, WindowQuadList& quadList) |
283 |
{ |
282 |
{ |
284 |
if (current_build_quads < loaded_effects.size()) { |
283 |
if (m_currentBuildQuadsIterator != m_activeEffects.end()) { |
285 |
loaded_effects.at(current_build_quads++).second->buildQuads(w, quadList); |
284 |
(*m_currentBuildQuadsIterator++)->buildQuads(w, quadList); |
286 |
--current_build_quads; |
285 |
--m_currentBuildQuadsIterator; |
287 |
} |
286 |
} |
288 |
} |
287 |
} |
289 |
|
288 |
|
Lines 305-314
Link Here
|
305 |
// start another painting pass |
304 |
// start another painting pass |
306 |
void EffectsHandlerImpl::startPaint() |
305 |
void EffectsHandlerImpl::startPaint() |
307 |
{ |
306 |
{ |
308 |
assert(current_paint_screen == 0); |
307 |
m_activeEffects.clear(); |
309 |
assert(current_paint_window == 0); |
308 |
for(QVector< KWin::EffectPair >::iterator it = loaded_effects.begin(); it != loaded_effects.end(); ++it) { |
310 |
assert(current_draw_window == 0); |
309 |
if (it->second->isActive()) { |
311 |
assert(current_build_quads == 0); |
310 |
m_activeEffects << it->second; |
|
|
311 |
} |
312 |
} |
313 |
m_currentDrawWindowIterator = m_activeEffects.begin(); |
314 |
m_currentPaintWindowIterator = m_activeEffects.begin(); |
315 |
m_currentPaintScreenIterator = m_activeEffects.begin(); |
316 |
m_currentPaintEffectFrameIterator = m_activeEffects.begin(); |
317 |
m_currentBuildQuadsIterator = m_activeEffects.begin(); |
312 |
} |
318 |
} |
313 |
|
319 |
|
314 |
void EffectsHandlerImpl::slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode) |
320 |
void EffectsHandlerImpl::slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode) |
Lines 1022-1031
Link Here
|
1022 |
bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault) |
1028 |
bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault) |
1023 |
{ |
1029 |
{ |
1024 |
Workspace::self()->addRepaintFull(); |
1030 |
Workspace::self()->addRepaintFull(); |
1025 |
assert(current_paint_screen == 0); |
|
|
1026 |
assert(current_paint_window == 0); |
1027 |
assert(current_draw_window == 0); |
1028 |
assert(current_build_quads == 0); |
1029 |
|
1031 |
|
1030 |
if (!name.startsWith(QLatin1String("kwin4_effect_"))) |
1032 |
if (!name.startsWith(QLatin1String("kwin4_effect_"))) |
1031 |
kWarning(1212) << "Effect names usually have kwin4_effect_ prefix" ; |
1033 |
kWarning(1212) << "Effect names usually have kwin4_effect_ prefix" ; |
Lines 1134-1143
Link Here
|
1134 |
void EffectsHandlerImpl::unloadEffect(const QString& name) |
1136 |
void EffectsHandlerImpl::unloadEffect(const QString& name) |
1135 |
{ |
1137 |
{ |
1136 |
Workspace::self()->addRepaintFull(); |
1138 |
Workspace::self()->addRepaintFull(); |
1137 |
assert(current_paint_screen == 0); |
|
|
1138 |
assert(current_paint_window == 0); |
1139 |
assert(current_draw_window == 0); |
1140 |
assert(current_build_quads == 0); |
1141 |
|
1139 |
|
1142 |
for (QMap< int, EffectPair >::iterator it = effect_order.begin(); it != effect_order.end(); ++it) { |
1140 |
for (QMap< int, EffectPair >::iterator it = effect_order.begin(); it != effect_order.end(); ++it) { |
1143 |
if (it.value().first == name) { |
1141 |
if (it.value().first == name) { |