diff options
author | 2018-04-17 08:11:50 +1000 | |
---|---|---|
committer | 2018-04-17 08:11:50 +1000 | |
commit | bfd5834f4c1046c234ceaae212e65e045cd51460 (patch) | |
tree | fc789c66bd9c20bfc30307c3f675d9c4079b5c4c /sway | |
parent | Implement fullscreen. (diff) | |
download | sway-bfd5834f4c1046c234ceaae212e65e045cd51460.tar.gz sway-bfd5834f4c1046c234ceaae212e65e045cd51460.tar.zst sway-bfd5834f4c1046c234ceaae212e65e045cd51460.zip |
Feedback for fullscreen.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands/fullscreen.c | 14 | ||||
-rw-r--r-- | sway/desktop/output.c | 6 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 12 | ||||
-rw-r--r-- | sway/tree/layout.c | 2 | ||||
-rw-r--r-- | sway/tree/view.c | 18 |
5 files changed, 13 insertions, 39 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); |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index b86f20e8..dc2f6380 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -287,11 +287,9 @@ static void render_output(struct sway_output *output, struct timespec *when, | |||
287 | render_container(output, workspace); | 287 | render_container(output, workspace); |
288 | 288 | ||
289 | render_unmanaged(output, &root_container.sway_root->xwayland_unmanaged); | 289 | render_unmanaged(output, &root_container.sway_root->xwayland_unmanaged); |
290 | |||
291 | render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); | ||
292 | render_layer(output, | ||
293 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); | ||
294 | } | 290 | } |
291 | render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); | ||
292 | render_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); | ||
295 | 293 | ||
296 | renderer_end: | 294 | renderer_end: |
297 | if (root_container.sway_root->debug_tree) { | 295 | if (root_container.sway_root->debug_tree) { |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 716d8882..963c5a0e 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -25,15 +25,6 @@ static void unmanaged_handle_request_configure(struct wl_listener *listener, | |||
25 | ev->width, ev->height); | 25 | ev->width, ev->height); |
26 | } | 26 | } |
27 | 27 | ||
28 | static void unmanaged_handle_request_fullscreen(struct wl_listener *listener, | ||
29 | void *data) { | ||
30 | struct sway_xwayland_view *xwayland_view = | ||
31 | wl_container_of(listener, xwayland_view, request_fullscreen); | ||
32 | struct sway_view *view = &xwayland_view->view; | ||
33 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | ||
34 | view_set_fullscreen(view, xsurface->fullscreen); | ||
35 | } | ||
36 | |||
37 | static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { | 28 | static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { |
38 | struct sway_xwayland_unmanaged *surface = | 29 | struct sway_xwayland_unmanaged *surface = |
39 | wl_container_of(listener, surface, commit); | 30 | wl_container_of(listener, surface, commit); |
@@ -115,9 +106,6 @@ static struct sway_xwayland_unmanaged *create_unmanaged( | |||
115 | wl_signal_add(&xsurface->events.request_configure, | 106 | wl_signal_add(&xsurface->events.request_configure, |
116 | &surface->request_configure); | 107 | &surface->request_configure); |
117 | surface->request_configure.notify = unmanaged_handle_request_configure; | 108 | surface->request_configure.notify = unmanaged_handle_request_configure; |
118 | wl_signal_add(&xsurface->events.request_fullscreen, | ||
119 | &surface->request_fullscreen); | ||
120 | surface->request_fullscreen.notify = unmanaged_handle_request_fullscreen; | ||
121 | wl_signal_add(&xsurface->events.map, &surface->map); | 109 | wl_signal_add(&xsurface->events.map, &surface->map); |
122 | surface->map.notify = unmanaged_handle_map; | 110 | surface->map.notify = unmanaged_handle_map; |
123 | wl_signal_add(&xsurface->events.unmap, &surface->unmap); | 111 | wl_signal_add(&xsurface->events.unmap, &surface->unmap); |
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index ae6db454..ad097f2e 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -138,7 +138,7 @@ void container_move_to(struct sway_container *container, | |||
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | 140 | ||
141 | if (container->sway_view->is_fullscreen) { | 141 | if (container->type == C_VIEW && container->sway_view->is_fullscreen) { |
142 | struct sway_container *old_workspace = container; | 142 | struct sway_container *old_workspace = container; |
143 | if (old_workspace->type != C_WORKSPACE) { | 143 | if (old_workspace->type != C_WORKSPACE) { |
144 | old_workspace = container_parent(old_workspace, C_WORKSPACE); | 144 | old_workspace = container_parent(old_workspace, C_WORKSPACE); |
diff --git a/sway/tree/view.c b/sway/tree/view.c index b958233b..10285ad0 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -79,32 +79,26 @@ void view_set_fullscreen(struct sway_view *view, bool fullscreen) { | |||
79 | return; | 79 | return; |
80 | } | 80 | } |
81 | 81 | ||
82 | struct sway_container *container = container_parent(view->swayc, C_OUTPUT); | ||
83 | struct sway_output *output = container->sway_output; | ||
84 | struct sway_container *workspace = container_parent(view->swayc, C_WORKSPACE); | 82 | struct sway_container *workspace = container_parent(view->swayc, C_WORKSPACE); |
83 | struct sway_container *container = container_parent(workspace, C_OUTPUT); | ||
84 | struct sway_output *output = container->sway_output; | ||
85 | 85 | ||
86 | if (view->impl->set_fullscreen) { | 86 | if (view->impl->set_fullscreen) { |
87 | view->impl->set_fullscreen(view, fullscreen); | 87 | view->impl->set_fullscreen(view, fullscreen); |
88 | } | 88 | } |
89 | 89 | ||
90 | view->is_fullscreen = fullscreen; | ||
91 | |||
90 | if (fullscreen) { | 92 | if (fullscreen) { |
91 | view->swayc->saved_x = view->swayc->x; | ||
92 | view->swayc->saved_y = view->swayc->y; | ||
93 | view->saved_width = view->width; | ||
94 | view->saved_height = view->height; | ||
95 | view_configure(view, 0, 0, output->wlr_output->width, output->wlr_output->height); | ||
96 | workspace->fullscreen = view; | 93 | workspace->fullscreen = view; |
94 | view_configure(view, 0, 0, output->wlr_output->width, output->wlr_output->height); | ||
97 | } else { | 95 | } else { |
98 | view_configure(view, view->swayc->saved_x, view->swayc->saved_y, | ||
99 | view->saved_width, view->saved_height); | ||
100 | workspace->fullscreen = NULL; | 96 | workspace->fullscreen = NULL; |
97 | arrange_windows(workspace, -1, -1); | ||
101 | } | 98 | } |
102 | 99 | ||
103 | view->is_fullscreen = fullscreen; | ||
104 | output_damage_whole(output); | 100 | output_damage_whole(output); |
105 | 101 | ||
106 | arrange_windows(workspace, -1, -1); | ||
107 | |||
108 | ipc_event_window(view->swayc, "fullscreen_mode"); | 102 | ipc_event_window(view->swayc, "fullscreen_mode"); |
109 | } | 103 | } |
110 | 104 | ||