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

@ -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;