Allow focus child/parent when in fullscreen.

This is now restricted according to the already defined fullscreen
focus constraints. Test case 157 was removed, as we don't prevent
level up/down in fullscreen anymore. Those commands are properly
tested in fullscreen by test case 156.

Fixes: #612
This commit is contained in:
Fernando Tarlá Cardoso Lemos
2012-05-26 18:36:25 -03:00
committed by Michael Stapelberg
parent da1e232757
commit 250c260eaa
6 changed files with 48 additions and 80 deletions

View File

@ -1213,23 +1213,26 @@ void cmd_focus_window_mode(I3_CMD, char *window_mode) {
*
*/
void cmd_focus_level(I3_CMD, char *level) {
if (focused &&
focused->type != CT_WORKSPACE &&
focused->fullscreen_mode != CF_NONE) {
LOG("Cannot change focus while in fullscreen mode.\n");
ysuccess(false);
return;
DLOG("level = %s\n", level);
bool success = false;
/* Focusing the parent can only be allowed if the newly
* focused container won't escape the fullscreen container. */
if (strcmp(level, "parent") == 0) {
if (focused && focused->parent) {
if (con_fullscreen_permits_focusing(focused->parent))
success = level_up();
else
LOG("Currently in fullscreen, not going up\n");
}
}
DLOG("level = %s\n", level);
/* Focusing a child should always be allowed. */
else success = level_down();
if (strcmp(level, "parent") == 0)
level_up();
else level_down();
cmd_output->needs_tree_render = true;
cmd_output->needs_tree_render = success;
// XXX: default reply for now, make this a better reply
ysuccess(true);
ysuccess(success);
}
/*