/* Check if we switched active window, reset the old passive windows * if we did. If we have an active window and switched: reset that too. * If we have a window (w is true), update the active id and * passive list. justMoved is to make sure we recalculate opacity after * moving. We can't reset before moving because if we're using a delay * and the window being moved is not the active but overlapping, it will * be reset, which would conflict with move's opacity change. */ static void opacifyHandleEnter (CompScreen *s, CompWindow *w) { OPACIFY_SCREEN (s); if (otherScreenGrabExist (s, NULL)) { if (!otherScreenGrabExist (s, "move", NULL)) { os->justMoved = TRUE; return; } clearPassive (s); resetOpacity (s, os->active); os->active = 0; return; } if (!w || os->active != w->id || os->justMoved) { os->justMoved = FALSE; clearPassive (s); resetOpacity (s, os->active); os->active = 0; } if (!w) return; if (w->id != os->active && !w->shaded && matchEval (&os->window_match, w)) { int num; os->active = w->id; num = passiveWindows (s, w->region); const BananaValue * option_only_if_block = bananaGetOption (bananaIndex, "only_if_block", s->screenNum); const BananaValue * option_active_opacity = bananaGetOption (bananaIndex, "active_opacity", s->screenNum); if (num || option_only_if_block->b) setOpacity (w, MAX (OPAQUE * option_active_opacity->i / 100, w->paint.opacity)); } }
/* Toggle opacify on/off. We are in Display-context, make sure we handle all * screens. */ static void opacifyToggle (void) { OPACIFY_DISPLAY (&display); od->toggle = !od->toggle; const BananaValue * option_toggle_reset = bananaGetOption (bananaIndex, "toggle_reset", -1); if (!od->toggle && option_toggle_reset->b) { CompScreen *s; for (s = display.screens; s; s = s->next) { OPACIFY_SCREEN (s); if (os->active) { clearPassive (s); resetOpacity (s, os->active); os->active = 0; } } } }
/* Check if we are on the same screen. We only want opacify active on * one screen, so if we are on a diffrent screen, we reset the old one. * Returns True if the screen has switched. */ static Bool checkScreenSwitch (CompScreen *s) { CompScreen *tmp; OPACIFY_DISPLAY (&display); if (od->activeScreen == s->screenNum) return FALSE; for (tmp = display.screens; tmp; tmp = tmp->next) { OPACIFY_SCREEN (tmp); clearPassive (tmp); resetOpacity (tmp, os->active); os->active = 0; } od->activeScreen = s->screenNum; return TRUE; }
void Painter::resetState() { resetColor(); resetOpacity(); resetCompositionMode(); resetClipRect(); resetShaderProgram(); resetTexture(); resetAlphaWriting(); }
/* Resets the opacity of windows on the passive list. */ static void clearPassive (CompScreen *s) { int i; OPACIFY_SCREEN (s); for (i = 0; i < os->passiveNum; i++) resetOpacity (s, os->passive[i]); os->passiveNum = 0; }