xutil: allow gettextprop() to be called without text
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
6e5d89e4de
commit
33c0d77193
|
@ -44,10 +44,6 @@ xutil_gettextprop(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom, char
|
|||
{
|
||||
xcb_get_property_cookie_t prop_c;
|
||||
xcb_get_property_reply_t *prop_r;
|
||||
void *prop_val;
|
||||
|
||||
if(!text)
|
||||
return false;
|
||||
|
||||
prop_c = xcb_get_property_unchecked(conn, false,
|
||||
w, atom,
|
||||
|
@ -62,13 +58,12 @@ xutil_gettextprop(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom, char
|
|||
return false;
|
||||
}
|
||||
|
||||
prop_val = xcb_get_property_value(prop_r);
|
||||
|
||||
/* Check whether the returned property value is just an ascii
|
||||
* string or utf8 string. At the moment it doesn't handle
|
||||
* COMPOUND_TEXT and multibyte but it's not needed... */
|
||||
if(prop_r->type == STRING || prop_r->type == UTF8_STRING)
|
||||
if(text && (prop_r->type == STRING || prop_r->type == UTF8_STRING))
|
||||
{
|
||||
void *prop_val = xcb_get_property_value(prop_r);
|
||||
*text = p_new(char, prop_r->value_len + 1);
|
||||
/* use memcpy() because prop_val may not be \0 terminated */
|
||||
memcpy(*text, prop_val, prop_r->value_len);
|
||||
|
@ -77,7 +72,6 @@ xutil_gettextprop(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom, char
|
|||
}
|
||||
|
||||
p_delete(&prop_r);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue