diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-04-17 08:11:50 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-04-17 08:11:50 +1000 |
commit | bfd5834f4c1046c234ceaae212e65e045cd51460 (patch) | |
tree | fc789c66bd9c20bfc30307c3f675d9c4079b5c4c /sway/commands/fullscreen.c | |
parent | Implement fullscreen. (diff) | |
download | sway-bfd5834f4c1046c234ceaae212e65e045cd51460.tar.gz sway-bfd5834f4c1046c234ceaae212e65e045cd51460.tar.zst sway-bfd5834f4c1046c234ceaae212e65e045cd51460.zip |
Feedback for fullscreen.
Diffstat (limited to 'sway/commands/fullscreen.c')
-rw-r--r-- | sway/commands/fullscreen.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c index 3e256282..5a044aa8 100644 --- a/sway/commands/fullscreen.c +++ b/sway/commands/fullscreen.c | |||
@@ -8,12 +8,6 @@ | |||
8 | 8 | ||
9 | // fullscreen toggle|enable|disable | 9 | // fullscreen toggle|enable|disable |
10 | struct cmd_results *cmd_fullscreen(int argc, char **argv) { | 10 | struct cmd_results *cmd_fullscreen(int argc, char **argv) { |
11 | struct cmd_results *error = NULL; | ||
12 | if (config->reading) return cmd_results_new(CMD_FAILURE, "fullscreen", "Can't be used in config file."); | ||
13 | if (!config->active) return cmd_results_new(CMD_FAILURE, "fullscreen", "Can only be used when sway is running."); | ||
14 | if ((error = checkarg(argc, "fullscreen", EXPECTED_AT_LEAST, 1))) { | ||
15 | return error; | ||
16 | } | ||
17 | struct sway_container *container = | 11 | struct sway_container *container = |
18 | config->handler_context.current_container; | 12 | config->handler_context.current_container; |
19 | if (container->type != C_VIEW) { | 13 | if (container->type != C_VIEW) { |
@@ -23,15 +17,15 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) { | |||
23 | struct sway_view *view = container->sway_view; | 17 | struct sway_view *view = container->sway_view; |
24 | bool wants_fullscreen; | 18 | bool wants_fullscreen; |
25 | 19 | ||
26 | if (strcmp(argv[0], "enable") == 0) { | 20 | if (argc == 0 || strcmp(argv[0], "toggle") == 0) { |
21 | wants_fullscreen = !view->is_fullscreen; | ||
22 | } else if (strcmp(argv[0], "enable") == 0) { | ||
27 | wants_fullscreen = true; | 23 | wants_fullscreen = true; |
28 | } else if (strcmp(argv[0], "disable") == 0) { | 24 | } else if (strcmp(argv[0], "disable") == 0) { |
29 | wants_fullscreen = false; | 25 | wants_fullscreen = false; |
30 | } else if (strcmp(argv[0], "toggle") == 0) { | ||
31 | wants_fullscreen = !view->is_fullscreen; | ||
32 | } else { | 26 | } else { |
33 | return cmd_results_new(CMD_INVALID, "fullscreen", | 27 | return cmd_results_new(CMD_INVALID, "fullscreen", |
34 | "Expected 'fullscreen <enable|disable|toggle>'"); | 28 | "Expected 'fullscreen' or fullscreen <enable|disable|toggle>'"); |
35 | } | 29 | } |
36 | 30 | ||
37 | view_set_fullscreen(view, wants_fullscreen); | 31 | view_set_fullscreen(view, wants_fullscreen); |