diff options
author | 2018-07-25 20:56:23 +1000 | |
---|---|---|
committer | 2018-07-26 08:27:07 +1000 | |
commit | 27a20a488465468511de9b2307941ac1bc4db8bf (patch) | |
tree | c5c1aff483cb089870ffebec00869347eec29f4c /sway/tree/view.c | |
parent | Merge pull request #2330 from progandy/set-modifier-locks (diff) | |
download | sway-27a20a488465468511de9b2307941ac1bc4db8bf.tar.gz sway-27a20a488465468511de9b2307941ac1bc4db8bf.tar.zst sway-27a20a488465468511de9b2307941ac1bc4db8bf.zip |
Allow containers to be fullscreen
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 73 |
1 files changed, 4 insertions, 69 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index beeb8144..82c3ad4a 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -225,7 +225,7 @@ void view_autoconfigure(struct sway_view *view) { | |||
225 | 225 | ||
226 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); | 226 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); |
227 | 227 | ||
228 | if (view->is_fullscreen) { | 228 | if (view->swayc->is_fullscreen) { |
229 | view->x = output->x; | 229 | view->x = output->x; |
230 | view->y = output->y; | 230 | view->y = output->y; |
231 | view->width = output->width; | 231 | view->width = output->width; |
@@ -233,10 +233,6 @@ void view_autoconfigure(struct sway_view *view) { | |||
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | 235 | ||
236 | if (container_is_floating(view->swayc)) { | ||
237 | return; | ||
238 | } | ||
239 | |||
240 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | 236 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); |
241 | 237 | ||
242 | int other_views = 0; | 238 | int other_views = 0; |
@@ -349,68 +345,6 @@ void view_set_tiled(struct sway_view *view, bool tiled) { | |||
349 | } | 345 | } |
350 | } | 346 | } |
351 | 347 | ||
352 | void view_set_fullscreen(struct sway_view *view, bool fullscreen) { | ||
353 | if (view->is_fullscreen == fullscreen) { | ||
354 | return; | ||
355 | } | ||
356 | |||
357 | struct sway_container *workspace = | ||
358 | container_parent(view->swayc, C_WORKSPACE); | ||
359 | |||
360 | if (view->impl->set_fullscreen) { | ||
361 | view->impl->set_fullscreen(view, fullscreen); | ||
362 | } | ||
363 | |||
364 | view->is_fullscreen = fullscreen; | ||
365 | |||
366 | if (fullscreen) { | ||
367 | if (workspace->sway_workspace->fullscreen) { | ||
368 | view_set_fullscreen(workspace->sway_workspace->fullscreen, false); | ||
369 | } | ||
370 | workspace->sway_workspace->fullscreen = view; | ||
371 | view->saved_x = view->x; | ||
372 | view->saved_y = view->y; | ||
373 | view->saved_width = view->width; | ||
374 | view->saved_height = view->height; | ||
375 | view->swayc->saved_x = view->swayc->x; | ||
376 | view->swayc->saved_y = view->swayc->y; | ||
377 | view->swayc->saved_width = view->swayc->width; | ||
378 | view->swayc->saved_height = view->swayc->height; | ||
379 | |||
380 | struct sway_seat *seat; | ||
381 | struct sway_container *focus, *focus_ws; | ||
382 | wl_list_for_each(seat, &input_manager->seats, link) { | ||
383 | focus = seat_get_focus(seat); | ||
384 | if (focus) { | ||
385 | focus_ws = focus; | ||
386 | if (focus && focus_ws->type != C_WORKSPACE) { | ||
387 | focus_ws = container_parent(focus_ws, C_WORKSPACE); | ||
388 | } | ||
389 | seat_set_focus(seat, view->swayc); | ||
390 | if (focus_ws != workspace) { | ||
391 | seat_set_focus(seat, focus); | ||
392 | } | ||
393 | } | ||
394 | } | ||
395 | } else { | ||
396 | workspace->sway_workspace->fullscreen = NULL; | ||
397 | if (container_is_floating(view->swayc)) { | ||
398 | view->x = view->saved_x; | ||
399 | view->y = view->saved_y; | ||
400 | view->width = view->saved_width; | ||
401 | view->height = view->saved_height; | ||
402 | container_set_geometry_from_floating_view(view->swayc); | ||
403 | } else { | ||
404 | view->swayc->width = view->swayc->saved_width; | ||
405 | view->swayc->height = view->swayc->saved_height; | ||
406 | } | ||
407 | } | ||
408 | |||
409 | container_end_mouse_operation(view->swayc); | ||
410 | |||
411 | ipc_event_window(view->swayc, "fullscreen_mode"); | ||
412 | } | ||
413 | |||
414 | void view_close(struct sway_view *view) { | 348 | void view_close(struct sway_view *view) { |
415 | if (view->impl->close) { | 349 | if (view->impl->close) { |
416 | view->impl->close(view); | 350 | view->impl->close(view); |
@@ -680,7 +614,7 @@ void view_unmap(struct sway_view *view) { | |||
680 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | 614 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); |
681 | 615 | ||
682 | struct sway_container *parent; | 616 | struct sway_container *parent; |
683 | if (view->is_fullscreen) { | 617 | if (view->swayc->is_fullscreen) { |
684 | ws->sway_workspace->fullscreen = NULL; | 618 | ws->sway_workspace->fullscreen = NULL; |
685 | parent = container_destroy(view->swayc); | 619 | parent = container_destroy(view->swayc); |
686 | 620 | ||
@@ -1133,7 +1067,8 @@ bool view_is_visible(struct sway_view *view) { | |||
1133 | container = container->parent; | 1067 | container = container->parent; |
1134 | } | 1068 | } |
1135 | // Check view isn't hidden by another fullscreen view | 1069 | // Check view isn't hidden by another fullscreen view |
1136 | if (workspace->sway_workspace->fullscreen && !view->is_fullscreen) { | 1070 | if (workspace->sway_workspace->fullscreen && |
1071 | !container_is_fullscreen_or_child(view->swayc)) { | ||
1137 | return false; | 1072 | return false; |
1138 | } | 1073 | } |
1139 | // Check the workspace is visible | 1074 | // Check the workspace is visible |