i3bar: correctly handle unmapped tray clients, reconfigure tray icons after mapping/unmapping (Thanks IsoLnCHiP)

Fixes #550
This commit is contained in:
Michael Stapelberg 2011-11-09 23:22:44 +00:00
parent 2c48280017
commit e85a352fcf
1 changed files with 9 additions and 1 deletions

View File

@ -373,6 +373,8 @@ static void configure_trayclients() {
int clients = 0; int clients = 0;
TAILQ_FOREACH_REVERSE(trayclient, output->trayclients, tc_head, tailq) { TAILQ_FOREACH_REVERSE(trayclient, output->trayclients, tc_head, tailq) {
if (!trayclient->mapped)
continue;
clients++; clients++;
DLOG("Configuring tray window %08x to x=%d\n", DLOG("Configuring tray window %08x to x=%d\n",
@ -595,8 +597,10 @@ static void handle_property_notify(xcb_property_notify_event_t *event) {
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); NULL);
if (xembedr == NULL || xembedr->length == 0) if (xembedr == NULL || xembedr->length == 0) {
DLOG("xembed_info unset\n");
return; return;
}
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);
@ -608,11 +612,13 @@ static void handle_property_notify(xcb_property_notify_event_t *event) {
/* need to unmap the window */ /* need to unmap the window */
xcb_unmap_window(xcb_connection, trayclient->win); xcb_unmap_window(xcb_connection, trayclient->win);
trayclient->mapped = map_it; trayclient->mapped = map_it;
configure_trayclients();
draw_bars(); draw_bars();
} else if (!trayclient->mapped && map_it) { } else if (!trayclient->mapped && map_it) {
/* need to map the window */ /* need to map the window */
xcb_map_window(xcb_connection, trayclient->win); xcb_map_window(xcb_connection, trayclient->win);
trayclient->mapped = map_it; trayclient->mapped = map_it;
configure_trayclients();
draw_bars(); draw_bars();
} }
free(xembedr); free(xembedr);
@ -635,6 +641,8 @@ static void handle_configure_request(xcb_configure_request_event_t *event) {
int clients = 0; int clients = 0;
TAILQ_FOREACH_REVERSE(trayclient, output->trayclients, tc_head, tailq) { TAILQ_FOREACH_REVERSE(trayclient, output->trayclients, tc_head, tailq) {
if (!trayclient->mapped)
continue;
clients++; clients++;
if (trayclient->win != event->window) if (trayclient->win != event->window)