wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

getprop_textlist.c (463B)


      1 /* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
      2  * See LICENSE file for license details.
      3  */
      4 #include "../x11.h"
      5 
      6 int
      7 getprop_textlist(Window *w, const char *name, char **ret[]) {
      8 	XTextProperty prop;
      9 	char **list;
     10 	int n;
     11 
     12 	*ret = nil;
     13 	n = 0;
     14 
     15 	XGetTextProperty(display, w->xid, &prop, xatom(name));
     16 	if(prop.nitems > 0) {
     17 		if(Xutf8TextPropertyToTextList(display, &prop, &list, &n) == Success)
     18 			*ret = list;
     19 		XFree(prop.value);
     20 	}
     21 	return n;
     22 }