view_from_wlr_xwayland_surface(): fix miscasting of types

The existing code works by accident because the "view" field (of type
sway_view) just happens to be the first field in the
sway_xwayland_view struct.  Depending on that is error-prone; all it
takes is a simple reordering of fields in that struct to trigger a
nonlocal bug.  Adding the correct casting sequence will ensure that
reodering fields won't cause problems.
This commit is contained in:
A. M. Joseph 2019-10-17 00:17:05 -07:00
parent d19f4f7bf8
commit 4dad33fa95

View file

@ -574,7 +574,7 @@ static void handle_set_hints(struct wl_listener *listener, void *data) {
struct sway_view *view_from_wlr_xwayland_surface(
struct wlr_xwayland_surface *xsurface) {
return xsurface->data;
return &((struct sway_xwayland_view*)xsurface->data)->view;
}
void handle_xwayland_surface(struct wl_listener *listener, void *data) {