diff options
author | Richard Grenville <[email protected]> | 2012-09-26 21:40:48 +0800 |
---|---|---|
committer | Richard Grenville <[email protected]> | 2012-09-26 21:47:32 +0800 |
commit | 280bc0fc324953e8d2cc14f13e282393a797e4e0 (patch) | |
tree | 4df3178bebe2c969769cc494216e61f5e5bd5b55 | |
parent | 10ede8999852630fd375f3eb11e501f0e60eee4e (diff) | |
download | tdebase-280bc0fc324953e8d2cc14f13e282393a797e4e0.tar.gz tdebase-280bc0fc324953e8d2cc14f13e282393a797e4e0.zip |
Feature: --no-fading-openclose to partially simulate -F
-F hasn't being working for long. This commit adds a switch
--no-fading-openclose (and a configuration file option of the same name)
to simulate the behavior when only -F is enabled, which disables fading
when opening/closing windows, and makes -F an alias for -f.
-rw-r--r-- | compton.c | 41 | ||||
-rw-r--r-- | compton.h | 5 |
2 files changed, 37 insertions, 9 deletions
@@ -118,7 +118,7 @@ static options_t opts = { .fade_in_step = 0.028 * OPAQUE, .fade_out_step = 0.03 * OPAQUE, .fade_delta = 10, - .fade_trans = False, + .no_fading_openclose = False, .clear_shadow = False, .inactive_opacity = 0, .inactive_opacity_override = False, @@ -1594,14 +1594,23 @@ map_win(Display *dpy, Window id, // Window type change could affect shadow and fade determine_shadow(dpy, w); - determine_fade(dpy, w); // Determine mode here just in case the colormap changes determine_mode(dpy, w); // Fading in calc_opacity(dpy, w, True); - set_fade_callback(dpy, w, NULL, True); + + if (opts.no_fading_openclose) { + set_fade_callback(dpy, w, finish_map_win, True); + // Must be set after we execute the old fade callback, in case we + // receive two continuous MapNotify for the same window + w->fade = False; + } + else { + set_fade_callback(dpy, w, NULL, True); + determine_fade(dpy, w); + } calc_dim(dpy, w); @@ -1621,6 +1630,12 @@ map_win(Display *dpy, Window id, } static void +finish_map_win(Display *dpy, win *w) { + if (opts.no_fading_openclose) + determine_fade(dpy, w); +} + +static void finish_unmap_win(Display *dpy, win *w) { w->damaged = 0; #if CAN_DO_USABLE @@ -1658,6 +1673,8 @@ unmap_win(Display *dpy, Window id, Bool fade) { // Fading out w->opacity_tgt = 0; set_fade_callback(dpy, w, unmap_callback, False); + if (opts.no_fading_openclose) + w->fade = False; // don't care about properties anymore // Will get BadWindow if the window is destroyed @@ -2854,9 +2871,10 @@ usage(void) { "-z\n" " Zero the part of the shadow's mask behind the window (experimental).\n" "-f\n" - " Fade windows in/out when opening/closing.\n" + " Fade windows in/out when opening/closing and when opacity\n" + " changes, unless --no-fading-openclose is used.\n" "-F\n" - " Fade windows during opacity changes.\n" + " Equals -f. Deprecated.\n" "-i opacity\n" " Opacity of inactive windows. (0.1 - 1.0)\n" "-e opacity\n" @@ -2885,6 +2903,8 @@ usage(void) { " Exclude conditions for shadows.\n" "--mark-ovredir-focused\n" " Mark over-redirect windows as active.\n" + "--no-fading-openclose\n" + " Do not fade on window open/close.\n" "\n" "Format of a condition:\n" "\n" @@ -3119,6 +3139,8 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) { // -f (fading_enable) if (config_lookup_bool(&cfg, "fading", &ival) && ival) wintype_arr_enable(opts.wintype_fade); + // --no-fading-open-close + lcfg_lookup_bool(&cfg, "no-fading-openclose", &opts.no_fading_openclose); // --shadow-red config_lookup_float(&cfg, "shadow-red", &opts.shadow_red); // --shadow-green @@ -3194,6 +3216,7 @@ get_cfg(int argc, char *const *argv) { { "mark-wmwin-focused", no_argument, NULL, 262 }, { "shadow-exclude", required_argument, NULL, 263 }, { "mark-ovredir-focused", no_argument, NULL, 264 }, + { "no-fading-openclose", no_argument, NULL, 265 }, // Must terminate with a NULL entry { NULL, 0, NULL, 0 }, }; @@ -3258,10 +3281,8 @@ get_cfg(int argc, char *const *argv) { cfgtmp.menu_opacity = atof(optarg); break; case 'f': - fading_enable = True; - break; case 'F': - opts.fade_trans = True; + fading_enable = True; break; case 'S': opts.synchronize = True; @@ -3332,6 +3353,10 @@ get_cfg(int argc, char *const *argv) { // --mark-ovredir-focused opts.mark_ovredir_focused = True; break; + case 265: + // --no-fading-openclose + opts.no_fading_openclose = True; + break; default: usage(); break; @@ -270,7 +270,7 @@ typedef struct _options { /// How much to fade out in a single fading step. opacity_t fade_out_step; unsigned long fade_delta; - Bool fade_trans; + Bool no_fading_openclose; /// Fading blacklist. A linked list of conditions. wincond *fade_blacklist; @@ -726,6 +726,9 @@ map_win(Display *dpy, Window id, Bool override_redirect); static void +finish_map_win(Display *dpy, win *w); + +static void finish_unmap_win(Display *dpy, win *w); #if HAS_NAME_WINDOW_PIXMAP |