- if (!show) {
- popup_hide(focus_cycle_popup);
- } else {
- Rect *a;
-
- a = screen_area(c->desktop);
- popup_position(focus_cycle_popup, CenterGravity,
- a->x + a->width / 2, a->y + a->height / 2);
-/* popup_size(focus_cycle_popup, a->height/2, a->height/16);
- 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
- */
- popup_size(focus_cycle_popup, 320, 48);
-
- /* use the transient's parent's title/icon */
- while (c->transient_for && c->transient_for != TRAN_GROUP)
- c = c->transient_for;
-
- popup_show(focus_cycle_popup, (c->iconic ? c->icon_title : c->title),
- client_icon(c, 48, 48));
- }
-}
-
-Client *focus_cycle(gboolean forward, gboolean linear, gboolean done,
- gboolean cancel)
-{
- static Client *first = NULL;
- static Client *t = NULL;
- static GList *order = NULL;
- GList *it, *start, *list;
- Client *ft;
-
- if (cancel) {
- if (focus_cycle_target)
- frame_adjust_focus(focus_cycle_target->frame, FALSE);
- if (focus_client)
- frame_adjust_focus(focus_client->frame, TRUE);
- goto done_cycle;
- } else if (done) {
- if (focus_cycle_target)
- client_activate(focus_cycle_target);
- goto done_cycle;
- }
- if (!first)
- grab_pointer(TRUE, None);
-
- if (!first) first = focus_client;
- if (!focus_cycle_target) focus_cycle_target = focus_client;
-
- if (linear) list = client_list;
- else list = focus_order[screen_desktop];
-
- start = it = g_list_find(list, focus_cycle_target);
- if (!start) /* switched desktops or something? */
- start = it = forward ? g_list_last(list) : g_list_first(list);
- if (!start) goto done_cycle;
-
- do {
- if (forward) {
- it = it->next;
- if (it == NULL) it = g_list_first(list);
- } else {
- it = it->prev;
- if (it == NULL) it = g_list_last(list);
- }
- /*ft = client_focus_target(it->data);*/
- ft = it->data;
- if (ft->transients == NULL && /*ft == it->data &&*/client_normal(ft) &&
- (ft->can_focus || ft->focus_notify) &&
- (ft->desktop == screen_desktop || ft->desktop == DESKTOP_ALL)) {
- if (ft != focus_cycle_target) { /* prevents flicker */
- if (focus_cycle_target)
- frame_adjust_focus(focus_cycle_target->frame, FALSE);
- focus_cycle_target = ft;
- frame_adjust_focus(focus_cycle_target->frame, TRUE);
- }
- popup_cycle(ft, config_focus_popup);
- return ft;
- }
- } while (it != start);
-
-done_cycle:
- t = NULL;
- first = NULL;
- focus_cycle_target = NULL;
- g_list_free(order);
- order = NULL;
-
- popup_cycle(ft, FALSE);
- grab_pointer(FALSE, None);