void TranslucencyEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) { // We keep track of the windows that was last active so we know // which one to fade out and which ones to paint as fully inactive if (w == active && w != current) { previous = current; current = w; } moveresize_timeline.setCurrentTime(moveresize_timeline.currentTime() + time); activeinactive_timeline.setCurrentTime(activeinactive_timeline.currentTime() + time); if (decoration != 1.0 && w->hasDecoration()) { data.mask |= PAINT_WINDOW_TRANSLUCENT; // don't clear PAINT_WINDOW_OPAQUE, contents are not affected data.clip &= w->contentsRect().translated(w->pos()); // decoration cannot clip } if (inactive != 1.0 && (isInactive(w) || activeinactive_timeline.currentValue() < 1.0)) data.setTranslucent(); else if (moveresize != 1.0 && (w->isUserMove() || w->isUserResize() || w == fadeout)) { data.setTranslucent(); } else if (dialogs != 1.0 && w->isDialog()) { data.setTranslucent(); } else if ((dropdownmenus != 1.0 && w->isDropdownMenu()) || (popupmenus != 1.0 && w->isPopupMenu()) || (tornoffmenus != 1.0 && w->isMenu()) || (comboboxpopups != 1.0 && w->isComboBox())) { data.setTranslucent(); } effects->prePaintWindow(w, data, time); }
void HighlightWindowEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) { // Calculate window opacities QHash<EffectWindow*, float>::iterator opacity = m_windowOpacity.find(w); if (!m_highlightedWindows.isEmpty()) { // Initial fade out and changing highlight animation if (opacity == m_windowOpacity.end()) opacity = m_windowOpacity.insertMulti(w, 0.0f); float oldOpacity = *opacity; if (m_highlightedWindows.contains(w)) *opacity = qMin(1.0f, oldOpacity + time / m_fadeDuration); else if (w->isNormalWindow() || w->isDialog()) // Only fade out windows *opacity = qMax(isInitiallyHidden(w) ? 0.0f : 0.15f, oldOpacity - time / m_fadeDuration); if (*opacity < 0.98f) data.setTranslucent(); if (oldOpacity != *opacity) effects->addRepaint(w->geometry().adjusted(-16,-16,16,32)); // add some padding. w->addRepaintFull() is wrong for at least isInitiallyHidden ... } else if (m_finishing && m_windowOpacity.contains(w)) { // Final fading back in animation if (opacity == m_windowOpacity.end()) opacity = m_windowOpacity.insert(w, 0.0f); float oldOpacity = *opacity; if (isInitiallyHidden(w)) *opacity = qMax(0.0f, oldOpacity - time / m_fadeDuration); else *opacity = qMin(1.0f, oldOpacity + time / m_fadeDuration); if (*opacity < 0.98f) data.setTranslucent(); if (oldOpacity != *opacity) effects->addRepaint(w->geometry().adjusted(-16,-16,16,32)); // ... see above ... because the window is pot. gone in the last pass if (*opacity > 0.98f || *opacity < 0.02f) m_windowOpacity.remove(w); // We default to 1.0 } // Show tabbed windows and windows on other desktops if highlighted if (opacity != m_windowOpacity.end() && *opacity > 0.01) { if (w->isMinimized()) w->enablePainting(EffectWindow::PAINT_DISABLED_BY_MINIMIZE); if (!w->isCurrentTab()) w->enablePainting(EffectWindow::PAINT_DISABLED_BY_TAB_GROUP); if (!w->isOnCurrentDesktop()) w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); } effects->prePaintWindow(w, data, time); }
void KscreenEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) { if (m_state != StateNormal) { data.setTranslucent(); } effects->prePaintWindow(w, data, time); }
void MinimizeAnimationEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) { if( mTimeLineWindows.contains( w )) { if( w->isMinimized() ) { mTimeLineWindows[w].addTime(time); if( mTimeLineWindows[w].progress() >= 1.0f ) mTimeLineWindows.remove( w ); } else { mTimeLineWindows[w].removeTime(time); if( mTimeLineWindows[w].progress() <= 0.0f ) mTimeLineWindows.remove( w ); } // 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 ); }
void LoginEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) { if( progress != 1.0 && w == login_window ) { w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE ); data.setTranslucent(); } effects->prePaintWindow( w, data, time ); }
void ExplosionEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) { if (mWindows.contains(w)) { if (mValid) { mWindows[ w ] += time / animationTime(700.0); // complete change in 700ms if (mWindows[ w ] < 1) { data.setTranslucent(); data.setTransformed(); w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE); } else { mWindows.remove(w); w->unrefWindow(); mActiveAnimations--; } } } effects->prePaintWindow(w, data, time); }
void ScaleInEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) { if (mTimeLineWindows.contains(w)) { mTimeLineWindows[ w ]->setCurveShape(QTimeLine::EaseInOutCurve); mTimeLineWindows[ w ]->setCurrentTime(mTimeLineWindows[ w ]->currentTime() + time); if (mTimeLineWindows[ w ]->currentValue() < 1) data.setTransformed(); else delete mTimeLineWindows.take(w); } effects->prePaintWindow(w, data, time); }
void DrunkenEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) { if( windows.contains( w )) { windows[ w ] += time / 1000.; if( windows[ w ] < 1 ) data.setTransformed(); else windows.remove( w ); } effects->prePaintWindow( w, data, time ); }
void PulseEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) { if( mTimeLineWindows.contains( w ) ) { mTimeLineWindows[ w ].second.addTime( time ); if( mTimeLineWindows[ w ].second.value() < 1 ) data.setTransformed(); else if ( !mTimeLineWindows[ w ].first ) { // zoom complete, now pulse mTimeLineWindows[ w ].first = true; TimeLine& t = mTimeLineWindows[ w ].second; t.setCurveShape( TimeLine::EaseOutCurve ); t.setDuration( animationTime( mPulseDuration ) ); t.setProgress( 0.0 ); data.setTransformed(); } else mTimeLineWindows.remove( w ); } effects->prePaintWindow( w, data, time ); }
void SlideEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) { if( slide ) { if( w->isOnAllDesktops()) { if( slide_painting_sticky ) data.setTransformed(); else w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); } else if( w->isOnDesktop( painting_desktop )) w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); else w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); } effects->prePaintWindow( w, data, time ); }
void FlameEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) { if( windows.contains( w )) { if( windows[ w ] < 1 ) { windows[ w ] += time / 500.; data.setTransformed(); w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE ); data.quads = data.quads.splitAtY( windows[ w ] * w->height()); } else { windows.remove( w ); w->unrefWindow(); } } effects->prePaintWindow( w, data, time ); }
void GlideEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) { InfoHash::iterator info = windows.find(w); if (info != windows.end()) { data.setTransformed(); if (info->added) info->timeLine->setCurrentTime(info->timeLine->currentTime() + time); else if (info->closed) { info->timeLine->setCurrentTime(info->timeLine->currentTime() - time); if (info->deleted) w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE); } } effects->prePaintWindow(w, data, time); // if the window isn't to be painted, then let's make sure // to track its progress if (info != windows.end() && !w->isPaintingEnabled() && !effects->activeFullScreenEffect()) w->addRepaintFull(); }
void WobblyWindowsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) { if (windows.contains(w)) { data.setTransformed(); data.quads = data.quads.makeRegularGrid(m_xTesselation, m_yTesselation); bool stop = false; qreal updateTime = time; while (!stop && (updateTime > maxTime)) { #if defined VERBOSE_MODE qCDebug(KWINEFFECTS) << "loop time " << updateTime << " / " << time; #endif stop = !updateWindowWobblyDatas(w, maxTime); updateTime -= maxTime; } if (!stop && updateTime > 0) { updateWindowWobblyDatas(w, updateTime); } } effects->prePaintWindow(w, data, time); }
void SlidingPopupsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) { qreal progress = 1.0; bool appearing = false; if (mAppearingWindows.contains(w)) { mAppearingWindows[ w ]->setCurrentTime(mAppearingWindows[ w ]->currentTime() + time); if (mAppearingWindows[ w ]->currentValue() < 1) { data.setTransformed(); progress = mAppearingWindows[ w ]->currentValue(); appearing = true; } else { delete mAppearingWindows.take(w); w->setData(WindowForceBlurRole, false); } } else if (mDisappearingWindows.contains(w)) { mDisappearingWindows[ w ]->setCurrentTime(mDisappearingWindows[ w ]->currentTime() + time); progress = mDisappearingWindows[ w ]->currentValue(); if (progress != 1.0) { data.setTransformed(); w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE); } else { delete mDisappearingWindows.take(w); w->addRepaintFull(); w->unrefWindow(); } } if (progress != 1.0) { const int start = mWindowsData[ w ].start; if (start != 0) { const QRect screenRect = effects->clientArea(FullScreenArea, w->screen(), effects->currentDesktop()); const QRect geo = w->expandedGeometry(); // filter out window quads, but only if the window does not start from the edge switch(mWindowsData[ w ].from) { case West: { const double splitPoint = geo.width() - (geo.x() + geo.width() - screenRect.x() - start) + geo.width() * (appearing ? 1.0 - progress : progress); data.quads = data.quads.splitAtX(splitPoint); WindowQuadList filtered; foreach (const WindowQuad &quad, data.quads) { if (quad.left() >= splitPoint) { filtered << quad; } } data.quads = filtered; break; } case North: { const double splitPoint = geo.height() - (geo.y() + geo.height() - screenRect.y() - start) + geo.height() * (appearing ? 1.0 - progress : progress); data.quads = data.quads.splitAtY(splitPoint); WindowQuadList filtered; foreach (const WindowQuad &quad, data.quads) { if (quad.top() >= splitPoint) { filtered << quad; } } data.quads = filtered; break; } case East: { const double splitPoint = screenRect.x() + screenRect.width() - geo.x() - start - geo.width() * (appearing ? 1.0 - progress : progress); data.quads = data.quads.splitAtX(splitPoint); WindowQuadList filtered; foreach (const WindowQuad &quad, data.quads) { if (quad.right() <= splitPoint) { filtered << quad; } } data.quads = filtered; break; } case South: default: { const double splitPoint = screenRect.y() + screenRect.height() - geo.y() - start - geo.height() * (appearing ? 1.0 - progress : progress); data.quads = data.quads.splitAtY(splitPoint); WindowQuadList filtered; foreach (const WindowQuad &quad, data.quads) { if (quad.bottom() <= splitPoint) { filtered << quad; } } data.quads = filtered; break; } } } } effects->prePaintWindow(w, data, time); }