From decd87043fbe2dfef3b664455298b68604ee0485 Mon Sep 17 00:00:00 2001 From: Versus Void Date: Fri, 6 Oct 2017 09:41:50 +0300 Subject: Add config option to disable Xwayland --- rootston/config.c | 16 +++++++++++++++- rootston/desktop.c | 12 +++++++----- rootston/rootston.ini.example | 4 ++++ 3 files changed, 26 insertions(+), 6 deletions(-) (limited to 'rootston') diff --git a/rootston/config.c b/rootston/config.c index d454c2d9..4918c8dd 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -114,7 +115,19 @@ static const char *device_prefix = "device:"; static int config_ini_handler(void *user, const char *section, const char *name, const char *value) { struct roots_config *config = user; - if (strncmp(output_prefix, section, strlen(output_prefix)) == 0) { + if (strcmp(section, "core") == 0) { + if (strcmp(name, "xwayland") == 0) { + if (strcasecmp(value, "true") == 0) { + config->xwayland = true; + } else if (strcasecmp(value, "false") == 0) { + config->xwayland = false; + } else { + wlr_log(L_ERROR, "got unknown xwayland value: %s", value); + } + } else { + wlr_log(L_ERROR, "got unknown core config: %s", name); + } + } else if (strncmp(output_prefix, section, strlen(output_prefix)) == 0) { const char *output_name = section + strlen(output_prefix); struct output_config *oc; bool found = false; @@ -251,6 +264,7 @@ static int config_ini_handler(void *user, const char *section, const char *name, struct roots_config *parse_args(int argc, char *argv[]) { struct roots_config *config = calloc(1, sizeof(struct roots_config)); + config->xwayland = true; wl_list_init(&config->outputs); wl_list_init(&config->devices); wl_list_init(&config->bindings); diff --git a/rootston/desktop.c b/rootston/desktop.c index f99afaf5..5e85fb32 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -159,11 +159,13 @@ struct roots_desktop *desktop_create(struct roots_server *server, &desktop->wl_shell_surface); desktop->wl_shell_surface.notify = handle_wl_shell_surface; - desktop->xwayland = wlr_xwayland_create(server->wl_display, - desktop->compositor); - wl_signal_add(&desktop->xwayland->events.new_surface, - &desktop->xwayland_surface); - desktop->xwayland_surface.notify = handle_xwayland_surface; + if (config->xwayland) { + desktop->xwayland = wlr_xwayland_create(server->wl_display, + desktop->compositor); + wl_signal_add(&desktop->xwayland->events.new_surface, + &desktop->xwayland_surface); + desktop->xwayland_surface.notify = handle_xwayland_surface; + } desktop->gamma_control_manager = wlr_gamma_control_manager_create( server->wl_display); diff --git a/rootston/rootston.ini.example b/rootston/rootston.ini.example index 9960cae1..cc7d8baa 100644 --- a/rootston/rootston.ini.example +++ b/rootston/rootston.ini.example @@ -1,3 +1,7 @@ +[core] +# Disable X11 support. Enabled by default. +xwayland=false + # Single output configuration. String after semicolon must match output's name. [output:VGA-1] # Set logical (layout) coordinates for this screen -- cgit v1.2.3 From 9cab66f0f914a0194cdfa178377f6413c33ac515 Mon Sep 17 00:00:00 2001 From: Versus Void Date: Fri, 6 Oct 2017 21:50:25 +0000 Subject: Make xwayland compile-time optional --- include/rootston/desktop.h | 7 +++++-- include/rootston/server.h | 2 ++ include/rootston/view.h | 4 ++++ meson.build | 36 +++++++++++++++++++++++++----------- meson_options.txt | 1 + rootston/desktop.c | 2 ++ rootston/meson.build | 33 ++++++++++++++++++--------------- 7 files changed, 57 insertions(+), 28 deletions(-) (limited to 'rootston') diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index 0d641848..aa74ad3e 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -34,14 +34,17 @@ struct roots_desktop { struct wlr_compositor *compositor; struct wlr_wl_shell *wl_shell; struct wlr_xdg_shell_v6 *xdg_shell_v6; - struct wlr_xwayland *xwayland; struct wlr_gamma_control_manager *gamma_control_manager; struct wl_listener output_add; struct wl_listener output_remove; struct wl_listener xdg_shell_v6_surface; - struct wl_listener xwayland_surface; struct wl_listener wl_shell_surface; + +#ifdef HAS_XWAYLAND + struct wlr_xwayland *xwayland; + struct wl_listener xwayland_surface; +#endif }; struct roots_server; diff --git a/include/rootston/server.h b/include/rootston/server.h index 15e3a4ee..a4eacb7f 100644 --- a/include/rootston/server.h +++ b/include/rootston/server.h @@ -5,7 +5,9 @@ #include #include #include +#ifdef HAS_XWAYLAND #include +#endif #include "rootston/config.h" #include "rootston/desktop.h" #include "rootston/input.h" diff --git a/include/rootston/view.h b/include/rootston/view.h index 39ff80db..2a90670e 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -49,12 +49,16 @@ struct roots_view { union { struct wlr_wl_shell_surface *wl_shell_surface; struct wlr_xdg_surface_v6 *xdg_surface_v6; +#ifdef HAS_XWAYLAND struct wlr_xwayland_surface *xwayland_surface; +#endif }; union { struct roots_wl_shell_surface *roots_wl_shell_surface; struct roots_xdg_surface_v6 *roots_xdg_surface_v6; +#ifdef HAS_XWAYLAND struct roots_xwayland_surface *roots_xwayland_surface; +#endif }; struct wlr_surface *wlr_surface; // TODO: This would probably be better as a field that's updated on a diff --git a/meson.build b/meson.build index 57c26b0f..e3205aae 100644 --- a/meson.build +++ b/meson.build @@ -20,7 +20,6 @@ add_project_link_arguments( ) wlr_inc = include_directories('include') -install_subdir('include/wlr', install_dir: 'include') cc = meson.get_compiler('c') @@ -68,13 +67,36 @@ if elogind.found() and get_option('enable_elogind') add_project_arguments('-DHAS_ELOGIND', language: 'c') endif +exclude_files = [] +wlr_parts = [] +conf_data = configuration_data() +if get_option('enable_xwayland') + add_project_arguments('-DHAS_XWAYLAND', language: 'c') + subdir('xwayland') + wlr_parts += [lib_wlr_xwayland] + conf_data.set('WLR_HAS_XWAYLAND', true) +else + exclude_files += ['xwayland.h'] +endif +configure_file(output: 'config.h', install_dir: 'include/wlr', configuration: conf_data) +install_subdir('include/wlr', install_dir: 'include', exclude_files: exclude_files) + + subdir('protocol') subdir('backend') subdir('render') subdir('types') subdir('util') subdir('xcursor') -subdir('xwayland') + +wlr_parts += [ + lib_wl_protos, + lib_wlr_backend, + lib_wlr_render, + lib_wlr_types, + lib_wlr_util, + lib_wlr_xcursor, +] wlr_deps = [ wayland_server, @@ -100,15 +122,7 @@ wlr_deps = [ lib_wlr = library( 'wlroots', files('dummy.c'), - link_whole: [ - lib_wl_protos, - lib_wlr_backend, - lib_wlr_render, - lib_wlr_types, - lib_wlr_util, - lib_wlr_xcursor, - lib_wlr_xwayland, - ], + link_whole: wlr_parts, dependencies: wlr_deps, include_directories: wlr_inc, install: true, diff --git a/meson_options.txt b/meson_options.txt index a3f9ca45..b1e64bd9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,4 @@ option('enable_libcap', type: 'boolean', value: true, description: 'Enable support for capabilities') option('enable_systemd', type: 'boolean', value: true, description: 'Enable support for logind') option('enable_elogind', type: 'boolean', value: true, description: 'Enable support for logind') +option('enable_xwayland', type: 'boolean', value: true, description: 'Enable support X11 applications') diff --git a/rootston/desktop.c b/rootston/desktop.c index 5e85fb32..f0f8320d 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -159,6 +159,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, &desktop->wl_shell_surface); desktop->wl_shell_surface.notify = handle_wl_shell_surface; +#ifdef HAS_XWAYLAND if (config->xwayland) { desktop->xwayland = wlr_xwayland_create(server->wl_display, desktop->compositor); @@ -166,6 +167,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, &desktop->xwayland_surface); desktop->xwayland_surface.notify = handle_xwayland_surface; } +#endif desktop->gamma_control_manager = wlr_gamma_control_manager_create( server->wl_display); diff --git a/rootston/meson.build b/rootston/meson.build index 1eb0704d..7ff79f8e 100644 --- a/rootston/meson.build +++ b/rootston/meson.build @@ -1,17 +1,20 @@ +sources = [ + 'config.c', + 'cursor.c', + 'desktop.c', + 'ini.c', + 'input.c', + 'keyboard.c', + 'main.c', + 'output.c', + 'pointer.c', + 'tablet_tool.c', + 'xdg_shell_v6.c', + 'wl_shell.c', +] +if get_option('enable_xwayland') + sources += ['xwayland.c'] +endif executable( - 'rootston', [ - 'config.c', - 'cursor.c', - 'desktop.c', - 'ini.c', - 'input.c', - 'keyboard.c', - 'main.c', - 'output.c', - 'pointer.c', - 'tablet_tool.c', - 'xdg_shell_v6.c', - 'xwayland.c', - 'wl_shell.c', - ], dependencies: wlroots + 'rootston', sources, dependencies: wlroots ) -- cgit v1.2.3