char * get_textproperty(Window win, Atom atom) { XTextProperty text_prop; char *retval; ENTER; if (XGetTextProperty(gdk_helper_display(), win, &text_prop, atom)) { DBG("format=%d enc=%d nitems=%d value=%s \n", text_prop.format, text_prop.encoding, text_prop.nitems, text_prop.value); retval = text_property_to_utf8 (&text_prop); if (text_prop.nitems > 0) XFree (text_prop.value); RET(retval); } RET(NULL); }
static gboolean text_property_from_results (GetPropertyResults *results, char **utf8_str_p) { XTextProperty tp; *utf8_str_p = NULL; tp.value = results->prop; results->prop = NULL; tp.encoding = results->type; tp.format = results->format; tp.nitems = results->n_items; *utf8_str_p = text_property_to_utf8 (results->display->xdisplay, &tp); if (tp.value != NULL) XFree (tp.value); return *utf8_str_p != NULL; }