summaryrefslogtreecommitdiff
path: root/tabbed.c
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2013-01-16 18:33:50 +0100
committerChristoph Lohmann <20h@r-36.net>2013-01-16 18:33:50 +0100
commit2db44155243b40a56ea675ac526f982441c34c26 (patch)
tree99a4785a92ba61646b3292afcb25debf0ec298b8 /tabbed.c
parent66021e959ca27b9be90e1440592812345404a452 (diff)
Making tabbed convert the title string to native.
Thanks "Markus Wichmann" <nullplan@gmx.net>!
Diffstat (limited to 'tabbed.c')
-rw-r--r--tabbed.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/tabbed.c b/tabbed.c
index a4127db..d071b2c 100644
--- a/tabbed.c
+++ b/tabbed.c
@@ -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