From 03895b711c31ab1dedf5064b62adaf13f74e4897 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 17 Mar 2020 19:36:28 +0000 Subject: [PATCH] win: simplify win_on_factor_change Always refresh derivative window states in win_on_factor_change, without checking if there are rules set. c2_match is a no-op when there is no rules set. And we want to consolidate derivative window state updates to one place, win_on_factor_change is a good choice for that. Signed-off-by: Yuxuan Shui --- src/win.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/win.c b/src/win.c index 088d993..f63d27e 100644 --- a/src/win.c +++ b/src/win.c @@ -908,37 +908,20 @@ void win_update_opacity_rule(session_t *ps, struct managed_win *w) { w->opacity_is_set = is_set; } -/** - * Function to be called on window type changes. - */ -static void win_on_wtype_change(session_t *ps, struct managed_win *w) { - win_determine_shadow(ps, w); - win_update_focused(ps, w); - if (ps->o.invert_color_list) - win_determine_invert_color(ps, w); - if (ps->o.opacity_rules) - win_update_opacity_rule(ps, w); -} - /** * Function to be called on window data changes. * * TODO need better name */ void win_on_factor_change(session_t *ps, struct managed_win *w) { - if (ps->o.shadow_blacklist) - win_determine_shadow(ps, w); - if (ps->o.invert_color_list) - win_determine_invert_color(ps, w); - if (ps->o.focus_blacklist) - win_update_focused(ps, w); - if (ps->o.blur_background_blacklist) - win_determine_blur_background(ps, w); - if (ps->o.opacity_rules) - win_update_opacity_rule(ps, w); - if (w->a.map_state == XCB_MAP_STATE_VIEWABLE && ps->o.paint_blacklist) + win_determine_shadow(ps, w); + win_determine_invert_color(ps, w); + win_update_focused(ps, w); + win_determine_blur_background(ps, w); + win_update_opacity_rule(ps, w); + if (w->a.map_state == XCB_MAP_STATE_VIEWABLE) w->paint_excluded = c2_match(ps, w, ps->o.paint_blacklist, NULL); - if (w->a.map_state == XCB_MAP_STATE_VIEWABLE && ps->o.unredir_if_possible_blacklist) + if (w->a.map_state == XCB_MAP_STATE_VIEWABLE) w->unredir_if_possible_excluded = c2_match(ps, w, ps->o.unredir_if_possible_blacklist, NULL); w->reg_ignore_valid = false; @@ -987,7 +970,7 @@ void win_update_wintype(session_t *ps, struct managed_win *w) { } if (w->window_type != wtype_old) - win_on_wtype_change(ps, w); + win_on_factor_change(ps, w); } /**