aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-04-16 20:36:40 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-04-16 20:36:40 +1000
commit52420cc24d61db8d22cf0d391f1f84b37bf087d5 (patch)
treef975a3708c0d1562a8d2fcdceaed9a76aadbf1f4 /sway/tree/view.c
parentMerge pull request #1816 from thejan2009/multi-output-ws-destroy (diff)
downloadsway-52420cc24d61db8d22cf0d391f1f84b37bf087d5.tar.gz
sway-52420cc24d61db8d22cf0d391f1f84b37bf087d5.tar.zst
sway-52420cc24d61db8d22cf0d391f1f84b37bf087d5.zip
Implement fullscreen.
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 99b44720..b958233b 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -2,6 +2,7 @@
2#include <wayland-server.h> 2#include <wayland-server.h>
3#include <wlr/types/wlr_output_layout.h> 3#include <wlr/types/wlr_output_layout.h>
4#include "log.h" 4#include "log.h"
5#include "sway/ipc-server.h"
5#include "sway/output.h" 6#include "sway/output.h"
6#include "sway/tree/container.h" 7#include "sway/tree/container.h"
7#include "sway/tree/layout.h" 8#include "sway/tree/layout.h"
@@ -73,7 +74,46 @@ void view_set_activated(struct sway_view *view, bool activated) {
73 } 74 }
74} 75}
75 76
77void view_set_fullscreen(struct sway_view *view, bool fullscreen) {
78 if (view->is_fullscreen == fullscreen) {
79 return;
80 }
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);
85
86 if (view->impl->set_fullscreen) {
87 view->impl->set_fullscreen(view, fullscreen);
88 }
89
90 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;
97 } else {
98 view_configure(view, view->swayc->saved_x, view->swayc->saved_y,
99 view->saved_width, view->saved_height);
100 workspace->fullscreen = NULL;
101 }
102
103 view->is_fullscreen = fullscreen;
104 output_damage_whole(output);
105
106 arrange_windows(workspace, -1, -1);
107
108 ipc_event_window(view->swayc, "fullscreen_mode");
109}
110
76void view_close(struct sway_view *view) { 111void view_close(struct sway_view *view) {
112 if (view->is_fullscreen) {
113 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
114 ws->fullscreen = NULL;
115 }
116
77 if (view->impl->close) { 117 if (view->impl->close) {
78 view->impl->close(view); 118 view->impl->close(view);
79 } 119 }