~ruther/dwl

ecc60878b3739bf15fb5affbc6c35b500aa41f4c — David Donahue 4 years ago 7cee506
changed fprintf(stdout) instances to printf(), changed function name from statusbar to printstatus
1 files changed, 32 insertions(+), 32 deletions(-)

M dwl.c
M dwl.c => dwl.c +32 -32
@@ 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)) {


@@ 1605,6 1605,31 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
}

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)
{
	wl_display_terminate(dpy);


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


@@ 2161,31 2186,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)
{
	Client *sel = selclient();


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