+ for (i = 0; i <= workspace_limit; ++i) {
+ if (head == NULL)
+ head = TAILQ_FIRST(&r->s->ws[(ws->idx + i) %
+ workspace_limit].winlist);
+
+ while (head != NULL &&
+ (head = TAILQ_NEXT(head, entry)) != NULL) {
+ if (head == cur_focus) {
+ winfocus = cur_focus;
+ break;
+ }
+ if (xcb_icccm_get_wm_hints_reply(conn,
+ xcb_icccm_get_wm_hints(conn, head->id),
+ &hints, NULL) != 0 &&
+ xcb_icccm_wm_hints_get_urgency(&hints)) {
+ winfocus = head;
+ break;
+ }
+ }
+
+ if (winfocus != NULL)
+ break;
+ }
+
+ /* Switch ws if new focus is on a different ws. */
+ if (winfocus != NULL && winfocus->ws != ws) {
+ a.id = winfocus->ws->idx;
+ switchws(r, &a);
+ }
+ break;