From e58128970fb942f34f7e8c274d898c36e67bae98 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 16 Mar 2008 12:58:56 -0400 Subject: [PATCH] make fading optional --- dcompmgr.c | 11 ++++++++++- fade.c | 20 +++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/dcompmgr.c b/dcompmgr.c index b114cbf..bcc7ce1 100644 --- a/dcompmgr.c +++ b/dcompmgr.c @@ -29,6 +29,7 @@ typedef enum { typedef struct { render_type_t render; + gboolean fade; } d_options_t; static gboolean quit = FALSE; @@ -44,6 +45,8 @@ print_help(void) "Options:\n" " --gl Use OpenGL for drawing\n" " --xrender Use XRender for drawing (the default)\n" +" --fade Fade windows in and out of existence (the default)\n" +" --no-fade Don't fade windows in and out\n" "\n" "Copyright (C) 2008 Dana Jansens\n" "\n" @@ -57,12 +60,17 @@ read_options(int argc, char **argv, d_options_t *opts) int i; opts->render = USE_RENDER; + opts->fade = TRUE; for (i = 1; i < argc; ++i) { if (strcmp(argv[i], "--gl") == 0) opts->render = USE_OPENGL; else if (strcmp(argv[i], "--xrender") == 0) opts->render = USE_RENDER; + else if (strcmp(argv[i], "--fade") == 0) + opts->fade = TRUE; + else if (strcmp(argv[i], "--no-fade") == 0) + opts->fade = FALSE; else if (strcmp(argv[i], "--help") == 0) { print_help(); exit(0); @@ -459,7 +467,8 @@ setup_functions(d_display_t *dpy, d_options_t *opts) else glxrender_init(sc, id++); - fade_init(sc, id++); + if (opts->fade) + fade_init(sc, id++); } } diff --git a/fade.c b/fade.c index 74308e4..e2946e7 100644 --- a/fade.c +++ b/fade.c @@ -69,15 +69,17 @@ fade_free(d_screen_t *sc) d = screen_find_plugin_data(sc, plugin_id); screen_remove_plugin_data(sc, plugin_id); - for (it = list_top(d->fades); it; it = it->next) { - fade_t *fade = it->data; - window_set_opacity(fade->w, 0xffff); - window_zombie_unref(fade->w); - window_unref(fade->w); - free(fade); + if (d) { + for (it = list_top(d->fades); it; it = it->next) { + fade_t *fade = it->data; + window_set_opacity(fade->w, 0xffff); + window_zombie_unref(fade->w); + window_unref(fade->w); + free(fade); + } + list_unref(d->fades); + free(d); } - list_unref(d->fades); - free(d); } static void @@ -198,7 +200,7 @@ fade_next_timeout(struct d_screen *sc, struct timeval *tv) d = screen_find_plugin_data(sc, plugin_id); - if (list_length(d->fades) == 0) + if (!d || list_length(d->fades) == 0) return FALSE; else { *tv = d->next_timeout; -- 2.34.1