diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-11-18 11:22:02 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-11-18 11:22:02 -0500 |
commit | 733993a651c71f7e2198d505960d6bbd31e0e107 (patch) | |
tree | e51732c5872b624e73355f9e5b3f762101f3cd0d /sway/commands/fullscreen.c | |
parent | Initial (awful) pass on xdg shell support (diff) | |
download | sway-733993a651c71f7e2198d505960d6bbd31e0e107.tar.gz sway-733993a651c71f7e2198d505960d6bbd31e0e107.tar.zst sway-733993a651c71f7e2198d505960d6bbd31e0e107.zip |
Move everything to sway/old/
Diffstat (limited to 'sway/commands/fullscreen.c')
-rw-r--r-- | sway/commands/fullscreen.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c deleted file mode 100644 index bfff82f9..00000000 --- a/sway/commands/fullscreen.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | #include <stdbool.h> | ||
2 | #include <string.h> | ||
3 | #include <wlc/wlc.h> | ||
4 | #include "sway/commands.h" | ||
5 | #include "sway/container.h" | ||
6 | #include "sway/focus.h" | ||
7 | #include "sway/ipc-server.h" | ||
8 | #include "sway/layout.h" | ||
9 | |||
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, 0))) { | ||
15 | return error; | ||
16 | } | ||
17 | swayc_t *container = current_container; | ||
18 | if(container->type != C_VIEW){ | ||
19 | return cmd_results_new(CMD_INVALID, "fullscreen", "Only views can fullscreen"); | ||
20 | } | ||
21 | swayc_t *workspace = swayc_parent_by_type(container, C_WORKSPACE); | ||
22 | bool current = swayc_is_fullscreen(container); | ||
23 | wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current); | ||
24 | |||
25 | if (container->is_floating) { | ||
26 | if (current) { | ||
27 | // set dimensions back to what they were before we fullscreened this | ||
28 | container->x = container->cached_geometry.origin.x; | ||
29 | container->y = container->cached_geometry.origin.y; | ||
30 | container->width = container->cached_geometry.size.w; | ||
31 | container->height = container->cached_geometry.size.h; | ||
32 | } else { | ||
33 | // cache dimensions so we can reset them after we "unfullscreen" this | ||
34 | struct wlc_geometry geo = { | ||
35 | .origin = { | ||
36 | .x = container->x, | ||
37 | .y = container->y | ||
38 | }, | ||
39 | .size = { | ||
40 | .w = container->width, | ||
41 | .h = container->height | ||
42 | } | ||
43 | }; | ||
44 | container->cached_geometry = geo; | ||
45 | } | ||
46 | } | ||
47 | |||
48 | // Resize workspace if going from fullscreen -> notfullscreen | ||
49 | // otherwise just resize container | ||
50 | if (!current) { | ||
51 | arrange_windows(workspace, -1, -1); | ||
52 | workspace->fullscreen = container; | ||
53 | } else { | ||
54 | arrange_windows(container, -1, -1); | ||
55 | workspace->fullscreen = NULL; | ||
56 | } | ||
57 | ipc_event_window(container, "fullscreen_mode"); | ||
58 | |||
59 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
60 | } | ||