/* unfocus the client (dispatchs the focus event) (we're out of the
transient lists already, so being modal doesn't matter) */
- if (client->focused)
+ if (client_focused(client))
client_unfocus(client);
if (ob_state != State_Exiting) {
self->title = self->icon_title = NULL;
self->res_name = self->res_class = self->role = NULL;
self->wmstate = NormalState;
- self->focused = FALSE;
self->transient = FALSE;
self->transients = NULL;
self->transient_for = NULL;
Client *c = it->data;
if (c == skip) continue; /* circular? */
if ((ret = search_focus_tree(c, skip))) return ret;
- if (c->focused) return c;
+ if (client_focused(c)) return c;
}
return NULL;
}
return FALSE;
}
}
-
+
+ if (client_focused(self))
+ return TRUE;
+
if (self->can_focus)
XSetInputFocus(ob_display, self->window, RevertToNone, CurrentTime);
XSendEvent(ob_display, self->window, FALSE, NoEventMask, &ce);
}
- /*XSync(ob_display, FALSE); XXX Why sync? */
+ /* XSync(ob_display, FALSE); XXX Why sync? */
return TRUE;
}
g_assert(focus_client == self);
focus_set_client(NULL);
}
+
+gboolean client_focused(Client *self)
+{
+ return self == focus_client;
+}