From 4943ed1dfe7bf72bfa6110e5ed6d556d2047c3d0 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Wed, 8 Feb 2012 01:00:33 +0000 Subject: [PATCH] Add status-bar wrapper function. Instead of checking if any of the window related enabled options are set and updating the status-bar over and over again, delegate that job to a small wrapper function. --- scrotwm.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scrotwm.c b/scrotwm.c index 658696b..cba3e36 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -1485,6 +1485,13 @@ bar_update(void) } void +bar_check_opts(void) +{ + if (title_class_enabled || title_name_enabled || window_name_enabled) + bar_update(); +} + +void bar_signal(int sig) { bar_alarm = 1; @@ -2215,8 +2222,7 @@ focus_win(struct ws_win *win) PropModeReplace, (unsigned char *)&win->id,1); } - if (window_name_enabled || title_class_enabled || title_name_enabled) - bar_update(); + bar_check_opts(); } void @@ -2535,9 +2541,7 @@ focus_prev(struct ws_win *win) done: if (winfocus == winlostfocus || winfocus == NULL) { /* update the bar so that title/class/name will be cleared. */ - if (window_name_enabled || title_name_enabled || - title_class_enabled) - bar_update(); + bar_check_opts(); return; } @@ -2646,10 +2650,7 @@ focus(struct swm_region *r, union arg *args) } if (winfocus == winlostfocus || winfocus == NULL) { /* update the bar so that title/class/name will be cleared. */ - if (window_name_enabled || title_name_enabled || - title_class_enabled) - bar_update(); - + bar_check_opts(); return; } -- 1.7.10.4