xutil: remove xutil_text_prop_get
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
73a1011364
commit
8f1ccca881
|
@ -31,59 +31,6 @@
|
||||||
#include "common/xutil.h"
|
#include "common/xutil.h"
|
||||||
#include "common/tokenize.h"
|
#include "common/tokenize.h"
|
||||||
|
|
||||||
/** Get the string value of an atom.
|
|
||||||
* \param conn X connection.
|
|
||||||
* \param w Window.
|
|
||||||
* \param atom The atom.
|
|
||||||
* \param text Buffer to fill.
|
|
||||||
* \param len Length of the filled buffer.
|
|
||||||
* \return True on sucess, false on failure.
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
xutil_text_prop_get(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom,
|
|
||||||
char **text, ssize_t *len)
|
|
||||||
{
|
|
||||||
xcb_get_text_property_reply_t reply;
|
|
||||||
|
|
||||||
p_clear(&reply, 1);
|
|
||||||
|
|
||||||
if(!xcb_get_text_property_reply(conn,
|
|
||||||
xcb_get_text_property_unchecked(conn, w,
|
|
||||||
atom),
|
|
||||||
&reply, NULL) ||
|
|
||||||
!reply.name_len || reply.format != 8)
|
|
||||||
{
|
|
||||||
xcb_get_text_property_reply_wipe(&reply);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(text && len)
|
|
||||||
{
|
|
||||||
/* Check whether the returned property value is just an ascii
|
|
||||||
* string, an UTF-8 string or just some random multibyte in any other
|
|
||||||
* encoding. */
|
|
||||||
if(reply.encoding == STRING
|
|
||||||
|| reply.encoding == UTF8_STRING
|
|
||||||
|| reply.encoding == COMPOUND_TEXT)
|
|
||||||
{
|
|
||||||
*text = p_new(char, reply.name_len + 1);
|
|
||||||
/* Use memcpy() because the property name is not be \0
|
|
||||||
* terminated */
|
|
||||||
memcpy(*text, reply.name, reply.name_len);
|
|
||||||
(*text)[reply.name_len] = '\0';
|
|
||||||
*len = reply.name_len;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*text = NULL;
|
|
||||||
*len = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xcb_get_text_property_reply_wipe(&reply);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the lock masks (shiftlock, numlock, capslock, modeswitch).
|
/** Get the lock masks (shiftlock, numlock, capslock, modeswitch).
|
||||||
* \param connection The X connection.
|
* \param connection The X connection.
|
||||||
* \param cookie The cookie of the request.
|
* \param cookie The cookie of the request.
|
||||||
|
|
|
@ -44,8 +44,6 @@ xutil_get_text_property_from_reply(xcb_get_property_reply_t *reply)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xutil_text_prop_get(xcb_connection_t *, xcb_window_t, xcb_atom_t, char **, ssize_t *);
|
|
||||||
|
|
||||||
void xutil_lock_mask_get(xcb_connection_t *, xcb_get_modifier_mapping_cookie_t,
|
void xutil_lock_mask_get(xcb_connection_t *, xcb_get_modifier_mapping_cookie_t,
|
||||||
xcb_key_symbols_t *,
|
xcb_key_symbols_t *,
|
||||||
uint16_t *, uint16_t *, uint16_t *, uint16_t *);
|
uint16_t *, uint16_t *, uint16_t *, uint16_t *);
|
||||||
|
|
Loading…
Reference in New Issue