This commit is contained in:
Arnaud Fontaine 2008-03-27 11:34:19 +00:00 committed by Julien Danjou
parent 75926a6039
commit da5236d57a
2 changed files with 5 additions and 14 deletions

View File

@ -52,12 +52,10 @@ xgettextprop(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom,
return false;
prop_val = (char *) xcb_get_property_value(name);
if(name->type == STRING)
a_strncpy(text, name->value_len + 1, prop_val, textlen - 1);
/* TODO: XCB doesn't provide a XmbTextPropertyToTextList(), check
/* TODO: XCB doesn't provide a XmbTextPropertyToTextList(), check
* whether this code is correct (locales) */
else if(name->format == 8)
if(name->type == STRING || name->format == 8)
a_strncpy(text, name->value_len + 1, prop_val, textlen - 1);
text[textlen - 1] = '\0';

13
ewmh.c
View File

@ -431,14 +431,15 @@ ewmh_get_window_icon(xcb_window_t w)
NetWMIcon *icon;
int size, i;
uint32_t *data;
unsigned char *imgdata, *wdata;
unsigned char *imgdata;
xcb_get_property_reply_t *r;
r = xcb_get_property_reply(globalconf.connection,
xcb_get_property_unchecked(globalconf.connection, false, w,
net_wm_icon, CARDINAL, 0, UINT32_MAX),
NULL);
if(!r || !(wdata = (unsigned char *) xcb_get_property_value(r)))
if(!r || r->type != CARDINAL || r->format != 32 || r->length < 2 ||
!(data = (uint32_t *) xcb_get_property_value(r)))
{
if(r)
p_delete(&r);
@ -446,16 +447,8 @@ ewmh_get_window_icon(xcb_window_t w)
return NULL;
}
if(r->type != CARDINAL || r->format != 32 || r->length < 2)
{
p_delete(&r);
return NULL;
}
icon = p_new(NetWMIcon, 1);
data = (uint32_t *) wdata;
icon->width = data[0];
icon->height = data[1];
size = icon->width * icon->height;