-/* icon_popup_size(focus_cycle_popup, a->height/2, a->height/16);
- icon_popup_show(focus_cycle_popup, c->title,
- client_icon(c, a->height/16, a->height/16));
-*/
- /* XXX the size and the font extents need to be related on some level
- */
- icon_popup_size(focus_cycle_popup, POPUP_WIDTH, POPUP_HEIGHT);
-
- /* use the transient's parent's title/icon */
- while (p->transient_for && p->transient_for != OB_TRAN_GROUP)
- p = p->transient_for;
-
- if (p != c && !strcmp("", (c->iconic ? c->icon_title : c->title)))
- title = g_strdup(p->iconic ? p->icon_title : p->title);
- /*title = g_strconcat((c->iconic ? c->icon_title : c->title),
- " - ",
- (p->iconic ? p->icon_title : p->title),
- NULL);
- */
- icon_popup_show(focus_cycle_popup,
- (title ? title :
- (c->iconic ? c->icon_title : c->title)),
- client_icon(p, 48, 48));
- g_free(title);
+ icon_popup_height(focus_cycle_popup, POPUP_HEIGHT);
+ icon_popup_min_width(focus_cycle_popup, POPUP_WIDTH);
+ icon_popup_max_width(focus_cycle_popup,
+ MAX(a->width/3, POPUP_WIDTH));
+
+
+ /* make its width to be the width of all the possible titles */
+
+ /* build a list of all the valid focus targets */
+ for (it = focus_order; it; it = g_list_next(it)) {
+ ObClient *ft = it->data;
+ if (valid_focus_target(ft, all_desktops, dock_windows)) {
+ targets = g_list_prepend(targets, ft);
+ ++n;
+ }
+ }
+ /* make it null terminated so we can use g_strfreev */
+ names = g_new(char*, n+1);
+ for (it = targets, i = 0; it; it = g_list_next(it), ++i) {
+ ObClient *ft = it->data;
+ names[i] = popup_get_name(ft, &showtarget);
+
+ /* little optimization.. save this text so we dont have to get it
+ again */
+ if (ft == c)
+ showtext = g_strdup(names[i]);
+ }
+ names[n] = NULL;
+
+ icon_popup_text_width_to_strings(focus_cycle_popup, names, n);
+ g_strfreev(names);