aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-19 23:31:25 +0100
committerGitHub <noreply@github.com>2018-04-19 23:31:25 +0100
commita5719f9f432b5f9378ebd2136f8a2cde46dfb407 (patch)
tree1735e7c33fe5547acfaa56b893fc0b450c0d9483 /sway/desktop/xwayland.c
parent2f0120e458cae47f38a3c09af174bae60964151c (diff)
parent6afccd07d95582a72e36b49454266ab0cebec7c0 (diff)
Merge pull request #1817 from RyanDwyer/fullscreen
Implement fullscreen
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) {
wlr_xwayland_surface_activate(surface, activated);
}
+static void set_fullscreen(struct sway_view *view, bool fullscreen) {
+ if (xwayland_view_from_view(view) == NULL) {
+ return;
+ }
+ struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
+ wlr_xwayland_surface_set_fullscreen(surface, fullscreen);
+}
+
static void _close(struct sway_view *view) {
if (xwayland_view_from_view(view) == NULL) {
return;
@@ -193,6 +201,7 @@ static void destroy(struct sway_view *view) {
}
wl_list_remove(&xwayland_view->destroy.link);
wl_list_remove(&xwayland_view->request_configure.link);
+ wl_list_remove(&xwayland_view->request_fullscreen.link);
wl_list_remove(&xwayland_view->map.link);
wl_list_remove(&xwayland_view->unmap.link);
free(xwayland_view);
@@ -202,6 +211,7 @@ static const struct sway_view_impl view_impl = {
.get_prop = get_prop,
.configure = configure,
.set_activated = set_activated,
+ .set_fullscreen = set_fullscreen,
.close = _close,
.destroy = destroy,
};
@@ -238,6 +248,10 @@ static void handle_map(struct wl_listener *listener, void *data) {
// Put it back into the tree
wlr_xwayland_surface_set_maximized(xsurface, true);
view_map(view, xsurface->surface);
+
+ if (xsurface->fullscreen) {
+ view_set_fullscreen(view, true);
+ }
}
static void handle_destroy(struct wl_listener *listener, void *data) {
@@ -263,6 +277,14 @@ static void handle_request_configure(struct wl_listener *listener, void *data) {
ev->width, ev->height);
}
+static void handle_request_fullscreen(struct wl_listener *listener, void *data) {
+ struct sway_xwayland_view *xwayland_view =
+ wl_container_of(listener, xwayland_view, request_fullscreen);
+ struct sway_view *view = &xwayland_view->view;
+ struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
+ view_set_fullscreen(view, xsurface->fullscreen);
+}
+
void handle_xwayland_surface(struct wl_listener *listener, void *data) {
struct sway_server *server = wl_container_of(listener, server,
xwayland_surface);
@@ -298,6 +320,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
&xwayland_view->request_configure);
xwayland_view->request_configure.notify = handle_request_configure;
+ wl_signal_add(&xsurface->events.request_fullscreen,
+ &xwayland_view->request_fullscreen);
+ xwayland_view->request_fullscreen.notify = handle_request_fullscreen;
+
wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap);
xwayland_view->unmap.notify = handle_unmap;