xwayland: Implement set_decorations

Fixes games going between borderless and normal windowed modes.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
Joshua Ashton 2021-10-20 16:06:32 +00:00 committed by Johan Malm
parent 89f09567f5
commit 0a7f1b51f7
2 changed files with 11 additions and 0 deletions

View file

@ -278,6 +278,7 @@ struct view {
struct wl_listener request_fullscreen; struct wl_listener request_fullscreen;
struct wl_listener set_title; struct wl_listener set_title;
struct wl_listener set_app_id; /* class on xwayland */ struct wl_listener set_app_id; /* class on xwayland */
struct wl_listener set_decorations; /* xwayland only */
struct wl_listener new_popup; /* xdg-shell only */ struct wl_listener new_popup; /* xdg-shell only */
struct wl_listener new_subsurface; /* xdg-shell only */ struct wl_listener new_subsurface; /* xdg-shell only */
}; };

View file

@ -208,6 +208,12 @@ want_deco(struct view *view)
WLR_XWAYLAND_SURFACE_DECORATIONS_ALL; WLR_XWAYLAND_SURFACE_DECORATIONS_ALL;
} }
static void
handle_set_decorations(struct wl_listener *listener, void *data) {
struct view *view = wl_container_of(listener, view, set_decorations);
view_set_decorations(view, want_deco(view));
}
static void static void
top_left_edge_boundary_check(struct view *view) top_left_edge_boundary_check(struct view *view)
{ {
@ -365,5 +371,9 @@ xwayland_surface_new(struct wl_listener *listener, void *data)
view->set_app_id.notify = handle_set_class; view->set_app_id.notify = handle_set_class;
wl_signal_add(&xsurface->events.set_class, &view->set_app_id); wl_signal_add(&xsurface->events.set_class, &view->set_app_id);
view->set_decorations.notify = handle_set_decorations;
wl_signal_add(&xsurface->events.set_decorations,
&view->set_decorations);
wl_list_insert(&view->server->views, &view->link); wl_list_insert(&view->server->views, &view->link);
} }