]> git.sur5r.net Git - i3/i3/blobdiff - src/workspace.c
Merge pull request #2998 from orestisf1993/issue-2990
[i3/i3] / src / workspace.c
index d7f2ce7c55e8ce631b18a2f41aede336dc48983c..d200b6e43fd391d0244ba2aff6d05af01b6fd911 100644 (file)
@@ -188,7 +188,7 @@ Con *create_workspace_on_output(Output *output, Con *content) {
         struct Workspace_Assignment *assignment;
         TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
             if (strcmp(assignment->name, target_name) != 0 ||
-                strcmp(assignment->output, output->name) == 0)
+                strcmp(assignment->output, output_primary_name(output)) == 0)
                 continue;
 
             assigned = true;
@@ -412,7 +412,7 @@ static void _workspace_show(Con *workspace) {
     if (next->urgent && (int)(config.workspace_urgency_timer * 1000) > 0) {
         /* focus for now… */
         next->urgent = false;
-        con_focus(next);
+        con_activate(next);
 
         /* … but immediately reset urgency flags; they will be set to false by
          * the timer callback in case the container is focused at the time of
@@ -435,7 +435,7 @@ static void _workspace_show(Con *workspace) {
             ev_timer_again(main_loop, focused->urgency_timer);
         }
     } else
-        con_focus(next);
+        con_activate(next);
 
     ipc_send_workspace_event("focus", workspace, current);
 
@@ -459,6 +459,11 @@ static void _workspace_show(Con *workspace) {
 
             y(free);
 
+            /* Avoid calling output_push_sticky_windows later with a freed container. */
+            if (old == old_focus) {
+                old_focus = NULL;
+            }
+
             ewmh_update_number_of_desktops();
             ewmh_update_desktop_names();
             ewmh_update_desktop_viewport();
@@ -832,7 +837,7 @@ void ws_force_orientation(Con *ws, orientation_t orientation) {
     con_fix_percent(ws);
 
     if (old_focused)
-        con_focus(old_focused);
+        con_activate(old_focused);
 }
 
 /*
@@ -935,7 +940,7 @@ bool workspace_move_to_output(Con *ws, const char *name) {
         bool used_assignment = false;
         struct Workspace_Assignment *assignment;
         TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
-            if (assignment->output == NULL || strcmp(assignment->output, current_output->name) != 0)
+            if (assignment->output == NULL || strcmp(assignment->output, output_primary_name(current_output)) != 0)
                 continue;
 
             /* check if this workspace is already attached to the tree */