From 52cb19d99d3d667f4475f404a333e347654808dc Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sun, 28 Jan 2018 12:04:46 +0000 Subject: [PATCH] rootston: fix compilation without XWayland support In case wlroots is not being compiled with XWayland support, we will not have an xwayland surface in our roots view. While we make sure to pay attention to that in some places, we are not being consistent and try to access the xwayland surface in other places. Obviously, this leads to a compiler error due to the field not being present. Fix the issue by sprinkling in a few additional ifdefs where required. --- include/rootston/view.h | 2 ++ rootston/desktop.c | 2 ++ rootston/output.c | 8 ++++++++ rootston/seat.c | 2 ++ 4 files changed, 14 insertions(+) diff --git a/include/rootston/view.h b/include/rootston/view.h index e837586a..e1172bca 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -51,7 +51,9 @@ struct roots_xwayland_surface { enum roots_view_type { ROOTS_WL_SHELL_VIEW, ROOTS_XDG_SHELL_V6_VIEW, +#ifdef WLR_HAS_XWAYLAND ROOTS_XWAYLAND_VIEW, +#endif }; struct roots_view { diff --git a/rootston/desktop.c b/rootston/desktop.c index 70dafec4..59d1e58b 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -490,6 +490,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, desktop->server = server; desktop->config = config; +#ifdef WLR_HAS_XWAYLAND const char *cursor_theme = NULL; const char *cursor_default = ROOTS_XCURSOR_DEFAULT; struct roots_cursor_config *cc = @@ -509,6 +510,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, free(desktop); return NULL; } +#endif desktop->layout = wlr_output_layout_create(); desktop->layout_change.notify = handle_layout_change; diff --git a/rootston/output.c b/rootston/output.c index 689956ad..1fb848b9 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -137,6 +137,7 @@ static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface, } } +#ifdef WLR_HAS_XWAYLAND static void render_xwayland_children(struct wlr_xwayland_surface *surface, struct roots_desktop *desktop, struct wlr_output *wlr_output, struct timespec *when) { @@ -149,6 +150,7 @@ static void render_xwayland_children(struct wlr_xwayland_surface *surface, render_xwayland_children(child, desktop, wlr_output, when); } } +#endif static void render_decorations(struct roots_view *view, struct roots_desktop *desktop, struct wlr_output *output) { @@ -198,10 +200,12 @@ static void render_view(struct roots_view *view, struct roots_desktop *desktop, render_wl_shell_surface(view->wl_shell_surface, desktop, wlr_output, when, view->x, view->y, view->rotation, false); break; +#ifdef WLR_HAS_XWAYLAND case ROOTS_XWAYLAND_VIEW: render_surface(view->wlr_surface, desktop, wlr_output, when, view->x, view->y, view->rotation); break; +#endif } } @@ -215,8 +219,10 @@ static bool has_standalone_surface(struct roots_view *view) { return wl_list_empty(&view->xdg_surface_v6->popups); case ROOTS_WL_SHELL_VIEW: return wl_list_empty(&view->wl_shell_surface->popups); +#ifdef WLR_HAS_XWAYLAND case ROOTS_XWAYLAND_VIEW: return wl_list_empty(&view->xwayland_surface->children); +#endif } return true; } @@ -264,10 +270,12 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { // During normal rendering the xwayland window tree isn't traversed // because all windows are rendered. Here we only want to render // the fullscreen window's children so we have to traverse the tree. +#ifdef WLR_HAS_XWAYLAND if (view->type == ROOTS_XWAYLAND_VIEW) { render_xwayland_children(view->xwayland_surface, desktop, wlr_output, &now); } +#endif } wlr_renderer_end(server->renderer); wlr_output_swap_buffers(wlr_output); diff --git a/rootston/seat.c b/rootston/seat.c index e6e505b5..d7353d1e 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -651,10 +651,12 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { return; } +#ifdef WLR_HAS_XWAYLAND if (view && view->type == ROOTS_XWAYLAND_VIEW && view->xwayland_surface->override_redirect) { return; } +#endif struct roots_seat_view *seat_view = NULL; if (view != NULL) { seat_view = roots_seat_view_from_view(seat, view);