From 76927665d71059ba0c4ea3509f300f844d0ec5db Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 6 Mar 2008 11:08:29 -0500 Subject: [PATCH] make sure that when a window is shown it stops being a zombie --- fade.c | 35 +++++++++++++++++++++++++---------- window.c | 2 ++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/fade.c b/fade.c index 9ba6c49..3ce8ab3 100644 --- a/fade.c +++ b/fade.c @@ -36,7 +36,8 @@ typedef struct { static void fade_window_show(d_window_t *w); static void fade_window_hide(d_window_t *w); -static void start_fade(d_window_t *w, uint16_t start, uint16_t end); +static void start_fade(d_window_t *w, uint16_t start_alpha, uint16_t end_alpha, + gboolean refalways); void fade_init(d_screen_t *sc, int id) @@ -53,7 +54,7 @@ fade_init(d_screen_t *sc, int id) d->fades = list_new(); d->fade_step_time = 5000; /* 5 milliseconds */ - d->fade_total_time = 166000; /* 0.15 seconds */ + d->fade_total_time = 180000; /* 0.18 seconds */ } void @@ -80,12 +81,24 @@ static void fade_window_show(d_window_t *w) { data_t *d; - - if (!window_is_input_only(w)) - start_fade(w, 0x0000, 0xffff); + d_list_it_t *it; d = screen_find_plugin_data(w->sc, plugin_id); + + /* kill the zombies off cuz a new copy is being shown */ + for (it = list_top(d->fades); it; it = it->next) { + fade_t *fade = it->data; + if (fade->w == w) { + window_zombie_unref(w); + window_unref(w); + break; + } + } + d->window_show(w); + + if (!window_is_input_only(w)) + start_fade(w, 0x2000, 0xffff, TRUE); } static void @@ -94,14 +107,15 @@ fade_window_hide(d_window_t *w) data_t *d; if (!window_is_input_only(w)) - start_fade(w, 0xffff, 0x0000); + start_fade(w, 0xffff, 0x0002, FALSE); d = screen_find_plugin_data(w->sc, plugin_id); d->window_hide(w); } static void -start_fade(d_window_t *w, uint16_t start_alpha, uint16_t end_alpha) +start_fade(d_window_t *w, uint16_t start_alpha, uint16_t end_alpha, + gboolean refalways) { data_t *d; d_list_it_t *it; @@ -142,9 +156,6 @@ start_fade(d_window_t *w, uint16_t start_alpha, uint16_t end_alpha) fade->current_alpha = start_alpha; window_set_opacity(w, fade->current_alpha); - - window_ref(w); - window_zombie_ref(w); } else { /* figure out how far we have to go to finish the fade from where @@ -165,6 +176,10 @@ start_fade(d_window_t *w, uint16_t start_alpha, uint16_t end_alpha) fade->end_time = now; time_add(&fade->end_time, percent*d->fade_total_time); } + if (newfade || refalways) { + window_zombie_ref(w); + window_ref(w); + } } int diff --git a/window.c b/window.c index cc579a5..0662acf 100644 --- a/window.c +++ b/window.c @@ -202,6 +202,8 @@ window_show(d_window_t *pubw) xcb_change_window_attributes(w->sc->dpy->conn, w->id, XCB_CW_EVENT_MASK, &mask); + assert(w->zombieref == 0); + window_update_pixmap(w); window_update_region(w); window_update_user_opacity(pubw); -- 1.9.1