Extend the fullscreen command

Rather than just toggling the fullscreen modes, allow to set them
directly with:

    fullscreen enable|toggle [global]
    fullscreen disable

For compatibility, retain the previous command and its toggling behavior:

    fullscreen [global]

fixes #1120
This commit is contained in:
Mats
2014-10-26 19:33:09 +01:00
committed by Michael Stapelberg
parent dc351fb291
commit e59a76e456
11 changed files with 273 additions and 45 deletions

View File

@ -1598,20 +1598,26 @@ void cmd_focus(I3_CMD) {
}
/*
* Implementation of 'fullscreen [global]'.
* Implementation of 'fullscreen enable|toggle [global]' and
* 'fullscreen disable'
*
*/
void cmd_fullscreen(I3_CMD, char *fullscreen_mode) {
if (fullscreen_mode == NULL)
fullscreen_mode = "output";
DLOG("toggling fullscreen, mode = %s\n", fullscreen_mode);
void cmd_fullscreen(I3_CMD, char *action, char *fullscreen_mode) {
fullscreen_mode_t mode = strcmp(fullscreen_mode, "global") == 0 ? CF_GLOBAL : CF_OUTPUT;
DLOG("%s fullscreen, mode = %s\n", action, fullscreen_mode);
owindow *current;
HANDLE_EMPTY_MATCH;
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
con_toggle_fullscreen(current->con, (strcmp(fullscreen_mode, "global") == 0 ? CF_GLOBAL : CF_OUTPUT));
if (strcmp(action, "toggle") == 0) {
con_toggle_fullscreen(current->con, mode);
} else if (strcmp(action, "enable") == 0) {
con_enable_fullscreen(current->con, mode);
} else if (strcmp(action, "disable") == 0) {
con_disable_fullscreen(current->con);
}
}
cmd_output->needs_tree_render = true;