aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.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/desktop/xwayland.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/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 69166af0..716d8882 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -25,6 +25,15 @@ 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
28static void unmanaged_handle_commit(struct wl_listener *listener, void *data) { 37static void unmanaged_handle_commit(struct wl_listener *listener, void *data) {
29 struct sway_xwayland_unmanaged *surface = 38 struct sway_xwayland_unmanaged *surface =
30 wl_container_of(listener, surface, commit); 39 wl_container_of(listener, surface, commit);
@@ -106,6 +115,9 @@ static struct sway_xwayland_unmanaged *create_unmanaged(
106 wl_signal_add(&xsurface->events.request_configure, 115 wl_signal_add(&xsurface->events.request_configure,
107 &surface->request_configure); 116 &surface->request_configure);
108 surface->request_configure.notify = unmanaged_handle_request_configure; 117 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;
109 wl_signal_add(&xsurface->events.map, &surface->map); 121 wl_signal_add(&xsurface->events.map, &surface->map);
110 surface->map.notify = unmanaged_handle_map; 122 surface->map.notify = unmanaged_handle_map;
111 wl_signal_add(&xsurface->events.unmap, &surface->unmap); 123 wl_signal_add(&xsurface->events.unmap, &surface->unmap);
@@ -179,6 +191,14 @@ static void set_activated(struct sway_view *view, bool activated) {
179 wlr_xwayland_surface_activate(surface, activated); 191 wlr_xwayland_surface_activate(surface, activated);
180} 192}
181 193
194static void set_fullscreen(struct sway_view *view, bool fullscreen) {
195 if (xwayland_view_from_view(view) == NULL) {
196 return;
197 }
198 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
199 wlr_xwayland_surface_set_fullscreen(surface, fullscreen);
200}
201
182static void _close(struct sway_view *view) { 202static void _close(struct sway_view *view) {
183 if (xwayland_view_from_view(view) == NULL) { 203 if (xwayland_view_from_view(view) == NULL) {
184 return; 204 return;
@@ -193,6 +213,7 @@ static void destroy(struct sway_view *view) {
193 } 213 }
194 wl_list_remove(&xwayland_view->destroy.link); 214 wl_list_remove(&xwayland_view->destroy.link);
195 wl_list_remove(&xwayland_view->request_configure.link); 215 wl_list_remove(&xwayland_view->request_configure.link);
216 wl_list_remove(&xwayland_view->request_fullscreen.link);
196 wl_list_remove(&xwayland_view->map.link); 217 wl_list_remove(&xwayland_view->map.link);
197 wl_list_remove(&xwayland_view->unmap.link); 218 wl_list_remove(&xwayland_view->unmap.link);
198 free(xwayland_view); 219 free(xwayland_view);
@@ -202,6 +223,7 @@ static const struct sway_view_impl view_impl = {
202 .get_prop = get_prop, 223 .get_prop = get_prop,
203 .configure = configure, 224 .configure = configure,
204 .set_activated = set_activated, 225 .set_activated = set_activated,
226 .set_fullscreen = set_fullscreen,
205 .close = _close, 227 .close = _close,
206 .destroy = destroy, 228 .destroy = destroy,
207}; 229};
@@ -263,6 +285,14 @@ static void handle_request_configure(struct wl_listener *listener, void *data) {
263 ev->width, ev->height); 285 ev->width, ev->height);
264} 286}
265 287
288static void handle_request_fullscreen(struct wl_listener *listener, void *data) {
289 struct sway_xwayland_view *xwayland_view =
290 wl_container_of(listener, xwayland_view, request_fullscreen);
291 struct sway_view *view = &xwayland_view->view;
292 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
293 view_set_fullscreen(view, xsurface->fullscreen);
294}
295
266void handle_xwayland_surface(struct wl_listener *listener, void *data) { 296void handle_xwayland_surface(struct wl_listener *listener, void *data) {
267 struct sway_server *server = wl_container_of(listener, server, 297 struct sway_server *server = wl_container_of(listener, server,
268 xwayland_surface); 298 xwayland_surface);
@@ -298,6 +328,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
298 &xwayland_view->request_configure); 328 &xwayland_view->request_configure);
299 xwayland_view->request_configure.notify = handle_request_configure; 329 xwayland_view->request_configure.notify = handle_request_configure;
300 330
331 wl_signal_add(&xsurface->events.request_fullscreen,
332 &xwayland_view->request_fullscreen);
333 xwayland_view->request_fullscreen.notify = handle_request_fullscreen;
334
301 wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap); 335 wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap);
302 xwayland_view->unmap.notify = handle_unmap; 336 xwayland_view->unmap.notify = handle_unmap;
303 337