]> git.sur5r.net Git - i3/i3/blobdiff - src/output.c
Merge pull request #3430 from Synray/aspect_ratio
[i3/i3] / src / output.c
index 0f2bd61726d3930194ac5a7edf4d420db3fde9db..19a7c4afafcecddccfb40e199449bf0b13e788f7 100644 (file)
@@ -10,7 +10,7 @@
 #include "all.h"
 
 /*
- * Returns the output container below the given output container.
+ * Returns the content container below the given output container.
  *
  */
 Con *output_get_content(Con *output) {
@@ -41,7 +41,15 @@ Output *get_output_from_string(Output *current_output, const char *output_str) {
         return get_output_next_wrap(D_DOWN, current_output);
     }
 
-    return get_output_by_name(output_str);
+    return get_output_by_name(output_str, true);
+}
+
+/*
+ * Retrieves the primary name of an output.
+ *
+ */
+char *output_primary_name(Output *output) {
+    return SLIST_FIRST(&output->names_head)->name;
 }
 
 Output *get_output_for_con(Con *con) {
@@ -51,7 +59,7 @@ Output *get_output_for_con(Con *con) {
         return NULL;
     }
 
-    Output *output = get_output_by_name(output_con->name);
+    Output *output = get_output_by_name(output_con->name, true);
     if (output == NULL) {
         ELOG("Could not get output from name \"%s\".\n", output_con->name);
         return NULL;
@@ -91,7 +99,14 @@ void output_push_sticky_windows(Con *to_focus) {
                     continue;
 
                 if (con_is_sticky(current)) {
-                    con_move_to_workspace(current, visible_ws, true, false, current != to_focus->parent);
+                    bool ignore_focus = (to_focus == NULL) || (current != to_focus->parent);
+                    con_move_to_workspace(current, visible_ws, true, false, ignore_focus);
+                    if (!ignore_focus) {
+                        Con *current_ws = con_get_workspace(focused);
+                        con_activate(con_descend_focused(current));
+                        /* Pushing sticky windows shouldn't change the focused workspace. */
+                        con_activate(con_descend_focused(current_ws));
+                    }
                 }
             }
         }