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
// 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);
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);
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);
cmd 'focus output fake-0';
is(focused_output, 'fake-0', 'focus on first output');
+################################################################################
+# use 'focus output' and verify that i3 does not crash when the currently
+# focused window is floating and is only partially mapped on an output screen
+################################################################################
+
+is(focused_output, 'fake-0', 'focus on first output');
+
+my $floating_win = open_window;
+cmd 'floating toggle';
+cmd 'move to absolute position -10 -10';
+
+cmd 'focus output right';
+is(focused_output, 'fake-1', 'focus on second output');
+
+cmd 'focus output fake-0';
+is(focused_output, 'fake-0', 'focus on first output');
+
exit_gracefully($pid);
done_testing;