static void add_to_focus(gpointer value, gpointer data) { GntBox *box = GNT_BOX(data); GntWidget *w = GNT_WIDGET(value); if (GNT_IS_BOX(w)) g_list_foreach(GNT_BOX(w)->list, add_to_focus, box); else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_CAN_TAKE_FOCUS)) box->focus = g_list_append(box->focus, w); }
gboolean gnt_widget_has_focus(GntWidget *widget) { GntWidget *w; if (!widget) return FALSE; if (GNT_IS_MENU(widget)) return TRUE; w = widget; while (widget->parent) widget = widget->parent; if (widget == wm->_list.window) return TRUE; if (wm->cws->ordered && wm->cws->ordered->data == widget) { if (GNT_IS_BOX(widget) && (GNT_BOX(widget)->active == w || widget == w)) return TRUE; } return FALSE; }