]> git.sur5r.net Git - i3/i3/blobdiff - src/workspace.c
Merge branch 'master' into next
[i3/i3] / src / workspace.c
index d43548983fdb07f96b89c37fe5c6408e1cfd1bec..5a0913bfcc77852c1084fe2f2908097000714b8c 100644 (file)
@@ -338,7 +338,8 @@ static void workspace_defer_update_urgent_hint_cb(EV_P_ ev_timer *w, int revents
  * For the "focus" event we send, along the usual "change" field, also the
  * current and previous workspace, in "current" and "old" respectively.
  */
-static void _workspace_focus_event(Con *current, Con *old) {
+static void ipc_send_workspace_focus_event(Con *current, Con *old) {
+    setlocale(LC_NUMERIC, "C");
     yajl_gen gen = ygenalloc();
 
     y(map_open);
@@ -350,7 +351,10 @@ static void _workspace_focus_event(Con *current, Con *old) {
     dump_node(gen, current, false);
 
     ystr("old");
-    dump_node(gen, old, false);
+    if (old == NULL)
+        y(null);
+    else
+        dump_node(gen, old, false);
 
     y(map_close);
 
@@ -360,6 +364,7 @@ static void _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) {
@@ -437,6 +442,8 @@ static void _workspace_show(Con *workspace) {
     } else
         con_focus(next);
 
+    ipc_send_workspace_focus_event(workspace, old);
+
     DLOG("old = %p / %s\n", old, (old ? old->name : "(null)"));
     /* Close old workspace if necessary. This must be done *after* doing
      * urgency handling, because tree_close() will do a con_focus() on the next
@@ -463,8 +470,6 @@ static void _workspace_show(Con *workspace) {
 
     /* Update the EWMH hints */
     ewmh_update_current_desktop();
-
-    _workspace_focus_event(workspace, current);
 }
 
 /*