i3bar: correctly check errors when getting the _XEMBED_INFO property

This fixes a problem where starting gnome-settings-daemon (maybe other
programs, too) would leave an empty spot in i3bar’s tray area.
This commit is contained in:
Michael Stapelberg 2012-01-28 10:22:43 +00:00
parent 5a2673d08a
commit 144be37517
1 changed files with 15 additions and 8 deletions

View File

@ -363,17 +363,24 @@ static void handle_client_message(xcb_client_message_event_t* event) {
bool map_it = true; bool map_it = true;
int xe_version = 1; int xe_version = 1;
xcb_get_property_cookie_t xembedc; xcb_get_property_cookie_t xembedc;
xembedc = xcb_get_property_unchecked(xcb_connection, xcb_generic_error_t *error;
0, xembedc = xcb_get_property(xcb_connection,
client, 0,
atoms[_XEMBED_INFO], client,
XCB_GET_PROPERTY_TYPE_ANY, atoms[_XEMBED_INFO],
0, XCB_GET_PROPERTY_TYPE_ANY,
2 * 32); 0,
2 * 32);
xcb_get_property_reply_t *xembedr = xcb_get_property_reply(xcb_connection, xcb_get_property_reply_t *xembedr = xcb_get_property_reply(xcb_connection,
xembedc, xembedc,
NULL); &error);
if (error != NULL) {
ELOG("Error getting _XEMBED_INFO property: error_code %d\n",
error->error_code);
free(error);
return;
}
if (xembedr != NULL && xembedr->length != 0) { if (xembedr != NULL && xembedr->length != 0) {
DLOG("xembed format = %d, len = %d\n", xembedr->format, xembedr->length); DLOG("xembed format = %d, len = %d\n", xembedr->format, xembedr->length);
uint32_t *xembed = xcb_get_property_value(xembedr); uint32_t *xembed = xcb_get_property_value(xembedr);