Re-implement support for the urgency hint, extend t/13-urgent.t

The actual rendering will follow
This commit is contained in:
Michael Stapelberg
2010-06-02 17:51:58 +02:00
parent 03c8da0a74
commit 32be3af109
9 changed files with 137 additions and 75 deletions

@ -429,31 +429,37 @@ void workspace_unmap_clients(xcb_connection_t *conn, Workspace *u_ws) {
ignore_enter_notify_forall(conn, u_ws, false);
}
#endif
static bool get_urgency_flag(Con *con) {
Con *child;
TAILQ_FOREACH(child, &(con->nodes_head), nodes)
if (child->urgent || get_urgency_flag(child))
return true;
TAILQ_FOREACH(child, &(con->floating_head), floating_windows)
if (child->urgent || get_urgency_flag(child))
return true;
return false;
}
/*
* Goes through all clients on the given workspace and updates the workspaces
* urgent flag accordingly.
*
*/
void workspace_update_urgent_flag(Workspace *ws) {
Client *current;
bool old_flag = ws->urgent;
bool urgent = false;
void workspace_update_urgent_flag(Con *ws) {
bool old_flag = ws->urgent;
ws->urgent = get_urgency_flag(ws);
DLOG("Workspace urgency flag changed from %d to %d\n", old_flag, ws->urgent);
SLIST_FOREACH(current, &(ws->focus_stack), focus_clients) {
if (!current->urgent)
continue;
urgent = true;
break;
}
ws->urgent = urgent;
if (old_flag != urgent)
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"urgent\"}");
if (old_flag != ws->urgent)
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"urgent\"}");
}
#if 0
/*
* Returns the width of the workspace.
*