From fab8b84db753878ee13adf1c1950e83eff19cacf Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 21 Nov 2010 22:12:34 +0100 Subject: [PATCH] ipc: fix current_workspace --- include/data.h | 3 +++ src/ipc.c | 10 ++++------ src/tree.c | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/data.h b/include/data.h index c7fcb4a5..97d47948 100644 --- a/include/data.h +++ b/include/data.h @@ -186,6 +186,9 @@ struct xoutput { /** Name of the output */ char *name; + /** Pointer to the Con which represents this output */ + Con *con; + /** Whether the output is currently active (has a CRTC attached with a * valid mode) */ bool active; diff --git a/src/ipc.c b/src/ipc.c index 7e76ace5..40b6a712 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -343,13 +343,11 @@ IPC_HANDLER(get_outputs) { y(integer, output->rect.height); y(map_close); - /* - * XXX - * No idea how to handle this, where should we get this data from? - * I think we might need to keep a reference to the CT_OUTPUT Con in Output - */ ystr("current_workspace"); - y(null); + Con *ws = NULL; + if (output->con && (ws = con_get_fullscreen_con(output->con))) + ystr(ws->name); + else y(null); y(map_close); } diff --git a/src/tree.c b/src/tree.c index 734406b3..f9f10d59 100644 --- a/src/tree.c +++ b/src/tree.c @@ -69,6 +69,7 @@ void tree_init() { oc->name = strdup(output->name); oc->type = CT_OUTPUT; oc->rect = output->rect; + output->con = oc; char *name; asprintf(&name, "[i3 con] output %s", oc->name); -- 2.39.5