Remove win::*_last

A side effect of this is that some window properties are allowed to
change during fade-in/out. (e.g. window background can become blurred
during window fade out if window properties changed so blur is requirired).
But it is unclear what is the expected behaviour in this case anyway, so we
choose the one that is simpler to implement.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-17 18:09:22 +00:00
parent ed4202b52f
commit 635351c820
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
3 changed files with 1 additions and 23 deletions

View File

@ -498,14 +498,6 @@ paint_preprocess(session_t *ps, win *list, bool *fade_running) {
const winmode_t mode_old = w->mode; const winmode_t mode_old = w->mode;
const bool was_painted = w->to_paint; const bool was_painted = w->to_paint;
const opacity_t opacity_old = w->opacity; const opacity_t opacity_old = w->opacity;
// Restore flags from last paint if the window is being faded out
// TODO probably should just stop updating window flags when window
// is fading out
if (w->state == WSTATE_UNMAPPING || w->state == WSTATE_DESTROYING) {
win_set_shadow(ps, w, w->shadow_last);
win_set_invert_color(ps, w, w->invert_color_last);
win_set_blur_background(ps, w, w->blur_background_last);
}
if (win_should_dim(ps, w) != w->dim) { if (win_should_dim(ps, w) != w->dim) {
w->dim = win_should_dim(ps, w); w->dim = win_should_dim(ps, w);
@ -648,13 +640,6 @@ paint_preprocess(session_t *ps, win *list, bool *fade_running) {
// Avoid setting w->to_paint if w is freed // Avoid setting w->to_paint if w is freed
if (w) { if (w) {
w->to_paint = to_paint; w->to_paint = to_paint;
if (w->to_paint) {
// Save flags
w->shadow_last = w->shadow;
w->invert_color_last = w->invert_color;
w->blur_background_last = w->blur_background;
}
} }
} }

View File

@ -387,7 +387,6 @@ bool win_should_dim(session_t *ps, const win *w) {
*/ */
bool win_should_fade(session_t *ps, const win *w) { bool win_should_fade(session_t *ps, const win *w) {
// To prevent it from being overwritten by last-paint value if the window is // To prevent it from being overwritten by last-paint value if the window is
// unmapped on next frame, write w->fade_last as well
if (w->fade_force != UNSET) { if (w->fade_force != UNSET) {
return w->fade_force; return w->fade_force;
} }
@ -1405,7 +1404,7 @@ unmap_win(session_t *ps, win **_w, bool destroy) {
if (unlikely(w->state == WSTATE_UNMAPPED)) { if (unlikely(w->state == WSTATE_UNMAPPED)) {
if (unlikely(!destroy)) { if (unlikely(!destroy)) {
log_warn("Unmapping an already unmapped window twice"); log_warn("Unmapping an already unmapped window %#010x %s twice", w->id, w->name);
return; return;
} }
// Window is already unmapped, just destroy it // Window is already unmapped, just destroy it

View File

@ -247,8 +247,6 @@ struct win {
// Shadow-related members // Shadow-related members
/// Whether a window has shadow. Calculated. /// Whether a window has shadow. Calculated.
bool shadow; bool shadow;
/// Shadow state on last paint.
bool shadow_last;
/// Override value of window shadow state. Set by D-Bus method calls. /// Override value of window shadow state. Set by D-Bus method calls.
switch_t shadow_force; switch_t shadow_force;
/// Opacity of the shadow. Affected by window opacity and frame opacity. /// Opacity of the shadow. Affected by window opacity and frame opacity.
@ -273,16 +271,12 @@ struct win {
/// Whether to invert window color. /// Whether to invert window color.
bool invert_color; bool invert_color;
/// Color inversion state on last paint.
bool invert_color_last;
/// Override value of window color inversion state. Set by D-Bus method /// Override value of window color inversion state. Set by D-Bus method
/// calls. /// calls.
switch_t invert_color_force; switch_t invert_color_force;
/// Whether to blur window background. /// Whether to blur window background.
bool blur_background; bool blur_background;
/// Background state on last paint.
bool blur_background_last;
#ifdef CONFIG_OPENGL #ifdef CONFIG_OPENGL
/// Textures and FBO background blur use. /// Textures and FBO background blur use.