Merge pull request #590 from pks-t/pks/rootston-wo-xwayland

Fix building rootston without XWayland
This commit is contained in:
Drew DeVault 2018-01-28 15:05:31 -05:00 committed by GitHub
commit f0b3a71fbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 21 deletions

View file

@ -6,6 +6,12 @@ compiler:
- gcc - gcc
- clang - clang
# Settings to try
env:
matrix:
- OPTIONS="-Denable_libcap=true -Denable_systemd=true -Denable_elogind=false -Denable_xwayland=true"
- OPTIONS="-Denable_libcap=false -Denable_systemd=false -Denable_elogind=false -Denable_xwayland=false"
arch: arch:
packages: packages:
- meson - meson
@ -19,7 +25,7 @@ arch:
- xcb-util-image - xcb-util-image
- libcap - libcap
script: script:
- "meson build" - "meson build $OPTIONS"
- "ninja -C build" - "ninja -C build"
script: script:

View file

@ -33,11 +33,11 @@ else
backend_files += files('session/direct.c') backend_files += files('session/direct.c')
endif endif
if systemd.found() if systemd.found() and get_option('enable_systemd')
backend_files += files('session/logind.c') backend_files += files('session/logind.c')
endif endif
if elogind.found() if elogind.found() and get_option('enable_elogind')
backend_files += files('session/logind.c') backend_files += files('session/logind.c')
endif endif

View file

@ -51,7 +51,9 @@ struct roots_xwayland_surface {
enum roots_view_type { enum roots_view_type {
ROOTS_WL_SHELL_VIEW, ROOTS_WL_SHELL_VIEW,
ROOTS_XDG_SHELL_V6_VIEW, ROOTS_XDG_SHELL_V6_VIEW,
#ifdef WLR_HAS_XWAYLAND
ROOTS_XWAYLAND_VIEW, ROOTS_XWAYLAND_VIEW,
#endif
}; };
struct roots_view { struct roots_view {

View file

@ -490,6 +490,24 @@ struct roots_desktop *desktop_create(struct roots_server *server,
desktop->server = server; desktop->server = server;
desktop->config = config; 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_theme = NULL;
const char *cursor_default = ROOTS_XCURSOR_DEFAULT; const char *cursor_default = ROOTS_XCURSOR_DEFAULT;
struct roots_cursor_config *cc = struct roots_cursor_config *cc =
@ -510,24 +528,6 @@ struct roots_desktop *desktop_create(struct roots_server *server,
return NULL; return NULL;
} }
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) { if (config->xwayland) {
desktop->xwayland = wlr_xwayland_create(server->wl_display, desktop->xwayland = wlr_xwayland_create(server->wl_display,
desktop->compositor); desktop->compositor);

View file

@ -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, static void render_xwayland_children(struct wlr_xwayland_surface *surface,
struct roots_desktop *desktop, struct wlr_output *wlr_output, struct roots_desktop *desktop, struct wlr_output *wlr_output,
struct timespec *when) { 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); render_xwayland_children(child, desktop, wlr_output, when);
} }
} }
#endif
static void render_decorations(struct roots_view *view, static void render_decorations(struct roots_view *view,
struct roots_desktop *desktop, struct wlr_output *output) { 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, render_wl_shell_surface(view->wl_shell_surface, desktop, wlr_output,
when, view->x, view->y, view->rotation, false); when, view->x, view->y, view->rotation, false);
break; break;
#ifdef WLR_HAS_XWAYLAND
case ROOTS_XWAYLAND_VIEW: case ROOTS_XWAYLAND_VIEW:
render_surface(view->wlr_surface, desktop, wlr_output, when, render_surface(view->wlr_surface, desktop, wlr_output, when,
view->x, view->y, view->rotation); view->x, view->y, view->rotation);
break; break;
#endif
} }
} }
@ -215,8 +219,10 @@ static bool has_standalone_surface(struct roots_view *view) {
return wl_list_empty(&view->xdg_surface_v6->popups); return wl_list_empty(&view->xdg_surface_v6->popups);
case ROOTS_WL_SHELL_VIEW: case ROOTS_WL_SHELL_VIEW:
return wl_list_empty(&view->wl_shell_surface->popups); return wl_list_empty(&view->wl_shell_surface->popups);
#ifdef WLR_HAS_XWAYLAND
case ROOTS_XWAYLAND_VIEW: case ROOTS_XWAYLAND_VIEW:
return wl_list_empty(&view->xwayland_surface->children); return wl_list_empty(&view->xwayland_surface->children);
#endif
} }
return true; 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 // During normal rendering the xwayland window tree isn't traversed
// because all windows are rendered. Here we only want to render // because all windows are rendered. Here we only want to render
// the fullscreen window's children so we have to traverse the tree. // the fullscreen window's children so we have to traverse the tree.
#ifdef WLR_HAS_XWAYLAND
if (view->type == ROOTS_XWAYLAND_VIEW) { if (view->type == ROOTS_XWAYLAND_VIEW) {
render_xwayland_children(view->xwayland_surface, desktop, render_xwayland_children(view->xwayland_surface, desktop,
wlr_output, &now); wlr_output, &now);
} }
#endif
} }
wlr_renderer_end(server->renderer); wlr_renderer_end(server->renderer);
wlr_output_swap_buffers(wlr_output); wlr_output_swap_buffers(wlr_output);

View file

@ -651,10 +651,12 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
return; return;
} }
#ifdef WLR_HAS_XWAYLAND
if (view && view->type == ROOTS_XWAYLAND_VIEW && if (view && view->type == ROOTS_XWAYLAND_VIEW &&
view->xwayland_surface->override_redirect) { view->xwayland_surface->override_redirect) {
return; return;
} }
#endif
struct roots_seat_view *seat_view = NULL; struct roots_seat_view *seat_view = NULL;
if (view != NULL) { if (view != NULL) {
seat_view = roots_seat_view_from_view(seat, view); seat_view = roots_seat_view_from_view(seat, view);