aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 69166af0..46eaa84c 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -179,6 +179,14 @@ static void set_activated(struct sway_view *view, bool activated) {
179 wlr_xwayland_surface_activate(surface, activated); 179 wlr_xwayland_surface_activate(surface, activated);
180} 180}
181 181
182static void set_fullscreen(struct sway_view *view, bool fullscreen) {
183 if (xwayland_view_from_view(view) == NULL) {
184 return;
185 }
186 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
187 wlr_xwayland_surface_set_fullscreen(surface, fullscreen);
188}
189
182static void _close(struct sway_view *view) { 190static void _close(struct sway_view *view) {
183 if (xwayland_view_from_view(view) == NULL) { 191 if (xwayland_view_from_view(view) == NULL) {
184 return; 192 return;
@@ -193,6 +201,7 @@ static void destroy(struct sway_view *view) {
193 } 201 }
194 wl_list_remove(&xwayland_view->destroy.link); 202 wl_list_remove(&xwayland_view->destroy.link);
195 wl_list_remove(&xwayland_view->request_configure.link); 203 wl_list_remove(&xwayland_view->request_configure.link);
204 wl_list_remove(&xwayland_view->request_fullscreen.link);
196 wl_list_remove(&xwayland_view->map.link); 205 wl_list_remove(&xwayland_view->map.link);
197 wl_list_remove(&xwayland_view->unmap.link); 206 wl_list_remove(&xwayland_view->unmap.link);
198 free(xwayland_view); 207 free(xwayland_view);
@@ -202,6 +211,7 @@ static const struct sway_view_impl view_impl = {
202 .get_prop = get_prop, 211 .get_prop = get_prop,
203 .configure = configure, 212 .configure = configure,
204 .set_activated = set_activated, 213 .set_activated = set_activated,
214 .set_fullscreen = set_fullscreen,
205 .close = _close, 215 .close = _close,
206 .destroy = destroy, 216 .destroy = destroy,
207}; 217};
@@ -238,6 +248,10 @@ static void handle_map(struct wl_listener *listener, void *data) {
238 // Put it back into the tree 248 // Put it back into the tree
239 wlr_xwayland_surface_set_maximized(xsurface, true); 249 wlr_xwayland_surface_set_maximized(xsurface, true);
240 view_map(view, xsurface->surface); 250 view_map(view, xsurface->surface);
251
252 if (xsurface->fullscreen) {
253 view_set_fullscreen(view, true);
254 }
241} 255}
242 256
243static void handle_destroy(struct wl_listener *listener, void *data) { 257static void handle_destroy(struct wl_listener *listener, void *data) {
@@ -263,6 +277,14 @@ static void handle_request_configure(struct wl_listener *listener, void *data) {
263 ev->width, ev->height); 277 ev->width, ev->height);
264} 278}
265 279
280static void handle_request_fullscreen(struct wl_listener *listener, void *data) {
281 struct sway_xwayland_view *xwayland_view =
282 wl_container_of(listener, xwayland_view, request_fullscreen);
283 struct sway_view *view = &xwayland_view->view;
284 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
285 view_set_fullscreen(view, xsurface->fullscreen);
286}
287
266void handle_xwayland_surface(struct wl_listener *listener, void *data) { 288void handle_xwayland_surface(struct wl_listener *listener, void *data) {
267 struct sway_server *server = wl_container_of(listener, server, 289 struct sway_server *server = wl_container_of(listener, server,
268 xwayland_surface); 290 xwayland_surface);
@@ -298,6 +320,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
298 &xwayland_view->request_configure); 320 &xwayland_view->request_configure);
299 xwayland_view->request_configure.notify = handle_request_configure; 321 xwayland_view->request_configure.notify = handle_request_configure;
300 322
323 wl_signal_add(&xsurface->events.request_fullscreen,
324 &xwayland_view->request_fullscreen);
325 xwayland_view->request_fullscreen.notify = handle_request_fullscreen;
326
301 wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap); 327 wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap);
302 xwayland_view->unmap.notify = handle_unmap; 328 xwayland_view->unmap.notify = handle_unmap;
303 329