diff options
author | Anselm R. Garbe <garbeam@gmail.com> | 2007-08-19 10:40:07 +0200 |
---|---|---|
committer | Anselm R. Garbe <garbeam@gmail.com> | 2007-08-19 10:40:07 +0200 |
commit | 96d7fe16eaf6b656800f08da3156bacd75ca3b08 (patch) | |
tree | 98d884e096b5108d8181914540718b6b82c6893e /main.c | |
parent | 78d1a22d4e847d0e596af59d7707da1bbfe9583a (diff) | |
download | dwm-96d7fe16eaf6b656800f08da3156bacd75ca3b08.tar.gz |
prepared merging layout.c and tag.c into screen.c
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -143,6 +143,7 @@ setup(void) { dwmprops = XInternAtom(dpy, "_DWM_PROPERTIES", False); wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); + wmatom[WMName] = XInternAtom(dpy, "WM_NAME", False); wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); @@ -220,6 +221,33 @@ xerrorstart(Display *dsply, XErrorEvent *ee) { /* extern */ +Bool +gettextprop(Window w, Atom atom, char *text, unsigned int size) { + char **list = NULL; + int n; + XTextProperty name; + + if(!text || size == 0) + return False; + text[0] = '\0'; + XGetTextProperty(dpy, w, &name, atom); + if(!name.nitems) + return False; + if(name.encoding == XA_STRING) + strncpy(text, (char *)name.value, size - 1); + else { + if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success + && n > 0 && *list) + { + strncpy(text, *list, size - 1); + XFreeStringList(list); + } + } + text[size - 1] = '\0'; + XFree(name.value); + return True; +} + void quit(const char *arg) { readin = running = False; |