void DimInactiveEffect::slotWindowActivated(EffectWindow* w) { if (active != NULL) { previousActive = active; previousActiveTimeline.setCurrentTime(0); if (!dimWindow(previousActive)) previousActive = NULL; if (dim_by_group) { if ((w == NULL || w->group() != active->group()) && active->group() != NULL) { // repaint windows that are no longer in the active group foreach (EffectWindow * tmp, active->group()->members()) tmp->addRepaintFull(); } } else active->addRepaintFull(); } active = w; if (active != NULL) { if (dim_by_group) { if (active->group() != NULL) { // repaint newly active windows foreach (EffectWindow * tmp, active->group()->members()) tmp->addRepaintFull(); } } else active->addRepaintFull(); } }
void DimInactiveEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) { if (dimWindow(w) || w == previousActive) { double previous = 1.0; if (w == previousActive) previous = previousActiveTimeline.currentValue(); if (previousActiveTimeline.currentValue() == 1.0) previousActive = NULL; data.multiplyBrightness((1.0 - (dim_strength / 100.0) * timeline.currentValue() * previous)); data.multiplySaturation((1.0 - (dim_strength / 100.0) * timeline.currentValue() * previous)); } effects->paintWindow(w, mask, region, data); }
/* Walk through all windows, skip until we've passed the active * window, skip if it's invisible, hidden or minimized, skip if * it's not a window type we're looking for. * Dim it if it intersects. * * Returns number of changed windows. */ static int passiveWindows (CompScreen *s, Region region) { CompWindow *w; Bool flag = FALSE; int i = 0; OPACIFY_SCREEN (s); for (w = s->windows; w; w = w->next) { if (w->id == os->active) { flag = TRUE; continue; } if (!flag) continue; if (!matchEval (&os->window_match, w)) continue; if (w->invisible || w->hidden || w->minimized) continue; XIntersectRegion (w->region, region, os->intersect); if (!XEmptyRegion (os->intersect)) { dimWindow (w); i++; } } return i; }