From ecc60878b3739bf15fb5affbc6c35b500aa41f4c Mon Sep 17 00:00:00 2001 From: David Donahue Date: Sat, 13 Mar 2021 11:20:33 -0600 Subject: [PATCH] changed fprintf(stdout) instances to printf(), changed function name from statusbar to printstatus --- dwl.c | 64 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/dwl.c b/dwl.c index f3018da..e18f807 100644 --- a/dwl.c +++ b/dwl.c @@ -260,6 +260,7 @@ static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int static void outputmgrtest(struct wl_listener *listener, void *data); static void pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, uint32_t time); +static void printstatus(void); static void quit(const Arg *arg); static void render(struct wlr_surface *surface, int sx, int sy, void *data); static void renderclients(Monitor *m, struct timespec *now); @@ -280,7 +281,6 @@ static void setmon(Client *c, Monitor *m, unsigned int newtags); static void setup(void); static void sigchld(int unused); static void spawn(const Arg *arg); -static void statusbar(void); static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void tile(Monitor *m); @@ -1117,7 +1117,7 @@ focusclient(Client *c, int lift) wl_list_insert(&fstack, &c->flink); selmon = c->mon; } - statusbar(); + printstatus(); /* Deactivate old client if focus is changing */ if (old && (!c || client_surface(c) != old)) { @@ -1604,6 +1604,31 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, focusclient(c, 0); } +void +printstatus(void) +{ + Monitor *m = NULL; + Client *c = NULL; + unsigned int activetags; + + wl_list_for_each(m, &mons, link) { + activetags=0; + wl_list_for_each(c, &clients, link) { + if (c->mon == m) + activetags |= c->tags; + } + if (focustop(m)) + printf("%s title %s\n", m->wlr_output->name, client_get_title(focustop(m))); + else + printf("%s title \n", m->wlr_output->name); + + printf("%s selmon %u\n", m->wlr_output->name, m == selmon); + printf("%s tags %u %u\n", m->wlr_output->name, activetags, m->tagset[m->seltags]); + printf("%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol); + } + fflush(stdout); +} + void quit(const Arg *arg) { @@ -1917,7 +1942,7 @@ setlayout(const Arg *arg) selmon->lt[selmon->sellt] = (Layout *)arg->v; /* TODO change layout symbol? */ arrange(selmon); - statusbar(); + printstatus(); } /* arg > 1.0 will set mfact absolutely */ @@ -2160,31 +2185,6 @@ spawn(const Arg *arg) } } -void -statusbar(void) -{ - Monitor *m = NULL; - Client *c = NULL; - unsigned int activetags; - - wl_list_for_each(m, &mons, link) { - activetags=0; - wl_list_for_each(c, &clients, link) { - if (c->mon == m) - activetags |= c->tags; - } - if (focustop(m)) - fprintf(stdout, "%s title %s\n", m->wlr_output->name, client_get_title(focustop(m))); - else - fprintf(stdout, "%s title \n", m->wlr_output->name); - - fprintf(stdout, "%s selmon %u\n", m->wlr_output->name, m == selmon); - fprintf(stdout, "%s tags %u %u\n", m->wlr_output->name, activetags, m->tagset[m->seltags]); - fprintf(stdout, "%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol); - } - fflush(stdout); -} - void tag(const Arg *arg) { @@ -2194,7 +2194,7 @@ tag(const Arg *arg) focusclient(focustop(selmon), 1); arrange(selmon); } - statusbar(); + printstatus(); } void @@ -2264,7 +2264,7 @@ toggletag(const Arg *arg) focusclient(focustop(selmon), 1); arrange(selmon); } - statusbar(); + printstatus(); } void @@ -2277,7 +2277,7 @@ toggleview(const Arg *arg) focusclient(focustop(selmon), 1); arrange(selmon); } - statusbar(); + printstatus(); } void @@ -2358,7 +2358,7 @@ view(const Arg *arg) selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; focusclient(focustop(selmon), 1); arrange(selmon); - statusbar(); + printstatus(); } void