From 305b6ddf2fc069b68295f72195de9c2fd0042b48 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Tue, 13 Nov 2012 09:49:08 +0100
Subject: [PATCH] set LC_NUMERIC=C when dumping nodes in the workspace event

Otherwise the resulting JSON might be invalid because it uses the
locale-specific comma separator, e.g. "16,666" instead of "16.666".
---
 src/workspace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/workspace.c b/src/workspace.c
index e277f072..5a0913bf 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -339,6 +339,7 @@ static void workspace_defer_update_urgent_hint_cb(EV_P_ ev_timer *w, int revents
  * current and previous workspace, in "current" and "old" respectively.
  */
 static void ipc_send_workspace_focus_event(Con *current, Con *old) {
+    setlocale(LC_NUMERIC, "C");
     yajl_gen gen = ygenalloc();
 
     y(map_open);
@@ -363,6 +364,7 @@ static void ipc_send_workspace_focus_event(Con *current, Con *old) {
 
     ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, (const char *)payload);
     y(free);
+    setlocale(LC_NUMERIC, "");
 }
 
 static void _workspace_show(Con *workspace) {