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.
This commit is contained in:
parent
8c0379180b
commit
75ebe94bb6
|
@ -24,6 +24,7 @@ fading = true;
|
||||||
# fade-delta = 30
|
# fade-delta = 30
|
||||||
fade-in-step = 0.03
|
fade-in-step = 0.03
|
||||||
fade-out-step = 0.03
|
fade-out-step = 0.03
|
||||||
|
# no-fading-openclose = true;
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
mark-wmwin-focused = true;
|
mark-wmwin-focused = true;
|
||||||
|
|
|
@ -118,7 +118,7 @@ static options_t opts = {
|
||||||
.fade_in_step = 0.028 * OPAQUE,
|
.fade_in_step = 0.028 * OPAQUE,
|
||||||
.fade_out_step = 0.03 * OPAQUE,
|
.fade_out_step = 0.03 * OPAQUE,
|
||||||
.fade_delta = 10,
|
.fade_delta = 10,
|
||||||
.fade_trans = False,
|
.no_fading_openclose = False,
|
||||||
.clear_shadow = False,
|
.clear_shadow = False,
|
||||||
.inactive_opacity = 0,
|
.inactive_opacity = 0,
|
||||||
.inactive_opacity_override = False,
|
.inactive_opacity_override = False,
|
||||||
|
@ -1594,14 +1594,23 @@ map_win(Display *dpy, Window id,
|
||||||
|
|
||||||
// Window type change could affect shadow and fade
|
// Window type change could affect shadow and fade
|
||||||
determine_shadow(dpy, w);
|
determine_shadow(dpy, w);
|
||||||
determine_fade(dpy, w);
|
|
||||||
|
|
||||||
// Determine mode here just in case the colormap changes
|
// Determine mode here just in case the colormap changes
|
||||||
determine_mode(dpy, w);
|
determine_mode(dpy, w);
|
||||||
|
|
||||||
// Fading in
|
// Fading in
|
||||||
calc_opacity(dpy, w, True);
|
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);
|
calc_dim(dpy, w);
|
||||||
|
|
||||||
|
@ -1620,6 +1629,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
|
static void
|
||||||
finish_unmap_win(Display *dpy, win *w) {
|
finish_unmap_win(Display *dpy, win *w) {
|
||||||
w->damaged = 0;
|
w->damaged = 0;
|
||||||
|
@ -1658,6 +1673,8 @@ unmap_win(Display *dpy, Window id, Bool fade) {
|
||||||
// Fading out
|
// Fading out
|
||||||
w->opacity_tgt = 0;
|
w->opacity_tgt = 0;
|
||||||
set_fade_callback(dpy, w, unmap_callback, False);
|
set_fade_callback(dpy, w, unmap_callback, False);
|
||||||
|
if (opts.no_fading_openclose)
|
||||||
|
w->fade = False;
|
||||||
|
|
||||||
// don't care about properties anymore
|
// don't care about properties anymore
|
||||||
// Will get BadWindow if the window is destroyed
|
// Will get BadWindow if the window is destroyed
|
||||||
|
@ -2854,9 +2871,10 @@ usage(void) {
|
||||||
"-z\n"
|
"-z\n"
|
||||||
" Zero the part of the shadow's mask behind the window (experimental).\n"
|
" Zero the part of the shadow's mask behind the window (experimental).\n"
|
||||||
"-f\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"
|
"-F\n"
|
||||||
" Fade windows during opacity changes.\n"
|
" Equals -f. Deprecated.\n"
|
||||||
"-i opacity\n"
|
"-i opacity\n"
|
||||||
" Opacity of inactive windows. (0.1 - 1.0)\n"
|
" Opacity of inactive windows. (0.1 - 1.0)\n"
|
||||||
"-e opacity\n"
|
"-e opacity\n"
|
||||||
|
@ -2885,6 +2903,8 @@ usage(void) {
|
||||||
" Exclude conditions for shadows.\n"
|
" Exclude conditions for shadows.\n"
|
||||||
"--mark-ovredir-focused\n"
|
"--mark-ovredir-focused\n"
|
||||||
" Mark over-redirect windows as active.\n"
|
" Mark over-redirect windows as active.\n"
|
||||||
|
"--no-fading-openclose\n"
|
||||||
|
" Do not fade on window open/close.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Format of a condition:\n"
|
"Format of a condition:\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -3119,6 +3139,8 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) {
|
||||||
// -f (fading_enable)
|
// -f (fading_enable)
|
||||||
if (config_lookup_bool(&cfg, "fading", &ival) && ival)
|
if (config_lookup_bool(&cfg, "fading", &ival) && ival)
|
||||||
wintype_arr_enable(opts.wintype_fade);
|
wintype_arr_enable(opts.wintype_fade);
|
||||||
|
// --no-fading-open-close
|
||||||
|
lcfg_lookup_bool(&cfg, "no-fading-openclose", &opts.no_fading_openclose);
|
||||||
// --shadow-red
|
// --shadow-red
|
||||||
config_lookup_float(&cfg, "shadow-red", &opts.shadow_red);
|
config_lookup_float(&cfg, "shadow-red", &opts.shadow_red);
|
||||||
// --shadow-green
|
// --shadow-green
|
||||||
|
@ -3194,6 +3216,7 @@ get_cfg(int argc, char *const *argv) {
|
||||||
{ "mark-wmwin-focused", no_argument, NULL, 262 },
|
{ "mark-wmwin-focused", no_argument, NULL, 262 },
|
||||||
{ "shadow-exclude", required_argument, NULL, 263 },
|
{ "shadow-exclude", required_argument, NULL, 263 },
|
||||||
{ "mark-ovredir-focused", no_argument, NULL, 264 },
|
{ "mark-ovredir-focused", no_argument, NULL, 264 },
|
||||||
|
{ "no-fading-openclose", no_argument, NULL, 265 },
|
||||||
// Must terminate with a NULL entry
|
// Must terminate with a NULL entry
|
||||||
{ NULL, 0, NULL, 0 },
|
{ NULL, 0, NULL, 0 },
|
||||||
};
|
};
|
||||||
|
@ -3258,10 +3281,8 @@ get_cfg(int argc, char *const *argv) {
|
||||||
cfgtmp.menu_opacity = atof(optarg);
|
cfgtmp.menu_opacity = atof(optarg);
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
fading_enable = True;
|
|
||||||
break;
|
|
||||||
case 'F':
|
case 'F':
|
||||||
opts.fade_trans = True;
|
fading_enable = True;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
opts.synchronize = True;
|
opts.synchronize = True;
|
||||||
|
@ -3332,6 +3353,10 @@ get_cfg(int argc, char *const *argv) {
|
||||||
// --mark-ovredir-focused
|
// --mark-ovredir-focused
|
||||||
opts.mark_ovredir_focused = True;
|
opts.mark_ovredir_focused = True;
|
||||||
break;
|
break;
|
||||||
|
case 265:
|
||||||
|
// --no-fading-openclose
|
||||||
|
opts.no_fading_openclose = True;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -270,7 +270,7 @@ typedef struct _options {
|
||||||
/// How much to fade out in a single fading step.
|
/// How much to fade out in a single fading step.
|
||||||
opacity_t fade_out_step;
|
opacity_t fade_out_step;
|
||||||
unsigned long fade_delta;
|
unsigned long fade_delta;
|
||||||
Bool fade_trans;
|
Bool no_fading_openclose;
|
||||||
/// Fading blacklist. A linked list of conditions.
|
/// Fading blacklist. A linked list of conditions.
|
||||||
wincond *fade_blacklist;
|
wincond *fade_blacklist;
|
||||||
|
|
||||||
|
@ -725,6 +725,9 @@ map_win(Display *dpy, Window id,
|
||||||
unsigned long sequence, Bool fade,
|
unsigned long sequence, Bool fade,
|
||||||
Bool override_redirect);
|
Bool override_redirect);
|
||||||
|
|
||||||
|
static void
|
||||||
|
finish_map_win(Display *dpy, win *w);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
finish_unmap_win(Display *dpy, win *w);
|
finish_unmap_win(Display *dpy, win *w);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue