]> git.sur5r.net Git - i3/i3/blobdiff - src/commands.c
Merge branch 'master' into next
[i3/i3] / src / commands.c
index 9631923d8b4e7fd5f2c1db51fed9cdb6089d824b..32fdc7f170b957d190ce6a719f18978a254ba697 100644 (file)
@@ -77,6 +77,17 @@ static Output *get_output_from_string(Output *current_output, const char *output
     return output;
 }
 
+/*
+ * Returns the output containing the given container.
+ */
+static Output *get_output_of_con(Con *con) {
+    Con *output_con = con_get_output(con);
+    Output *output = get_output_by_name(output_con->name);
+    assert(output != NULL);
+
+    return output;
+}
+
 /*
  * Checks whether we switched to a new workspace and returns false in that case,
  * signaling that further workspace switching should be done by the calling function
@@ -1049,7 +1060,7 @@ void cmd_move_con_to_output(I3_CMD, char *name) {
 
     // TODO: fix the handling of criteria
     TAILQ_FOREACH(current, &owindows, owindows)
-        current_output = get_output_containing(current->con->rect.x, current->con->rect.y);
+        current_output = get_output_of_con(current->con);
 
     assert(current_output != NULL);
 
@@ -1131,8 +1142,7 @@ void cmd_move_workspace_to_output(I3_CMD, char *name) {
 
     owindow *current;
     TAILQ_FOREACH(current, &owindows, owindows) {
-        Output *current_output = get_output_containing(current->con->rect.x,
-                                                       current->con->rect.y);
+        Output *current_output = get_output_of_con(current->con);
         if (!current_output) {
             ELOG("Cannot get current output. This is a bug in i3.\n");
             ysuccess(false);
@@ -1672,7 +1682,7 @@ void cmd_focus_output(I3_CMD, char *name) {
     Output *output;
 
     TAILQ_FOREACH(current, &owindows, owindows)
-        current_output = get_output_containing(current->con->rect.x, current->con->rect.y);
+        current_output = get_output_of_con(current->con);
     assert(current_output != NULL);
 
     output = get_output_from_string(current_output, name);