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 <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-03-17 19:36:28 +00:00
parent d2e323c985
commit 03895b711c
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 8 additions and 25 deletions

View File

@ -908,37 +908,20 @@ void win_update_opacity_rule(session_t *ps, struct managed_win *w) {
w->opacity_is_set = is_set; 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. * Function to be called on window data changes.
* *
* TODO need better name * TODO need better name
*/ */
void win_on_factor_change(session_t *ps, struct managed_win *w) { void win_on_factor_change(session_t *ps, struct managed_win *w) {
if (ps->o.shadow_blacklist) win_determine_shadow(ps, w);
win_determine_shadow(ps, w); win_determine_invert_color(ps, w);
if (ps->o.invert_color_list) win_update_focused(ps, w);
win_determine_invert_color(ps, w); win_determine_blur_background(ps, w);
if (ps->o.focus_blacklist) win_update_opacity_rule(ps, w);
win_update_focused(ps, w); if (w->a.map_state == XCB_MAP_STATE_VIEWABLE)
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)
w->paint_excluded = c2_match(ps, w, ps->o.paint_blacklist, NULL); 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 = w->unredir_if_possible_excluded =
c2_match(ps, w, ps->o.unredir_if_possible_blacklist, NULL); c2_match(ps, w, ps->o.unredir_if_possible_blacklist, NULL);
w->reg_ignore_valid = false; 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) if (w->window_type != wtype_old)
win_on_wtype_change(ps, w); win_on_factor_change(ps, w);
} }
/** /**