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:
parent
d2e323c985
commit
03895b711c
33
src/win.c
33
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue