aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/tree/container.h1
-rw-r--r--include/sway/tree/view.h1
-rw-r--r--sway/commands/fullscreen.c14
-rw-r--r--sway/desktop/output.c6
-rw-r--r--sway/desktop/xwayland.c12
-rw-r--r--sway/tree/layout.c2
-rw-r--r--sway/tree/view.c18
7 files changed, 13 insertions, 41 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 22bd7240..0283584b 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -72,7 +72,6 @@ struct sway_container {
72 // For C_OUTPUT, this is the output position in layout coordinates 72 // For C_OUTPUT, this is the output position in layout coordinates
73 // For other types, this is the position in output-local coordinates 73 // For other types, this is the position in output-local coordinates
74 double x, y; 74 double x, y;
75 double saved_x, saved_y;
76 // does not include borders or gaps. 75 // does not include borders or gaps.
77 double width, height; 76 double width, height;
78 77
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 73d5f6c7..9dfd171f 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -42,7 +42,6 @@ struct sway_view {
42 struct sway_container *swayc; // NULL for unmanaged views 42 struct sway_container *swayc; // NULL for unmanaged views
43 struct wlr_surface *surface; // NULL for unmapped views 43 struct wlr_surface *surface; // NULL for unmapped views
44 int width, height; 44 int width, height;
45 int saved_width, saved_height;
46 bool is_fullscreen; 45 bool is_fullscreen;
47 46
48 union { 47 union {
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
10struct cmd_results *cmd_fullscreen(int argc, char **argv) { 10struct 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
296renderer_end: 294renderer_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
28static 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
37static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { 28static 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