view: Move xdg_surface + xwayland_surface to derived structs

Add xdg_surface_from_view() + xwayland_surface_from_view() accessors
that assert() the view is of the expected type before returning.

Fix a real bug in xdg.c parent_of() that dereferenced
`view->xdg_surface->toplevel` without first checking `view->type`.

The goal of the new accessors is to catch similar bugs in future.
This commit is contained in:
John Lindgren 2022-11-25 13:41:12 -05:00 committed by Johan Malm
parent df7276345f
commit 4da37c6532
7 changed files with 147 additions and 106 deletions

View file

@ -40,13 +40,6 @@ struct view {
struct wl_list link;
struct output *output;
struct workspace *workspace;
union {
struct wlr_xdg_surface *xdg_surface;
#if HAVE_XWAYLAND
struct wlr_xwayland_surface *xwayland_surface;
#endif
};
struct wlr_surface *surface;
struct wlr_scene_tree *scene_tree;
struct wlr_scene_node *scene_node;
@ -97,6 +90,7 @@ struct view {
struct xdg_toplevel_view {
struct view base;
struct wlr_xdg_surface *xdg_surface;
/* Events unique to xdg-toplevel views */
struct wl_listener set_app_id;
@ -106,6 +100,7 @@ struct xdg_toplevel_view {
#if HAVE_XWAYLAND
struct xwayland_view {
struct view base;
struct wlr_xwayland_surface *xwayland_surface;
/* Events unique to XWayland views */
struct wl_listener request_configure;
@ -166,4 +161,12 @@ void view_adjust_size(struct view *view, int *w, int *h);
void view_on_output_destroy(struct view *view);
void view_destroy(struct view *view);
/* xdg.c */
struct wlr_xdg_surface *xdg_surface_from_view(struct view *view);
/* xwayland.c */
#if HAVE_XWAYLAND
struct wlr_xwayland_surface *xwayland_surface_from_view(struct view *view);
#endif
#endif /* __LABWC_VIEW_H */

View file

@ -310,9 +310,9 @@ process_cursor_motion_out_of_surface(struct server *server, uint32_t time)
double sx = server->seat.cursor->x - lx;
double sy = server->seat.cursor->y - ly;
/* Take into account invisible xdg-shell CSD borders */
if (view && view->type == LAB_XDG_SHELL_VIEW && view->xdg_surface) {
if (view && view->type == LAB_XDG_SHELL_VIEW) {
struct wlr_box geo;
wlr_xdg_surface_get_geometry(view->xdg_surface, &geo);
wlr_xdg_surface_get_geometry(xdg_surface_from_view(view), &geo);
sx += geo.x;
sy += geo.y;
}

View file

@ -22,7 +22,7 @@ move_to_front(struct view *view)
static struct wlr_xwayland_surface *
top_parent_of(struct view *view)
{
struct wlr_xwayland_surface *s = view->xwayland_surface;
struct wlr_xwayland_surface *s = xwayland_surface_from_view(view);
while (s->parent) {
s = s->parent;
}
@ -35,6 +35,8 @@ move_xwayland_sub_views_to_front(struct view *parent)
if (!parent || parent->type != LAB_XWAYLAND_VIEW) {
return;
}
struct wlr_xwayland_surface *parent_xwayland_surface =
xwayland_surface_from_view(parent);
struct view *view, *next;
wl_list_for_each_reverse_safe(view, next, &parent->server->views, link)
{
@ -48,7 +50,7 @@ move_xwayland_sub_views_to_front(struct view *parent)
if (!view->mapped && !view->minimized) {
continue;
}
if (top_parent_of(view) != parent->xwayland_surface) {
if (top_parent_of(view) != parent_xwayland_surface) {
continue;
}
move_to_front(view);

View file

@ -35,7 +35,7 @@ is_title_different(struct view *view)
#if HAVE_XWAYLAND
case LAB_XWAYLAND_VIEW:
return g_strcmp0(view_get_string_prop(view, "title"),
view->xwayland_surface->class);
view_get_string_prop(view, "class"));
#endif
}
return 1;

View file

@ -186,7 +186,8 @@ view_adjust_size(struct view *view, int *w, int *h)
int min_height = MIN_VIEW_HEIGHT;
#if HAVE_XWAYLAND
if (view->type == LAB_XWAYLAND_VIEW) {
xcb_size_hints_t *hints = view->xwayland_surface->size_hints;
xcb_size_hints_t *hints =
xwayland_surface_from_view(view)->size_hints;
/*
* Honor size increments from WM_SIZE_HINTS. Typically, X11

112
src/xdg.c
View file

@ -7,6 +7,25 @@
#include "view.h"
#include "workspaces.h"
struct wlr_xdg_surface *
xdg_surface_from_view(struct view *view)
{
assert(view->type == LAB_XDG_SHELL_VIEW);
struct xdg_toplevel_view *xdg_toplevel_view =
(struct xdg_toplevel_view *)view;
assert(xdg_toplevel_view->xdg_surface);
return xdg_toplevel_view->xdg_surface;
}
static struct wlr_xdg_toplevel *
xdg_toplevel_from_view(struct view *view)
{
struct wlr_xdg_surface *xdg_surface = xdg_surface_from_view(view);
assert(xdg_surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
assert(xdg_surface->toplevel);
return xdg_surface->toplevel;
}
static void
handle_new_xdg_popup(struct wl_listener *listener, void *data)
{
@ -29,7 +48,8 @@ has_ssd(struct view *view)
* geometry.{x,y} seems to be greater than zero. We filter on that
* on the assumption that this will remain true.
*/
struct wlr_xdg_surface_state *current = &view->xdg_surface->current;
struct wlr_xdg_surface_state *current =
&xdg_surface_from_view(view)->current;
if (current->geometry.x || current->geometry.y) {
return false;
}
@ -40,9 +60,11 @@ static void
handle_commit(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, commit);
struct wlr_xdg_surface *xdg_surface = xdg_surface_from_view(view);
assert(view->surface);
struct wlr_box size;
wlr_xdg_surface_get_geometry(view->xdg_surface, &size);
wlr_xdg_surface_get_geometry(xdg_surface, &size);
bool update_required = false;
@ -53,7 +75,7 @@ handle_commit(struct wl_listener *listener, void *data)
}
uint32_t serial = view->pending_move_resize.configure_serial;
if (serial > 0 && serial >= view->xdg_surface->current.configure_serial) {
if (serial > 0 && serial >= xdg_surface->current.configure_serial) {
if (view->pending_move_resize.update_x) {
update_required = true;
view->x = view->pending_move_resize.x +
@ -64,7 +86,7 @@ handle_commit(struct wl_listener *listener, void *data)
view->y = view->pending_move_resize.y +
view->pending_move_resize.height - size.height;
}
if (serial == view->xdg_surface->current.configure_serial) {
if (serial == xdg_surface->current.configure_serial) {
view->pending_move_resize.configure_serial = 0;
}
}
@ -94,7 +116,7 @@ handle_destroy(struct wl_listener *listener, void *data)
assert(view->type == LAB_XDG_SHELL_VIEW);
/* Reset XDG specific surface for good measure */
view->xdg_surface = NULL;
((struct xdg_toplevel_view *)view)->xdg_surface = NULL;
/* Remove XDG specific handlers */
wl_list_remove(&view->destroy.link);
@ -140,14 +162,14 @@ static void
handle_request_minimize(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, request_minimize);
view_minimize(view, view->xdg_surface->toplevel->requested.minimized);
view_minimize(view, xdg_toplevel_from_view(view)->requested.minimized);
}
static void
handle_request_maximize(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, request_maximize);
view_maximize(view, view->xdg_surface->toplevel->requested.maximized,
view_maximize(view, xdg_toplevel_from_view(view)->requested.maximized,
/*store_natural_geometry*/ true);
}
@ -155,9 +177,9 @@ static void
handle_request_fullscreen(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, request_fullscreen);
view_set_fullscreen(view,
view->xdg_surface->toplevel->requested.fullscreen,
view->xdg_surface->toplevel->requested.fullscreen_output);
struct wlr_xdg_toplevel *xdg_toplevel = xdg_toplevel_from_view(view);
view_set_fullscreen(view, xdg_toplevel->requested.fullscreen,
xdg_toplevel->requested.fullscreen_output);
}
static void
@ -190,7 +212,8 @@ xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
view->pending_move_resize.width = geo.width;
view->pending_move_resize.height = geo.height;
uint32_t serial = wlr_xdg_toplevel_set_size(view->xdg_surface->toplevel,
struct wlr_xdg_toplevel *xdg_toplevel = xdg_toplevel_from_view(view);
uint32_t serial = wlr_xdg_toplevel_set_size(xdg_toplevel,
(uint32_t)geo.width, (uint32_t)geo.height);
if (serial > 0) {
view->pending_move_resize.configure_serial = serial;
@ -212,44 +235,39 @@ xdg_toplevel_view_move(struct view *view, int x, int y)
static void
xdg_toplevel_view_close(struct view *view)
{
wlr_xdg_toplevel_send_close(view->xdg_surface->toplevel);
wlr_xdg_toplevel_send_close(xdg_toplevel_from_view(view));
}
static void
xdg_toplevel_view_maximize(struct view *view, bool maximized)
{
wlr_xdg_toplevel_set_maximized(view->xdg_surface->toplevel, maximized);
wlr_xdg_toplevel_set_maximized(xdg_toplevel_from_view(view), maximized);
}
static void
xdg_toplevel_view_set_activated(struct view *view, bool activated)
{
struct wlr_xdg_surface *surface = view->xdg_surface;
if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
wlr_xdg_toplevel_set_activated(surface->toplevel, activated);
}
wlr_xdg_toplevel_set_activated(xdg_toplevel_from_view(view), activated);
}
static void
xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
{
wlr_xdg_toplevel_set_fullscreen(view->xdg_surface->toplevel, fullscreen);
}
static bool
istopmost(struct view *view)
{
return !view->xdg_surface->toplevel->parent;
wlr_xdg_toplevel_set_fullscreen(xdg_toplevel_from_view(view),
fullscreen);
}
static struct view *
parent_of(struct view *view)
lookup_view_by_xdg_toplevel(struct server *server,
struct wlr_xdg_toplevel *xdg_toplevel)
{
struct view *p;
wl_list_for_each(p, &view->server->views, link) {
if (p->xdg_surface->toplevel
== view->xdg_surface->toplevel->parent) {
return p;
struct view *view;
wl_list_for_each(view, &server->views, link) {
if (view->type != LAB_XDG_SHELL_VIEW) {
continue;
}
if (xdg_toplevel_from_view(view) == xdg_toplevel) {
return view;
}
}
return NULL;
@ -258,13 +276,17 @@ parent_of(struct view *view)
static void
position_xdg_toplevel_view(struct view *view)
{
if (istopmost(view)) {
struct wlr_xdg_surface *xdg_surface = xdg_surface_from_view(view);
struct wlr_xdg_toplevel *parent_xdg_toplevel =
xdg_toplevel_from_view(view)->parent;
if (!parent_xdg_toplevel) {
struct wlr_box box =
output_usable_area_from_cursor_coords(view->server);
view->x = box.x;
view->y = box.y;
view->w = view->xdg_surface->current.geometry.width;
view->h = view->xdg_surface->current.geometry.height;
view->w = xdg_surface->current.geometry.width;
view->h = xdg_surface->current.geometry.height;
if (view->w && view->h) {
view_center(view);
}
@ -273,12 +295,13 @@ position_xdg_toplevel_view(struct view *view)
* If child-toplevel-views, we center-align relative to their
* parents
*/
struct view *parent = parent_of(view);
struct view *parent = lookup_view_by_xdg_toplevel(
view->server, parent_xdg_toplevel);
assert(parent);
int center_x = parent->x + parent->w / 2;
int center_y = parent->y + parent->h / 2;
view->x = center_x - view->xdg_surface->current.geometry.width / 2;
view->y = center_y - view->xdg_surface->current.geometry.height / 2;
view->x = center_x - xdg_surface->current.geometry.width / 2;
view->y = center_y - xdg_surface->current.geometry.height / 2;
}
view->x += view->ssd.margin.left;
view->y += view->ssd.margin.top;
@ -287,11 +310,12 @@ position_xdg_toplevel_view(struct view *view)
static const char *
xdg_toplevel_view_get_string_prop(struct view *view, const char *prop)
{
struct wlr_xdg_toplevel *xdg_toplevel = xdg_toplevel_from_view(view);
if (!strcmp(prop, "title")) {
return view->xdg_surface->toplevel->title;
return xdg_toplevel->title;
}
if (!strcmp(prop, "app_id")) {
return view->xdg_surface->toplevel->app_id;
return xdg_toplevel->app_id;
}
return "";
}
@ -303,11 +327,12 @@ xdg_toplevel_view_map(struct view *view)
return;
}
view->mapped = true;
view->surface = view->xdg_surface->surface;
struct wlr_xdg_surface *xdg_surface = xdg_surface_from_view(view);
view->surface = xdg_surface->surface;
wlr_scene_node_set_enabled(&view->scene_tree->node, true);
if (!view->been_mapped) {
struct wlr_xdg_toplevel_requested *requested =
&view->xdg_surface->toplevel->requested;
&xdg_toplevel_from_view(view)->requested;
foreign_toplevel_handle_create(view);
view_set_decorations(view, has_ssd(view));
@ -325,8 +350,7 @@ xdg_toplevel_view_map(struct view *view)
}
view->commit.notify = handle_commit;
wl_signal_add(&view->xdg_surface->surface->events.commit,
&view->commit);
wl_signal_add(&xdg_surface->surface->events.commit, &view->commit);
view_impl_map(view);
}
@ -384,14 +408,14 @@ xdg_surface_new(struct wl_listener *listener, void *data)
view->server = server;
view->type = LAB_XDG_SHELL_VIEW;
view->impl = &xdg_toplevel_view_impl;
view->xdg_surface = xdg_surface;
xdg_toplevel_view->xdg_surface = xdg_surface;
view->workspace = server->workspace_current;
view->scene_tree = wlr_scene_tree_create(view->workspace->tree);
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
struct wlr_scene_tree *tree = wlr_scene_xdg_surface_create(
view->scene_tree, view->xdg_surface);
view->scene_tree, xdg_surface);
if (!tree) {
/* TODO: might need further clean up */
wl_resource_post_no_memory(view->surface->resource);

View file

@ -14,6 +14,14 @@ xwayland_view_from_view(struct view *view)
return (struct xwayland_view *)view;
}
struct wlr_xwayland_surface *
xwayland_surface_from_view(struct view *view)
{
struct xwayland_view *xwayland_view = xwayland_view_from_view(view);
assert(xwayland_view->xwayland_surface);
return xwayland_view->xwayland_surface;
}
static void
handle_commit(struct wl_listener *listener, void *data)
{
@ -77,8 +85,6 @@ static void
handle_map(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, map);
assert(data && data == view->xwayland_surface);
view->impl->map(view);
}
@ -86,8 +92,6 @@ static void
handle_unmap(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, unmap);
assert(data && data == view->xwayland_surface);
view->impl->unmap(view);
/*
@ -119,8 +123,9 @@ static void
handle_destroy(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, destroy);
assert(data && data == view->xwayland_surface);
assert(view->xwayland_surface->data == view);
struct xwayland_view *xwayland_view = xwayland_view_from_view(view);
assert(data && data == xwayland_view->xwayland_surface);
assert(xwayland_view->xwayland_surface->data == view);
if (view->surface) {
/*
@ -137,8 +142,8 @@ handle_destroy(struct wl_listener *listener, void *data)
* may not actually be destroyed at this point; it may become an
* "unmanaged" surface instead.
*/
view->xwayland_surface->data = NULL;
view->xwayland_surface = NULL;
xwayland_view->xwayland_surface->data = NULL;
xwayland_view->xwayland_surface = NULL;
/* Remove XWayland specific handlers */
wl_list_remove(&view->map.link);
@ -151,7 +156,6 @@ handle_destroy(struct wl_listener *listener, void *data)
wl_list_remove(&view->request_fullscreen.link);
wl_list_remove(&view->set_title.link);
struct xwayland_view *xwayland_view = xwayland_view_from_view(view);
wl_list_remove(&xwayland_view->request_configure.link);
wl_list_remove(&xwayland_view->set_app_id.link);
wl_list_remove(&xwayland_view->set_decorations.link);
@ -166,15 +170,13 @@ handle_destroy(struct wl_listener *listener, void *data)
static void
configure(struct view *view, struct wlr_box geo)
{
assert(view->xwayland_surface);
view->pending_move_resize.x = geo.x;
view->pending_move_resize.y = geo.y;
view->pending_move_resize.width = geo.width;
view->pending_move_resize.height = geo.height;
wlr_xwayland_surface_configure(view->xwayland_surface, geo.x, geo.y,
geo.width, geo.height);
wlr_xwayland_surface_configure(xwayland_surface_from_view(view),
geo.x, geo.y, geo.width, geo.height);
/* If not resizing, process the move immediately */
if (view->w == geo.width && view->h == geo.height) {
@ -229,7 +231,7 @@ static void
handle_request_fullscreen(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, request_fullscreen);
bool fullscreen = view->xwayland_surface->fullscreen;
bool fullscreen = xwayland_surface_from_view(view)->fullscreen;
view_set_fullscreen(view, fullscreen, NULL);
}
@ -254,8 +256,6 @@ handle_set_class(struct wl_listener *listener, void *data)
static void
move(struct view *view, int x, int y)
{
assert(view->xwayland_surface);
view->x = x;
view->y = y;
@ -263,7 +263,7 @@ move(struct view *view, int x, int y)
view->pending_move_resize.x = x;
view->pending_move_resize.y = y;
struct wlr_xwayland_surface *s = view->xwayland_surface;
struct wlr_xwayland_surface *s = xwayland_surface_from_view(view);
wlr_xwayland_surface_configure(s, (int16_t)x, (int16_t)y,
(uint16_t)s->width, (uint16_t)s->height);
view_moved(view);
@ -272,29 +272,31 @@ move(struct view *view, int x, int y)
static void
_close(struct view *view)
{
wlr_xwayland_surface_close(view->xwayland_surface);
wlr_xwayland_surface_close(xwayland_surface_from_view(view));
}
static const char *
get_string_prop(struct view *view, const char *prop)
{
struct wlr_xwayland_surface *xwayland_surface =
xwayland_surface_from_view(view);
if (!strcmp(prop, "title")) {
return view->xwayland_surface->title;
return xwayland_surface->title;
}
if (!strcmp(prop, "class")) {
return view->xwayland_surface->class;
return xwayland_surface->class;
}
/* We give 'class' for wlr_foreign_toplevel_handle_v1_set_app_id() */
if (!strcmp(prop, "app_id")) {
return view->xwayland_surface->class;
return xwayland_surface->class;
}
return "";
}
static bool
want_deco(struct view *view)
want_deco(struct wlr_xwayland_surface *xwayland_surface)
{
return view->xwayland_surface->decorations ==
return xwayland_surface->decorations ==
WLR_XWAYLAND_SURFACE_DECORATIONS_ALL;
}
@ -304,7 +306,9 @@ handle_set_decorations(struct wl_listener *listener, void *data)
struct xwayland_view *xwayland_view =
wl_container_of(listener, xwayland_view, set_decorations);
struct view *view = &xwayland_view->base;
view_set_decorations(view, want_deco(view));
assert(data && data == xwayland_view->xwayland_surface);
view_set_decorations(view, want_deco(xwayland_view->xwayland_surface));
}
static void
@ -314,7 +318,8 @@ handle_override_redirect(struct wl_listener *listener, void *data)
wl_container_of(listener, xwayland_view, override_redirect);
struct view *view = &xwayland_view->base;
struct wlr_xwayland_surface *xsurface = data;
assert(xsurface && xsurface == view->xwayland_surface);
assert(xsurface && xsurface == xwayland_view->xwayland_surface);
struct server *server = view->server;
bool mapped = xsurface->mapped;
if (mapped) {
@ -330,11 +335,12 @@ handle_override_redirect(struct wl_listener *listener, void *data)
}
static void
set_initial_position(struct view *view)
set_initial_position(struct view *view,
struct wlr_xwayland_surface *xwayland_surface)
{
/* Don't center views with position explicitly specified */
bool has_position = view->xwayland_surface->size_hints &&
(view->xwayland_surface->size_hints->flags &
bool has_position = xwayland_surface->size_hints &&
(xwayland_surface->size_hints->flags &
(XCB_ICCCM_SIZE_HINT_US_POSITION |
XCB_ICCCM_SIZE_HINT_P_POSITION));
@ -374,21 +380,23 @@ map(struct view *view)
}
view->mapped = true;
wlr_scene_node_set_enabled(&view->scene_tree->node, true);
if (!view->fullscreen && view->xwayland_surface->fullscreen) {
struct wlr_xwayland_surface *xwayland_surface =
xwayland_surface_from_view(view);
if (!view->fullscreen && xwayland_surface->fullscreen) {
view_set_fullscreen(view, true, NULL);
}
if (!view->maximized && !view->fullscreen) {
view->x = view->xwayland_surface->x;
view->y = view->xwayland_surface->y;
view->w = view->xwayland_surface->width;
view->h = view->xwayland_surface->height;
view->x = xwayland_surface->x;
view->y = xwayland_surface->y;
view->w = xwayland_surface->width;
view->h = xwayland_surface->height;
}
if (view->surface != view->xwayland_surface->surface) {
if (view->surface != xwayland_surface->surface) {
if (view->surface) {
wl_list_remove(&view->surface_destroy.link);
}
view->surface = view->xwayland_surface->surface;
view->surface = xwayland_surface->surface;
/* Required to set the surface to NULL when destroyed by the client */
view->surface_destroy.notify = handle_surface_destroy;
@ -410,10 +418,10 @@ map(struct view *view)
}
if (!view->been_mapped) {
view_set_decorations(view, want_deco(view));
view_set_decorations(view, want_deco(xwayland_surface));
if (!view->maximized && !view->fullscreen) {
set_initial_position(view);
set_initial_position(view, xwayland_surface);
}
view_moved(view);
@ -425,8 +433,7 @@ map(struct view *view)
}
/* Add commit here, as xwayland map/unmap can change the wlr_surface */
wl_signal_add(&view->xwayland_surface->surface->events.commit,
&view->commit);
wl_signal_add(&xwayland_surface->surface->events.commit, &view->commit);
view->commit.notify = handle_commit;
view_impl_map(view);
@ -447,27 +454,30 @@ unmap(struct view *view)
static void
maximize(struct view *view, bool maximized)
{
wlr_xwayland_surface_set_maximized(view->xwayland_surface, maximized);
wlr_xwayland_surface_set_maximized(xwayland_surface_from_view(view),
maximized);
}
static void
set_activated(struct view *view, bool activated)
{
struct wlr_xwayland_surface *surface = view->xwayland_surface;
struct wlr_xwayland_surface *xwayland_surface =
xwayland_surface_from_view(view);
if (activated && surface->minimized) {
wlr_xwayland_surface_set_minimized(surface, false);
if (activated && xwayland_surface->minimized) {
wlr_xwayland_surface_set_minimized(xwayland_surface, false);
}
wlr_xwayland_surface_activate(surface, activated);
wlr_xwayland_surface_activate(xwayland_surface, activated);
if (activated) {
wlr_xwayland_surface_restack(surface, NULL, XCB_STACK_MODE_ABOVE);
wlr_xwayland_surface_restack(xwayland_surface,
NULL, XCB_STACK_MODE_ABOVE);
/* Restack unmanaged surfaces on top */
struct xwayland_unmanaged *u;
struct wl_list *list = &view->server->unmanaged_surfaces;
wl_list_for_each(u, list, link) {
wlr_xwayland_surface_restack(u->xwayland_surface, NULL,
XCB_STACK_MODE_ABOVE);
wlr_xwayland_surface_restack(u->xwayland_surface,
NULL, XCB_STACK_MODE_ABOVE);
}
}
}
@ -475,7 +485,8 @@ set_activated(struct view *view, bool activated)
static void
set_fullscreen(struct view *view, bool fullscreen)
{
wlr_xwayland_surface_set_fullscreen(view->xwayland_surface, fullscreen);
wlr_xwayland_surface_set_fullscreen(xwayland_surface_from_view(view),
fullscreen);
}
static const struct view_impl xwl_view_impl = {
@ -522,7 +533,7 @@ xwayland_surface_new(struct wl_listener *listener, void *data)
* from the view (destroying the view) and makes it an
* "unmanaged" surface.
*/
view->xwayland_surface = xsurface;
xwayland_view->xwayland_surface = xsurface;
xsurface->data = view;
view->workspace = server->workspace_current;