~kris/suckless

tabbed

2db44155243b40a56ea675ac526f982441c34c26 — Christoph Lohmann 13 years ago 66021e9
Making tabbed convert the title string to native.

Thanks "Markus Wichmann" <nullplan@gmx.net>!
1 files changed, 16 insertions(+), 3 deletions(-)

M tabbed.c
M tabbed.c => tabbed.c +16 -3
@@ 129,6 129,7 @@ static void unmanage(int c);
static void updatenumlockmask(void);
static void updatetitle(int c);
static int xerror(Display *dpy, XErrorEvent *ee);
static void xsettitle(Window w, const char *str);

/* variables */
static int screen;


@@ 423,7 424,7 @@ focus(int c) {
		for(i = 0, n = strlen(buf); cmd[i] && n < sizeof(buf); i++)
			n += snprintf(&buf[n], sizeof(buf) - n, " %s", cmd[i]);

		XStoreName(dpy, win, buf);
		xsettitle(win, buf);
		XRaiseWindow(dpy, win);

		return;


@@ 437,7 438,7 @@ focus(int c) {
	XSetInputFocus(dpy, clients[c]->win, RevertToParent, CurrentTime);
	sendxembed(c, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT, 0, 0);
	sendxembed(c, XEMBED_WINDOW_ACTIVATE, 0, 0, 0);
	XStoreName(dpy, win, clients[c]->name);
	xsettitle(win, clients[c]->name);

	/* If sel is already c, change nothing. */
	if(sel != c) {


@@ 1051,7 1052,7 @@ updatetitle(int c) {
				clients[c]->name, sizeof(clients[c]->name));
	}
	if(sel == c)
		XStoreName(dpy, win, clients[c]->name);
		xsettitle(win, clients[c]->name);
	drawbar();
}



@@ 1085,6 1086,18 @@ xerror(Display *dpy, XErrorEvent *ee) {
	return xerrorxlib(dpy, ee); /* may call exit */
}

void
xsettitle(Window w, const char *str) {
	XTextProperty xtp;

	if(XmbTextListToTextProperty(dpy, (char **)&str, 1, XCompoundTextStyle,
				&xtp) == Success) {
		XSetTextProperty(dpy, w, &xtp, wmatom[WMName]);
		XSetTextProperty(dpy, w, &xtp, XA_WM_NAME);
		XFree(xtp.value);
	}
}

char *argv0;

void