static void do_net_client_list(icons_priv *ics) { int i; task *tk; ENTER; if (ics->wins) { DBG("free ics->wins\n"); XFree(ics->wins); ics->wins = NULL; } ics->wins = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST, XA_WINDOW, &ics->win_num); if (!ics->wins) RET(); DBG("alloc ics->wins\n"); for (i = 0; i < ics->win_num; i++) { if ((tk = g_hash_table_lookup(ics->task_list, &ics->wins[i]))) { tk->refcount++; } else { tk = g_new0(task, 1); tk->refcount++; ics->num_tasks++; tk->win = ics->wins[i]; tk->ics = ics; if (!FBPANEL_WIN(tk->win)) { XSelectInput(GDK_DISPLAY(), tk->win, PropertyChangeMask | StructureNotifyMask); } get_wmclass(tk); set_icon_maybe(ics, tk); g_hash_table_insert(ics->task_list, &tk->win, tk); } } /* remove windows that arn't in the NET_CLIENT_LIST anymore */ g_hash_table_foreach_remove(ics->task_list, (GHRFunc) task_remove_stale, NULL); RET(); }
static void ics_propertynotify(icons *ics, XEvent *ev) { Atom at; Window win; ENTER; win = ev->xproperty.window; at = ev->xproperty.atom; DBG("win=%x at=%d\n", win, at); if (win != GDK_ROOT_WINDOW()) { task *tk = find_task(ics, win); if (!tk) RET(); if (at == XA_WM_CLASS) { get_wmclass(tk); set_icon_maybe(ics, tk); } else if (at == XA_WM_HINTS) { set_icon_maybe(ics, tk); } } RET(); }