From 52cb19d99d3d667f4475f404a333e347654808dc Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sun, 28 Jan 2018 12:04:46 +0000 Subject: 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. --- rootston/desktop.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'rootston/desktop.c') 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; -- cgit v1.2.3 From d05143950b7b81ae3454845a899225003ab41f25 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sun, 28 Jan 2018 12:11:05 +0000 Subject: rootston: move together XWayland setup code The XWayland code for creating the cursor as well as creating the surface itself are currently split up into two ifdef'ed sections in `desktop_create()`. Move together these two sections in order to avoid having multiple ifdefs as well as making it clearer that they do in fact serve the same purpose of setting up the XWayland environment. --- rootston/desktop.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'rootston/desktop.c') diff --git a/rootston/desktop.c b/rootston/desktop.c index 59d1e58b..44bdf365 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -490,6 +490,23 @@ struct roots_desktop *desktop_create(struct roots_server *server, desktop->server = server; desktop->config = config; + desktop->layout = wlr_output_layout_create(); + desktop->layout_change.notify = handle_layout_change; + wl_signal_add(&desktop->layout->events.change, &desktop->layout_change); + + desktop->compositor = wlr_compositor_create(server->wl_display, + server->renderer); + + desktop->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display); + wl_signal_add(&desktop->xdg_shell_v6->events.new_surface, + &desktop->xdg_shell_v6_surface); + desktop->xdg_shell_v6_surface.notify = handle_xdg_shell_v6_surface; + + desktop->wl_shell = wlr_wl_shell_create(server->wl_display); + wl_signal_add(&desktop->wl_shell->events.new_surface, + &desktop->wl_shell_surface); + desktop->wl_shell_surface.notify = handle_wl_shell_surface; + #ifdef WLR_HAS_XWAYLAND const char *cursor_theme = NULL; const char *cursor_default = ROOTS_XCURSOR_DEFAULT; @@ -510,26 +527,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; - wl_signal_add(&desktop->layout->events.change, &desktop->layout_change); - - desktop->compositor = wlr_compositor_create(server->wl_display, - server->renderer); - - desktop->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display); - wl_signal_add(&desktop->xdg_shell_v6->events.new_surface, - &desktop->xdg_shell_v6_surface); - desktop->xdg_shell_v6_surface.notify = handle_xdg_shell_v6_surface; - - desktop->wl_shell = wlr_wl_shell_create(server->wl_display); - wl_signal_add(&desktop->wl_shell->events.new_surface, - &desktop->wl_shell_surface); - desktop->wl_shell_surface.notify = handle_wl_shell_surface; - -#ifdef WLR_HAS_XWAYLAND if (config->xwayland) { desktop->xwayland = wlr_xwayland_create(server->wl_display, desktop->compositor); -- cgit v1.2.3