Merge pull request #220 from versusvoid/optional-xwayland
Make Xwayland optional
This commit is contained in:
		
						commit
						d0d6413772
					
				|  | @ -27,6 +27,7 @@ struct binding_config { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct roots_config { | struct roots_config { | ||||||
|  | 	bool xwayland; | ||||||
| 	// TODO: Multiple cursors, multiseat
 | 	// TODO: Multiple cursors, multiseat
 | ||||||
| 	struct { | 	struct { | ||||||
| 		char *mapped_output; | 		char *mapped_output; | ||||||
|  |  | ||||||
|  | @ -35,15 +35,18 @@ struct roots_desktop { | ||||||
| 	struct wlr_compositor *compositor; | 	struct wlr_compositor *compositor; | ||||||
| 	struct wlr_wl_shell *wl_shell; | 	struct wlr_wl_shell *wl_shell; | ||||||
| 	struct wlr_xdg_shell_v6 *xdg_shell_v6; | 	struct wlr_xdg_shell_v6 *xdg_shell_v6; | ||||||
| 	struct wlr_xwayland *xwayland; |  | ||||||
| 	struct wlr_gamma_control_manager *gamma_control_manager; | 	struct wlr_gamma_control_manager *gamma_control_manager; | ||||||
| 	struct wlr_screenshooter *screenshooter; | 	struct wlr_screenshooter *screenshooter; | ||||||
| 
 | 
 | ||||||
| 	struct wl_listener output_add; | 	struct wl_listener output_add; | ||||||
| 	struct wl_listener output_remove; | 	struct wl_listener output_remove; | ||||||
| 	struct wl_listener xdg_shell_v6_surface; | 	struct wl_listener xdg_shell_v6_surface; | ||||||
| 	struct wl_listener xwayland_surface; |  | ||||||
| 	struct wl_listener wl_shell_surface; | 	struct wl_listener wl_shell_surface; | ||||||
|  | 
 | ||||||
|  | #ifdef HAS_XWAYLAND | ||||||
|  | 	struct wlr_xwayland *xwayland; | ||||||
|  | 	struct wl_listener xwayland_surface; | ||||||
|  | #endif | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct roots_server; | struct roots_server; | ||||||
|  |  | ||||||
|  | @ -5,7 +5,9 @@ | ||||||
| #include <wlr/backend/session.h> | #include <wlr/backend/session.h> | ||||||
| #include <wlr/types/wlr_data_device_manager.h> | #include <wlr/types/wlr_data_device_manager.h> | ||||||
| #include <wlr/render.h> | #include <wlr/render.h> | ||||||
|  | #ifdef HAS_XWAYLAND | ||||||
| #include <wlr/xwayland.h> | #include <wlr/xwayland.h> | ||||||
|  | #endif | ||||||
| #include "rootston/config.h" | #include "rootston/config.h" | ||||||
| #include "rootston/desktop.h" | #include "rootston/desktop.h" | ||||||
| #include "rootston/input.h" | #include "rootston/input.h" | ||||||
|  |  | ||||||
|  | @ -58,12 +58,16 @@ struct roots_view { | ||||||
| 	union { | 	union { | ||||||
| 		struct wlr_wl_shell_surface *wl_shell_surface; | 		struct wlr_wl_shell_surface *wl_shell_surface; | ||||||
| 		struct wlr_xdg_surface_v6 *xdg_surface_v6; | 		struct wlr_xdg_surface_v6 *xdg_surface_v6; | ||||||
|  | #ifdef HAS_XWAYLAND | ||||||
| 		struct wlr_xwayland_surface *xwayland_surface; | 		struct wlr_xwayland_surface *xwayland_surface; | ||||||
|  | #endif | ||||||
| 	}; | 	}; | ||||||
| 	union { | 	union { | ||||||
| 		struct roots_wl_shell_surface *roots_wl_shell_surface; | 		struct roots_wl_shell_surface *roots_wl_shell_surface; | ||||||
| 		struct roots_xdg_surface_v6 *roots_xdg_surface_v6; | 		struct roots_xdg_surface_v6 *roots_xdg_surface_v6; | ||||||
|  | #ifdef HAS_XWAYLAND | ||||||
| 		struct roots_xwayland_surface *roots_xwayland_surface; | 		struct roots_xwayland_surface *roots_xwayland_surface; | ||||||
|  | #endif | ||||||
| 	}; | 	}; | ||||||
| 	struct wlr_surface *wlr_surface; | 	struct wlr_surface *wlr_surface; | ||||||
| 	// TODO: This would probably be better as a field that's updated on a
 | 	// TODO: This would probably be better as a field that's updated on a
 | ||||||
|  |  | ||||||
							
								
								
									
										36
									
								
								meson.build
								
								
								
								
							
							
						
						
									
										36
									
								
								meson.build
								
								
								
								
							|  | @ -24,7 +24,6 @@ add_project_link_arguments( | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| wlr_inc = include_directories('include') | wlr_inc = include_directories('include') | ||||||
| install_subdir('include/wlr', install_dir: 'include') |  | ||||||
| 
 | 
 | ||||||
| cc = meson.get_compiler('c') | cc = meson.get_compiler('c') | ||||||
| 
 | 
 | ||||||
|  | @ -72,13 +71,36 @@ if elogind.found() and get_option('enable_elogind') | ||||||
| 	add_project_arguments('-DHAS_ELOGIND', language: 'c') | 	add_project_arguments('-DHAS_ELOGIND', language: 'c') | ||||||
| endif | 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('protocol') | ||||||
| subdir('render') | subdir('render') | ||||||
| subdir('backend') | subdir('backend') | ||||||
| subdir('types') | subdir('types') | ||||||
| subdir('util') | subdir('util') | ||||||
| subdir('xcursor') | 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 = [ | wlr_deps = [ | ||||||
| 	wayland_server, | 	wayland_server, | ||||||
|  | @ -104,15 +126,7 @@ wlr_deps = [ | ||||||
| lib_wlr = library( | lib_wlr = library( | ||||||
| 	'wlroots', | 	'wlroots', | ||||||
| 	files('dummy.c'), | 	files('dummy.c'), | ||||||
| 	link_whole: [ | 	link_whole: wlr_parts, | ||||||
| 		lib_wl_protos, |  | ||||||
| 		lib_wlr_backend, |  | ||||||
| 		lib_wlr_render, |  | ||||||
| 		lib_wlr_types, |  | ||||||
| 		lib_wlr_util, |  | ||||||
| 		lib_wlr_xcursor, |  | ||||||
| 		lib_wlr_xwayland, |  | ||||||
| 	], |  | ||||||
| 	dependencies: wlr_deps, | 	dependencies: wlr_deps, | ||||||
| 	include_directories: wlr_inc, | 	include_directories: wlr_inc, | ||||||
| 	install: true, | 	install: true, | ||||||
|  |  | ||||||
|  | @ -1,3 +1,4 @@ | ||||||
| option('enable_libcap', type: 'boolean', value: true, description: 'Enable support for capabilities') | 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_systemd', type: 'boolean', value: true, description: 'Enable support for logind') | ||||||
| option('enable_elogind', 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') | ||||||
|  |  | ||||||
|  | @ -5,6 +5,7 @@ | ||||||
| #include <limits.h> | #include <limits.h> | ||||||
| #include <getopt.h> | #include <getopt.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
|  | #include <strings.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <sys/param.h> | #include <sys/param.h> | ||||||
| #include <wlr/util/log.h> | #include <wlr/util/log.h> | ||||||
|  | @ -114,7 +115,19 @@ static const char *device_prefix = "device:"; | ||||||
| static int config_ini_handler(void *user, const char *section, const char *name, | static int config_ini_handler(void *user, const char *section, const char *name, | ||||||
| 		const char *value) { | 		const char *value) { | ||||||
| 	struct roots_config *config = user; | 	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); | 		const char *output_name = section + strlen(output_prefix); | ||||||
| 		struct output_config *oc; | 		struct output_config *oc; | ||||||
| 		bool found = false; | 		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 *parse_args(int argc, char *argv[]) { | ||||||
| 	struct roots_config *config = calloc(1, sizeof(struct roots_config)); | 	struct roots_config *config = calloc(1, sizeof(struct roots_config)); | ||||||
|  | 	config->xwayland = true; | ||||||
| 	wl_list_init(&config->outputs); | 	wl_list_init(&config->outputs); | ||||||
| 	wl_list_init(&config->devices); | 	wl_list_init(&config->devices); | ||||||
| 	wl_list_init(&config->bindings); | 	wl_list_init(&config->bindings); | ||||||
|  |  | ||||||
|  | @ -262,11 +262,15 @@ struct roots_desktop *desktop_create(struct roots_server *server, | ||||||
| 		&desktop->wl_shell_surface); | 		&desktop->wl_shell_surface); | ||||||
| 	desktop->wl_shell_surface.notify = handle_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->xwayland = wlr_xwayland_create(server->wl_display, | ||||||
| 			desktop->compositor); | 			desktop->compositor); | ||||||
| 		wl_signal_add(&desktop->xwayland->events.new_surface, | 		wl_signal_add(&desktop->xwayland->events.new_surface, | ||||||
| 			&desktop->xwayland_surface); | 			&desktop->xwayland_surface); | ||||||
| 		desktop->xwayland_surface.notify = handle_xwayland_surface; | 		desktop->xwayland_surface.notify = handle_xwayland_surface; | ||||||
|  | 	} | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| 	desktop->gamma_control_manager = wlr_gamma_control_manager_create( | 	desktop->gamma_control_manager = wlr_gamma_control_manager_create( | ||||||
| 		server->wl_display); | 		server->wl_display); | ||||||
|  |  | ||||||
|  | @ -1,5 +1,4 @@ | ||||||
| executable( | sources = [ | ||||||
| 	'rootston', [ |  | ||||||
| 	'config.c', | 	'config.c', | ||||||
| 	'cursor.c', | 	'cursor.c', | ||||||
| 	'desktop.c', | 	'desktop.c', | ||||||
|  | @ -11,7 +10,11 @@ executable( | ||||||
| 	'pointer.c', | 	'pointer.c', | ||||||
| 	'tablet_tool.c', | 	'tablet_tool.c', | ||||||
| 	'xdg_shell_v6.c', | 	'xdg_shell_v6.c', | ||||||
| 		'xwayland.c', |  | ||||||
| 	'wl_shell.c', | 	'wl_shell.c', | ||||||
| 	], dependencies: wlroots | ] | ||||||
|  | if get_option('enable_xwayland') | ||||||
|  | 	sources += ['xwayland.c'] | ||||||
|  | endif | ||||||
|  | executable( | ||||||
|  | 	'rootston', sources, dependencies: wlroots | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | @ -1,3 +1,7 @@ | ||||||
|  | [core] | ||||||
|  | # Disable X11 support. Enabled by default. | ||||||
|  | xwayland=false | ||||||
|  | 
 | ||||||
| # Single output configuration. String after semicolon must match output's name. | # Single output configuration. String after semicolon must match output's name. | ||||||
| [output:VGA-1] | [output:VGA-1] | ||||||
| # Set logical (layout) coordinates for this screen | # Set logical (layout) coordinates for this screen | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue