ipc: change active to visible, introduce focused

visible == currently visible on the output it is on
(multiple workspaces can be visible at the same time)
focused == has the focus (only one workspace can be focused)
This commit is contained in:
Michael Stapelberg 2010-03-12 03:01:34 +01:00
parent 7c1be83692
commit 9ed5e00107
1 changed files with 8 additions and 1 deletions

View File

@ -101,6 +101,10 @@ static void ipc_send_message(int fd, const unsigned char *payload,
static void ipc_send_workspaces(int fd) { static void ipc_send_workspaces(int fd) {
Workspace *ws; Workspace *ws;
Client *last_focused = SLIST_FIRST(&(c_ws->focus_stack));
if (last_focused == SLIST_END(&(c_ws->focus_stack)))
last_focused = NULL;
yajl_gen gen = yajl_gen_alloc(NULL, NULL); yajl_gen gen = yajl_gen_alloc(NULL, NULL);
y(array_open); y(array_open);
@ -115,9 +119,12 @@ static void ipc_send_workspaces(int fd) {
ystr("name"); ystr("name");
ystr(ws->utf8_name); ystr(ws->utf8_name);
ystr("active"); ystr("visible");
y(bool, ws->output->current_workspace == ws); y(bool, ws->output->current_workspace == ws);
ystr("focused");
y(bool, (last_focused != NULL && last_focused->workspace == ws));
ystr("rect"); ystr("rect");
y(map_open); y(map_open);
ystr("x"); ystr("x");