[hackers] [tabbed] Making tabbed convert the title string to native. || Christoph Lohmann
commit 2db44155243b40a56ea675ac526f982441c34c26
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Wed Jan 16 18:33:50 2013 +0100
Making tabbed convert the title string to native.
Thanks "Markus Wichmann" <nullplan_AT_gmx.net>!
diff --git a/tabbed.c b/tabbed.c
index a4127db..d071b2c 100644
--- a/tabbed.c
+++ b/tabbed.c
_AT_@ -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;
_AT_@ -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;
_AT_@ -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) {
_AT_@ -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();
}
_AT_@ -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
Received on Wed Jan 16 2013 - 18:36:02 CET
This archive was generated by hypermail 2.3.0
: Wed Jan 16 2013 - 18:48:08 CET