Refined the fullscreen focus constraints.

Basically, a focus change can't escape a fullscreen container. The
only exception is per-output fullscreen containers, as you should
be able to focus a container in a different workspace in this case.

This is an improvement on 4eab046e, now considering the difference
between global and per-output fullscreen and taking the tree
structure into account to determine what escaping the fullscreen
container means. It only affects targeted focus commands in the
form "for_window [...] focus", but it lays the foundation for
forthcoming fixes to all other focus commands.
This commit is contained in:
Fernando Tarlá Cardoso Lemos
2012-05-26 17:37:45 -03:00
committed by Michael Stapelberg
parent 0618ef649e
commit da1e232757
4 changed files with 157 additions and 30 deletions

View File

@ -1262,13 +1262,9 @@ void cmd_focus(I3_CMD) {
if (!ws)
continue;
/* Don't allow the focus switch if the focused and current
* containers are in the same workspace. */
if (focused &&
focused->type != CT_WORKSPACE &&
focused->fullscreen_mode != CF_NONE &&
con_get_workspace(focused) == ws) {
LOG("Cannot change focus while in fullscreen mode (same workspace).\n");
/* Check the fullscreen focus constraints. */
if (!con_fullscreen_permits_focusing(current->con)) {
LOG("Cannot change focus while in fullscreen mode (fullscreen rules).\n");
ysuccess(false);
return;
}