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)
sc->window_hide = fade_window_hide;
d->fades = list_new();
- d->fade_step_time = 10000; /* 5 milliseconds */
- d->fade_total_time = 200000; /* 0.15 seconds */
+ d->fade_step_time = 5000; /* 5 milliseconds */
+ d->fade_total_time = 180000; /* 0.18 seconds */
}
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
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;
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
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