]> git.sur5r.net Git - i3/i3/commitdiff
set LC_NUMERIC=C when dumping nodes in the workspace event
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 13 Nov 2012 08:49:08 +0000 (09:49 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 13 Nov 2012 08:49:08 +0000 (09:49 +0100)
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

index e277f0720c51dff330057d61da8ff4147d22c336..5a0913bfcc77852c1084fe2f2908097000714b8c 100644 (file)
@@ -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) {