static void do_net_client_list(GtkWidget *widget, icons *ics) { int i; task *tk; ENTER; if (ics->wins) XFree(ics->wins); ics->wins = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST, XA_WINDOW, &ics->win_num); if (!ics->wins) RET(); 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) remove_stale_tasks, NULL); RET(); }
static void do_net_client_list_stacking(FbEv *ev, pager *p) { int i; task *t; ENTER; if (p->wins) XFree(p->wins); p->wins = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST_STACKING, XA_WINDOW, &p->winnum); if (!p->wins || !p->winnum) RET(); /* refresh existing tasks and add new */ for (i = 0; i < p->winnum; i++) { if ((t = g_hash_table_lookup(p->htable, &p->wins[i]))) { t->refcount++; if (t->stacking != i) { t->stacking = i; desk_set_dirty_by_win(p, t); } } else { t = g_new0(task, 1); t->refcount++; t->win = p->wins[i]; t->ws = get_wm_state (t->win); t->desktop = get_net_wm_desktop(t->win); get_net_wm_state(t->win, &t->nws); get_net_wm_window_type(t->win, &t->nwwt); task_get_sizepos(t); if (!FBPANEL_WIN(t->win)) XSelectInput (GDK_DISPLAY(), t->win, PropertyChangeMask | StructureNotifyMask); g_hash_table_insert(p->htable, &t->win, t); DBG("add %x\n", t->win); desk_set_dirty_by_win(p, t); } } /* pass throu hash table and delete stale windows */ g_hash_table_foreach_remove(p->htable, (GHRFunc) task_remove_stale, (gpointer)p); RET(); }