From a0cd3c2bab4d8bc7e9137d090728f744d2400e02 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 29 Nov 2010 11:10:17 +0100 Subject: [PATCH] Include 'percent' in tree JSON, use C-locale when dumping, update testcase --- src/ipc.c | 5 +++++ src/util.c | 3 +++ testcases/t/16-nestedcons.t | 1 + 3 files changed, 9 insertions(+) diff --git a/src/ipc.c b/src/ipc.c index 6106bce7..3954107f 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -180,6 +180,9 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) { ystr("orientation"); y(integer, con->orientation); + ystr("percent"); + y(double, con->percent); + ystr("urgent"); y(integer, con->urgent); @@ -244,8 +247,10 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) { } IPC_HANDLER(tree) { + setlocale(LC_NUMERIC, "C"); yajl_gen gen = yajl_gen_alloc(NULL, NULL); dump_node(gen, croot, false); + setlocale(LC_NUMERIC, ""); const unsigned char *payload; unsigned int length; diff --git a/src/util.c b/src/util.c index cd58bce3..e05ce465 100644 --- a/src/util.c +++ b/src/util.c @@ -368,10 +368,13 @@ static char **append_argument(char **original, char *argument) { #define ystr(str) yajl_gen_string(gen, (unsigned char*)str, strlen(str)) void store_restart_layout() { + setlocale(LC_NUMERIC, "C"); yajl_gen gen = yajl_gen_alloc(NULL, NULL); dump_node(gen, croot, true); + setlocale(LC_NUMERIC, ""); + const unsigned char *payload; unsigned int length; y(get_buf, &payload, &length); diff --git a/testcases/t/16-nestedcons.t b/testcases/t/16-nestedcons.t index d3fd3175..365b0054 100644 --- a/testcases/t/16-nestedcons.t +++ b/testcases/t/16-nestedcons.t @@ -22,6 +22,7 @@ my $expected = { id => ignore(), rect => ignore(), window_rect => ignore(), + percent => 0, layout => 0, focus => ignore(), focused => 0, -- 2.39.5