Fix problem with floating container when switching outputs
Patch status: needinfo
Patch by jj
Long description:
When the top left corner of a floating container is outside of the screen and the command 'focus output <direction>' is used, i3 fails to find the currently focused output and crashes. With this patch, the 'focus output' command checks for both, the top left and down right corner of the focused container, to detect the current output.
To apply this patch, use:
curl http://cr.i3wm.org/patch/177/raw.patch | git am
b/src/commands.c
19 |
@@ -1676,8 +1676,6 @@ void cmd_open(I3_CMD) { |
20 |
* |
21 |
*/ |
22 |
void cmd_focus_output(I3_CMD, char *name) { |
23 |
- owindow *current; |
24 |
- |
25 |
DLOG("name = %s\n", name); |
26 |
|
27 |
HANDLE_EMPTY_MATCH; |
28 |
@@ -1686,8 +1684,10 @@ void cmd_focus_output(I3_CMD, char *name) { |
29 |
Output *current_output = NULL; |
30 |
Output *output; |
31 |
|
32 |
- TAILQ_FOREACH(current, &owindows, owindows) |
33 |
- current_output = get_output_containing(current->con->rect.x, current->con->rect.y); |
34 |
+ current_output = get_output_containing(focused->rect.x, focused->rect.y); |
35 |
+ if (!current_output) |
36 |
+ current_output = get_output_containing(focused->rect.x + focused->rect.width, focused->rect.y + focused->rect.height); |
37 |
+ |
38 |
assert(current_output != NULL); |
39 |
|
40 |
output = get_output_from_string(current_output, name); |