From c0c95402628a5d88ec3107a836f210d422cb7947 Mon Sep 17 00:00:00 2001 From: speedie Date: Sat, 3 Dec 2022 22:24:09 +0100 Subject: [PATCH] cleanup statuscmd/status2d --- bar.h | 2 +- bar/statusbar.c | 20 ++++++++++---------- bar/statusbar.h | 15 ++++++--------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/bar.h b/bar.h index 771552b..2860855 100644 --- a/bar.h +++ b/bar.h @@ -16,7 +16,7 @@ static const BarRule barrules[] = { { -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, "tags" }, { 'A', 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, "systray" }, //{ 'A', 0, BAR_ALIGN_RIGHT, width_status_basic, draw_status_basic, click_status_basic, "basic status" }, - { 'A', 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_statuscmd, "status2d" }, + { 'A', 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, "clickable status" }, //{ -1, 0, BAR_ALIGN_NONE, width_title_basic, draw_title_basic, click_title_basic, "basic title" }, { -1, 0, BAR_ALIGN_NONE, width_title, draw_title, click_title, "title" }, }; diff --git a/bar/statusbar.c b/bar/statusbar.c index 18db86e..3f53a7c 100644 --- a/bar/statusbar.c +++ b/bar/statusbar.c @@ -2,19 +2,19 @@ static int clickstatusn; static char lastbutton[] = "-"; int -width_status2d(Bar *bar, BarWidthArg *a) +width_status(Bar *bar, BarWidthArg *a) { - return status2dtextlength(rawstext) + lrpad; + return textlength(rawstext) + lrpad; } int -draw_status2d(Bar *bar, BarDrawArg *a) +draw_status(Bar *bar, BarDrawArg *a) { - return drawstatusbar(a->x, rawstext); + return drawstatustext(a->x, rawstext); } int -drawstatusbar(int x, char* stext) +drawstatustext(int x, char* stext) { int i, w, len; short isCode = 0; @@ -117,7 +117,7 @@ drawstatusbar(int x, char* stext) } int -status2dtextlength(char* stext) +textlength(char* stext) { int i, w, len; short isCode = 0; @@ -156,13 +156,13 @@ status2dtextlength(char* stext) } int -click_statuscmd(Bar *bar, Arg *arg, BarClickArg *a) +click_status(Bar *bar, Arg *arg, BarClickArg *a) { - return click_statuscmd_text(arg, a->rel_x, rawstext); + return click_status_text(arg, a->rel_x, rawstext); } int -click_statuscmd_text(Arg *arg, int rel_x, char *text) +click_status_text(Arg *arg, int rel_x, char *text) { int i = -1; int x = 0; @@ -172,7 +172,7 @@ click_statuscmd_text(Arg *arg, int rel_x, char *text) if ((unsigned char)text[i] < ' ') { ch = text[i]; text[i] = '\0'; - x += status2dtextlength(text); + x += textlength(text); text[i] = ch; text += i+1; i = -1; diff --git a/bar/statusbar.h b/bar/statusbar.h index fb1ab15..8554887 100644 --- a/bar/statusbar.h +++ b/bar/statusbar.h @@ -1,10 +1,7 @@ -static int width_status2d(Bar *bar, BarWidthArg *a); -static int width_status2d_es(Bar *bar, BarWidthArg *a); -static int draw_status2d(Bar *bar, BarDrawArg *a); -static int draw_status2d_es(Bar *bar, BarDrawArg *a); -static int drawstatusbar(int x, char *text); -static int status2dtextlength(char *stext); -static int click_statuscmd(Bar *bar, Arg *arg, BarClickArg *a); -static int click_statuscmd_es(Bar *bar, Arg *arg, BarClickArg *a); -static int click_statuscmd_text(Arg *arg, int rel_x, char *text); +static int width_status(Bar *bar, BarWidthArg *a); +static int draw_status(Bar *bar, BarDrawArg *a); +static int drawstatustext(int x, char *text); +static int textlength(char *stext); +static int click_status(Bar *bar, Arg *arg, BarClickArg *a); +static int click_status_text(Arg *arg, int rel_x, char *text); static void copyvalidchars(char *text, char *rawtext);