changed fprintf(stdout) instances to printf(), changed function name from statusbar to printstatus

This commit is contained in:
David Donahue 2021-03-13 11:20:33 -06:00
parent 7cee5060bc
commit ecc60878b3

64
dwl.c
View file

@ -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