[PATCH weston v2 03/17] compositor: remove the weston_config field from weston_compositor

Giulio Camuffo giuliocamuffo at gmail.com
Thu Dec 4 13:01:09 PST 2014


Instead of the central weston_config pointer we now store it in some
module-specific pointers. This way we can remove them one by one.
---
 desktop-shell/shell.c               |  8 +++++---
 desktop-shell/shell.h               |  1 +
 fullscreen-shell/fullscreen-shell.c |  3 ++-
 ivi-shell/hmi-controller.c          | 18 ++++++++++--------
 ivi-shell/ivi-shell.c               |  8 ++++----
 src/cms-colord.c                    |  3 ++-
 src/cms-static.c                    |  7 +++++--
 src/compositor-drm.c                | 10 ++++++++++
 src/compositor-fbdev.c              | 14 ++++++++++++++
 src/compositor-rpi.c                | 15 +++++++++++++++
 src/compositor.c                    | 21 ++++++++++-----------
 src/compositor.h                    |  7 ++++---
 src/libinput-device.c               | 29 +----------------------------
 src/libinput-device.h               |  2 ++
 src/libinput-seat.c                 | 29 +++++++++++++++++++++++++++--
 src/libinput-seat.h                 |  8 ++++++++
 src/text-backend.c                  | 10 ++++++----
 tests/surface-global-test.c         |  3 ++-
 tests/surface-test.c                |  3 ++-
 tests/weston-test.c                 |  3 ++-
 xwayland/launcher.c                 |  6 ++++--
 xwayland/xwayland.h                 |  1 +
 22 files changed, 137 insertions(+), 72 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 9e8d45a..fcfa904 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -577,14 +577,14 @@ shell_configuration(struct desktop_shell *shell)
 	char *s, *client;
 	int ret;
 
-	section = weston_config_get_section(shell->compositor->config,
+	section = weston_config_get_section(shell->config,
 					    "screensaver", NULL, NULL);
 	weston_config_section_get_string(section,
 					 "path", &shell->screensaver.path, NULL);
 	weston_config_section_get_int(section, "duration", &duration, 60);
 	shell->screensaver.duration = duration * 1000;
 
-	section = weston_config_get_section(shell->compositor->config,
+	section = weston_config_get_section(shell->config,
 					    "shell", NULL, NULL);
 	ret = asprintf(&client, "%s/%s", weston_config_get_libexec_dir(),
 		       WESTON_SHELL_CLIENT);
@@ -6488,7 +6488,8 @@ handle_seat_created(struct wl_listener *listener, void *data)
 
 WL_EXPORT int
 module_init(struct weston_compositor *ec,
-	    int *argc, char *argv[])
+	    int *argc, char *argv[],
+	    struct weston_config *config)
 {
 	struct weston_seat *seat;
 	struct desktop_shell *shell;
@@ -6501,6 +6502,7 @@ module_init(struct weston_compositor *ec,
 		return -1;
 
 	shell->compositor = ec;
+	shell->config = config;
 
 	shell->destroy_listener.notify = shell_destroy;
 	wl_signal_add(&ec->destroy_signal, &shell->destroy_listener);
diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
index 2cfd1d6..101a960 100644
--- a/desktop-shell/shell.h
+++ b/desktop-shell/shell.h
@@ -117,6 +117,7 @@ struct shell_output {
 
 struct desktop_shell {
 	struct weston_compositor *compositor;
+	struct weston_config *config;
 
 	struct wl_listener idle_listener;
 	struct wl_listener wake_listener;
diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index 35e6d8f..679cfd1 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -787,7 +787,8 @@ bind_fullscreen_shell(struct wl_client *client, void *data, uint32_t version,
 
 WL_EXPORT int
 module_init(struct weston_compositor *compositor,
-	    int *argc, char *argv[])
+	    int *argc, char *argv[],
+	    struct weston_config *config)
 {
 	struct fullscreen_shell *shell;
 	struct weston_seat *seat;
diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index 3a07a70..dd5c1e4 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -116,6 +116,7 @@ struct hmi_controller {
 	int32_t                             is_initialized;
 
 	struct weston_compositor           *compositor;
+	struct weston_config               *config;
 	struct wl_listener                  destroy_listener;
 
 	struct wl_client                   *user_interface;
@@ -549,10 +550,9 @@ set_notification_configure_surface(struct ivi_layout_surface *ivisurf,
  * of ivi_layers are initialized in hmi_controller_create
  */
 static struct hmi_server_setting *
-hmi_server_setting_create(struct weston_compositor *ec)
+hmi_server_setting_create(struct weston_config *config)
 {
 	struct hmi_server_setting *setting = MEM_ALLOC(sizeof(*setting));
-	struct weston_config *config = ec->config;
 	struct weston_config_section *shell_section = NULL;
 
 	shell_section = weston_config_get_section(config, "ivi-shell",
@@ -619,7 +619,8 @@ hmi_controller_destroy(struct wl_listener *listener, void *data)
  * ivi_hmi_controller_home is requested.
  */
 static struct hmi_controller *
-hmi_controller_create(struct weston_compositor *ec)
+hmi_controller_create(struct weston_compositor *ec,
+                      struct weston_config *config)
 {
 	struct ivi_layout_screen **pp_screen = NULL;
 	struct ivi_layout_screen *iviscrn  = NULL;
@@ -632,7 +633,7 @@ hmi_controller_create(struct weston_compositor *ec)
 
 	wl_array_init(&hmi_ctrl->ui_widgets);
 	hmi_ctrl->layout_mode = IVI_HMI_CONTROLLER_LAYOUT_MODE_TILING;
-	hmi_ctrl->hmi_setting = hmi_server_setting_create(ec);
+	hmi_ctrl->hmi_setting = hmi_server_setting_create(config);
 	hmi_ctrl->compositor = ec;
 
 	ivi_layout_get_screens(&screen_length, &pp_screen);
@@ -975,7 +976,7 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
 	if (0 == y_count)
 		y_count  = 1;
 
-	config = hmi_ctrl->compositor->config;
+	config = hmi_ctrl->config;
 	if (!config)
 		return;
 
@@ -1639,7 +1640,7 @@ initialize(struct hmi_controller *hmi_ctrl)
 		uint32_t *dest;
 	};
 
-	struct weston_config *config = hmi_ctrl->compositor->config;
+	struct weston_config *config = hmi_ctrl->config;
 	struct weston_config_section *section = NULL;
 	int result = 0;
 	int i = 0;
@@ -1696,9 +1697,10 @@ launch_hmi_client_process(void *data)
 
 WL_EXPORT int
 module_init(struct weston_compositor *ec,
-	    int *argc, char *argv[])
+	    int *argc, char *argv[],
+	    struct weston_config *config)
 {
-	struct hmi_controller *hmi_ctrl = hmi_controller_create(ec);
+	struct hmi_controller *hmi_ctrl = hmi_controller_create(ec, config);
 	struct wl_event_loop *loop = NULL;
 
 	if (!initialize(hmi_ctrl)) {
diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index a14010e..d763e8f 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -371,10 +371,9 @@ init_ivi_shell(struct weston_compositor *compositor, struct ivi_shell *shell)
 
 static int
 ivi_shell_setting_create(struct ivi_shell_setting *dest,
-			 struct weston_compositor *compositor)
+			 struct weston_config *config)
 {
 	int result = 0;
-	struct weston_config *config = compositor->config;
 	struct weston_config_section *section;
 
 	if (NULL == dest)
@@ -425,7 +424,8 @@ ivi_load_modules(struct weston_compositor *compositor, const char *modules,
 
 WL_EXPORT int
 module_init(struct weston_compositor *compositor,
-	    int *argc, char *argv[])
+           int *argc, char *argv[],
+           struct weston_config *config)
 {
 	struct ivi_shell *shell;
 	char ivi_layout_path[PATH_MAX];
@@ -449,7 +449,7 @@ module_init(struct weston_compositor *compositor,
 			     shell, bind_ivi_application) == NULL)
 		return -1;
 
-	if (ivi_shell_setting_create(&setting, compositor) != 0)
+	if (ivi_shell_setting_create(&setting, config) != 0)
 		return -1;
 
 	/*
diff --git a/src/cms-colord.c b/src/cms-colord.c
index c541a34..6510c15 100644
--- a/src/cms-colord.c
+++ b/src/cms-colord.c
@@ -483,7 +483,8 @@ colord_cms_output_destroy(gpointer data)
 
 WL_EXPORT int
 module_init(struct weston_compositor *ec,
-	    int *argc, char *argv[])
+	    int *argc, char *argv[],
+	    struct weston_config *config)
 {
 	gboolean ret;
 	GError *error = NULL;
diff --git a/src/cms-static.c b/src/cms-static.c
index ad54fd1..cc66a2e 100644
--- a/src/cms-static.c
+++ b/src/cms-static.c
@@ -32,6 +32,7 @@ struct cms_static {
 	struct weston_compositor	*ec;
 	struct wl_listener		 destroy_listener;
 	struct wl_listener		 output_created_listener;
+	struct weston_config		*config;
 };
 
 static void
@@ -45,7 +46,7 @@ cms_output_created(struct cms_static *cms, struct weston_output *o)
 
 	if (o->name == NULL)
 		return;
-	s = weston_config_get_section(cms->ec->config,
+	s = weston_config_get_section(cms->config,
 				      "output", "name", o->name);
 	if (s == NULL)
 		return;
@@ -86,7 +87,8 @@ cms_notifier_destroy(struct wl_listener *listener, void *data)
 
 WL_EXPORT int
 module_init(struct weston_compositor *ec,
-	    int *argc, char *argv[])
+	    int *argc, char *argv[],
+	    struct weston_config *config)
 {
 	struct cms_static *cms;
 	struct weston_output *output;
@@ -99,6 +101,7 @@ module_init(struct weston_compositor *ec,
 		return -1;
 
 	cms->ec = ec;
+	cms->config = config;
 	cms->destroy_listener.notify = cms_notifier_destroy;
 	wl_signal_add(&ec->destroy_signal, &cms->destroy_listener);
 
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index ebba242..e72fc05 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -235,6 +235,8 @@ struct drm_parameters {
 	uint32_t format;
 	void (*get_output_parameters)(const char *name,
 				      struct drm_output_parameters *parameters);
+	void (*configure_device)(struct weston_compositor *compositor,
+				 struct libinput_device *device);
 };
 
 static struct gl_renderer_interface *gl_renderer;
@@ -2731,6 +2733,7 @@ drm_backend_create(struct weston_compositor *compositor,
 	wl_list_init(&b->sprite_list);
 	create_sprites(b);
 
+	b->input.configure_device = param->configure_device;
 	if (udev_input_init(&b->input,
 			    compositor, b->udev, param->seat_id) < 0) {
 		weston_log("failed to create input devices\n");
@@ -2920,6 +2923,12 @@ output_parameters(const char *name, struct drm_output_parameters *params)
 	weston_config_section_get_string(section, "seat", &params->seat, "");
 }
 
+static void
+configure_device(struct weston_compositor *c, struct libinput_device *device)
+{
+	libinput_device_configure(device, wconfig);
+}
+
 WL_EXPORT int
 backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
 	     struct weston_config *config)
@@ -2942,6 +2951,7 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
 
 	param.seat_id = default_seat;
 	param.get_output_parameters = output_parameters;
+	param.configure_device = configure_device;
 
 	parse_options(drm_options, ARRAY_LENGTH(drm_options), argc, argv);
 
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index b047d38..a097170 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -94,6 +94,8 @@ struct fbdev_parameters {
 	int tty;
 	char *device;
 	int use_gl;
+	void (*configure_device)(struct weston_compositor *compositor,
+				 struct libinput_device *device);
 };
 
 struct gl_renderer_interface *gl_renderer;
@@ -930,6 +932,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
 	if (fbdev_output_create(backend, param->device) < 0)
 		goto out_pixman;
 
+	backend->input.configure_device = param->configure_device;
 	udev_input_init(&backend->input, compositor, backend->udev, seat_id);
 
 	compositor->backend = &backend->base;
@@ -952,6 +955,14 @@ out_compositor:
 	return NULL;
 }
 
+static struct weston_config *wconfig;
+
+static void
+configure_device(struct weston_compositor *c, struct libinput_device *device)
+{
+	libinput_device_configure(device, wconfig);
+}
+
 WL_EXPORT int
 backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
 	     struct weston_config *config)
@@ -965,6 +976,8 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
 		.use_gl = 0,
 	};
 
+	wconfig = config;
+
 	const struct weston_option fbdev_options[] = {
 		{ WESTON_OPTION_INTEGER, "tty", 0, &param.tty },
 		{ WESTON_OPTION_STRING, "device", 0, &param.device },
@@ -972,6 +985,7 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
 	};
 
 	parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
+	param.configure_device = configure_device;
 
 	b = fbdev_backend_create(compositor, &param);
 	if (b == NULL)
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index 2c2db10..4e0ec06 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -449,6 +449,8 @@ struct rpi_parameters {
 	int tty;
 	struct rpi_renderer_parameters renderer;
 	uint32_t output_transform;
+	void (*configure_device)(struct weston_compositor *compositor,
+				 struct libinput_device *device);
 };
 
 static struct rpi_backend *
@@ -513,6 +515,7 @@ rpi_backend_create(struct weston_compositor *compositor,
 	if (rpi_output_create(backend, param->output_transform) < 0)
 		goto out_renderer;
 
+	backend->input.configure_device = param->configure_device;
 	if (udev_input_init(&backend->input,
 			    compositor,
 			    backend->udev, "seat0") != 0) {
@@ -540,6 +543,14 @@ out_compositor:
 	return NULL;
 }
 
+static struct weston_config *wconfig;
+
+static void
+configure_device(struct weston_compositor *c, struct libinput_device *device)
+{
+	libinput_device_configure(device, wconfig);
+}
+
 WL_EXPORT int
 backend_init(struct weston_compositor *compositor,
 	     int *argc, char *argv[],
@@ -548,6 +559,8 @@ backend_init(struct weston_compositor *compositor,
 	const char *transform = "normal";
 	struct rpi_backend *b;
 
+	wconfig = config;
+
 	struct rpi_parameters param = {
 		.tty = 0, /* default to current tty */
 		.renderer.single_buffer = 0,
@@ -566,6 +579,8 @@ backend_init(struct weston_compositor *compositor,
 
 	parse_options(rpi_options, ARRAY_LENGTH(rpi_options), argc, argv);
 
+	param.configure_device = configure_device;
+
 	if (weston_parse_transform(transform, &param.output_transform) < 0)
 		weston_log("invalid transform \"%s\"\n", transform);
 
diff --git a/src/compositor.c b/src/compositor.c
index db07f70..8811336 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -4016,7 +4016,6 @@ weston_compositor_init(struct weston_compositor *ec,
 	struct xkb_rule_names xkb_names;
 	struct weston_config_section *s;
 
-	ec->config = config;
 	wl_signal_init(&ec->destroy_signal);
 	wl_signal_init(&ec->create_surface_signal);
 	wl_signal_init(&ec->activate_signal);
@@ -4067,7 +4066,7 @@ weston_compositor_init(struct weston_compositor *ec,
 	weston_plane_init(&ec->primary_plane, ec, 0, 0);
 	weston_compositor_stack_plane(ec, &ec->primary_plane, NULL);
 
-	s = weston_config_get_section(ec->config, "keyboard", NULL, NULL);
+	s = weston_config_get_section(config, "keyboard", NULL, NULL);
 	weston_config_section_get_string(s, "keymap_rules",
 					 (char **) &xkb_names.rules, NULL);
 	weston_config_section_get_string(s, "keymap_model",
@@ -4087,7 +4086,7 @@ weston_compositor_init(struct weston_compositor *ec,
 	weston_config_section_get_int(s, "repeat-delay",
 				      &ec->kb_repeat_delay, 400);
 
-	text_backend_init(ec);
+	text_backend_init(ec, config);
 
 	wl_data_device_manager_init(ec->wl_display);
 
@@ -4132,8 +4131,6 @@ weston_compositor_shutdown(struct weston_compositor *ec)
 	weston_plane_release(&ec->primary_plane);
 
 	wl_event_loop_destroy(ec->input_loop);
-
-	weston_config_destroy(ec->config);
 }
 
 WL_EXPORT void
@@ -4405,12 +4402,13 @@ weston_load_module(const char *name, const char *entrypoint)
 
 static int
 load_modules(struct weston_compositor *ec, const char *modules,
-	     int *argc, char *argv[])
+	     int *argc, char *argv[], struct weston_config *config)
 {
 	const char *p, *end;
 	char buffer[256];
 	int (*module_init)(struct weston_compositor *ec,
-			   int *argc, char *argv[]);
+			   int *argc, char *argv[],
+			   struct weston_config *config);
 
 	if (modules == NULL)
 		return 0;
@@ -4421,7 +4419,7 @@ load_modules(struct weston_compositor *ec, const char *modules,
 		snprintf(buffer, sizeof buffer, "%.*s", (int) (end - p), p);
 		module_init = weston_load_module(buffer, "module_init");
 		if (module_init)
-			module_init(ec, argc, argv);
+			module_init(ec, argc, argv, config);
 		p = end;
 		while (*p == ',')
 			p++;
@@ -4864,14 +4862,14 @@ int main(int argc, char *argv[])
 		weston_config_section_get_string(section, "shell", &shell,
 						 "desktop-shell.so");
 
-	if (load_modules(ec, shell, &argc, argv) < 0)
+	if (load_modules(ec, shell, &argc, argv, config) < 0)
 		goto out;
 
 	weston_config_section_get_string(section, "modules", &modules, "");
-	if (load_modules(ec, modules, &argc, argv) < 0)
+	if (load_modules(ec, modules, &argc, argv, config) < 0)
 		goto out;
 
-	if (load_modules(ec, option_modules, &argc, argv) < 0)
+	if (load_modules(ec, option_modules, &argc, argv, config) < 0)
 		goto out;
 
 	section = weston_config_get_section(config, "keyboard", NULL, NULL);
@@ -4916,6 +4914,7 @@ out_signals:
 	wl_display_destroy(display);
 
 	weston_log_file_close();
+	weston_config_destroy(config);
 
 	free(backend);
 	free(shell);
diff --git a/src/compositor.h b/src/compositor.h
index 774605e..b5fdba4 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -593,7 +593,6 @@ struct weston_compositor {
 
 	struct wl_display *wl_display;
 	struct weston_shell_interface shell_interface;
-	struct weston_config *config;
 
 	/* surface signals */
 	struct wl_signal create_surface_signal;
@@ -1372,7 +1371,8 @@ struct clipboard *
 clipboard_create(struct weston_seat *seat);
 
 int
-text_backend_init(struct weston_compositor *ec);
+text_backend_init(struct weston_compositor *ec,
+		  struct weston_config *config);
 
 struct weston_process;
 typedef void (*weston_process_cleanup_func_t)(struct weston_process *process,
@@ -1455,7 +1455,8 @@ backend_init(struct weston_compositor *c,
 	     struct weston_config *config);
 int
 module_init(struct weston_compositor *compositor,
-	    int *argc, char *argv[]);
+	    int *argc, char *argv[],
+	    struct weston_config *config);
 
 void
 weston_transformed_coord(int width, int height,
diff --git a/src/libinput-device.c b/src/libinput-device.c
index 8a48905..629995c 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -288,7 +288,7 @@ notify_output_destroy(struct wl_listener *listener, void *data)
  * can't do that, so we need to convert the calibration to the normalized
  * format libinput expects.
  */
-static void
+void
 evdev_device_set_calibration(struct evdev_device *device)
 {
 	struct udev *udev;
@@ -382,31 +382,6 @@ evdev_device_set_output(struct evdev_device *device,
 	evdev_device_set_calibration(device);
 }
 
-static void
-configure_device(struct evdev_device *device)
-{
-	struct weston_compositor *compositor = device->seat->compositor;
-	struct weston_config_section *s;
-	int enable_tap;
-	int enable_tap_default;
-
-	s = weston_config_get_section(compositor->config,
-				      "libinput", NULL, NULL);
-
-	if (libinput_device_config_tap_get_finger_count(device->device) > 0) {
-		enable_tap_default =
-			libinput_device_config_tap_get_default_enabled(
-				device->device);
-		weston_config_section_get_bool(s, "enable_tap",
-					       &enable_tap,
-					       enable_tap_default);
-		libinput_device_config_tap_set_enabled(device->device,
-						       enable_tap);
-	}
-
-	evdev_device_set_calibration(device);
-}
-
 struct evdev_device *
 evdev_device_create(struct libinput_device *libinput_device,
 		    struct weston_seat *seat)
@@ -440,8 +415,6 @@ evdev_device_create(struct libinput_device *libinput_device,
 	libinput_device_set_user_data(libinput_device, device);
 	libinput_device_ref(libinput_device);
 
-	configure_device(device);
-
 	return device;
 }
 
diff --git a/src/libinput-device.h b/src/libinput-device.h
index 0775743..e14e1dd 100644
--- a/src/libinput-device.h
+++ b/src/libinput-device.h
@@ -63,6 +63,8 @@ void
 evdev_device_set_output(struct evdev_device *device,
 			struct weston_output *output);
 void
+evdev_device_set_calibration(struct evdev_device *device);
+void
 evdev_device_destroy(struct evdev_device *device);
 
 void
diff --git a/src/libinput-seat.c b/src/libinput-seat.c
index ef2d804..15cadbe 100644
--- a/src/libinput-seat.c
+++ b/src/libinput-seat.c
@@ -70,6 +70,9 @@ device_added(struct udev_input *input, struct libinput_device *libinput_device)
 	if (device == NULL)
 		return;
 
+	if (input->configure_device != NULL)
+		input->configure_device(c, device->device);
+	evdev_device_set_calibration(device);
 	udev_seat = (struct udev_seat *) seat;
 	wl_list_insert(udev_seat->devices_list.prev, &device->link);
 
@@ -266,9 +269,9 @@ udev_input_init(struct udev_input *input, struct weston_compositor *c,
 	enum libinput_log_priority priority = LIBINPUT_LOG_PRIORITY_INFO;
 	const char *log_priority = NULL;
 
-	memset(input, 0, sizeof *input);
-
 	input->compositor = c;
+	input->libinput_source = NULL;
+	input->suspended = 0;
 
 	log_priority = getenv("WESTON_LIBINPUT_LOG_PRIORITY");
 
@@ -387,3 +390,25 @@ udev_seat_get_named(struct udev_input *input, const char *seat_name)
 
 	return udev_seat_create(input, seat_name);
 }
+
+void
+libinput_device_configure(struct libinput_device *device, struct weston_config *config)
+{
+	struct weston_config_section *s;
+	int enable_tap;
+	int enable_tap_default;
+
+	s = weston_config_get_section(config,
+				      "libinput", NULL, NULL);
+
+	if (libinput_device_config_tap_get_finger_count(device) > 0) {
+		enable_tap_default =
+			libinput_device_config_tap_get_default_enabled(
+				device);
+		weston_config_section_get_bool(s, "enable_tap",
+					       &enable_tap,
+					       enable_tap_default);
+		libinput_device_config_tap_set_enabled(device,
+						       enable_tap);
+	}
+}
diff --git a/src/libinput-seat.h b/src/libinput-seat.h
index c448da0..9915d28 100644
--- a/src/libinput-seat.h
+++ b/src/libinput-seat.h
@@ -36,11 +36,15 @@ struct udev_seat {
 	struct wl_listener output_create_listener;
 };
 
+struct libinput_device;
+
 struct udev_input {
 	struct libinput *libinput;
 	struct wl_event_source *libinput_source;
 	struct weston_compositor *compositor;
 	int suspended;
+	void (*configure_device)(struct weston_compositor *compositor,
+				 struct libinput_device *device);
 };
 
 int
@@ -59,4 +63,8 @@ struct udev_seat *
 udev_seat_get_named(struct udev_input *u,
 		    const char *seat_name);
 
+void
+libinput_device_configure(struct libinput_device *device,
+		          struct weston_config *config);
+
 #endif
diff --git a/src/text-backend.c b/src/text-backend.c
index 6246b30..c963166 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -940,13 +940,14 @@ handle_seat_created(struct wl_listener *listener,
 }
 
 static void
-text_backend_configuration(struct text_backend *text_backend)
+text_backend_configuration(struct text_backend *text_backend,
+			   struct weston_config *config)
 {
 	struct weston_config_section *section;
 	char *client;
 	int ret;
 
-	section = weston_config_get_section(text_backend->compositor->config,
+	section = weston_config_get_section(config,
 					    "input-method", NULL, NULL);
 	ret = asprintf(&client, "%s/weston-keyboard",
 		       weston_config_get_libexec_dir());
@@ -974,7 +975,8 @@ text_backend_notifier_destroy(struct wl_listener *listener, void *data)
 
 
 WL_EXPORT int
-text_backend_init(struct weston_compositor *ec)
+text_backend_init(struct weston_compositor *ec,
+	    struct weston_config *config)
 {
 	struct text_backend *text_backend;
 
@@ -991,7 +993,7 @@ text_backend_init(struct weston_compositor *ec)
 	text_backend->destroy_listener.notify = text_backend_notifier_destroy;
 	wl_signal_add(&ec->destroy_signal, &text_backend->destroy_listener);
 
-	text_backend_configuration(text_backend);
+	text_backend_configuration(text_backend, config);
 
 	text_input_manager_create(ec);
 
diff --git a/tests/surface-global-test.c b/tests/surface-global-test.c
index edc5d9f..3e30900 100644
--- a/tests/surface-global-test.c
+++ b/tests/surface-global-test.c
@@ -75,7 +75,8 @@ surface_to_from_global(void *data)
 }
 
 WL_EXPORT int
-module_init(struct weston_compositor *compositor, int *argc, char *argv[])
+module_init(struct weston_compositor *compositor, int *argc, char *argv[],
+	    struct weston_config *config)
 {
 	struct wl_event_loop *loop;
 
diff --git a/tests/surface-test.c b/tests/surface-test.c
index d466a44..eb2bb20 100644
--- a/tests/surface-test.c
+++ b/tests/surface-test.c
@@ -57,7 +57,8 @@ surface_transform(void *data)
 }
 
 WL_EXPORT int
-module_init(struct weston_compositor *compositor, int *argc, char *argv[])
+module_init(struct weston_compositor *compositor, int *argc, char *argv[],
+	    struct weston_config *config)
 {
 	struct wl_event_loop *loop;
 
diff --git a/tests/weston-test.c b/tests/weston-test.c
index 77eaa23..7960813 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -291,7 +291,8 @@ idle_launch_client(void *data)
 
 WL_EXPORT int
 module_init(struct weston_compositor *ec,
-	    int *argc, char *argv[])
+	    int *argc, char *argv[],
+	    struct weston_config *config)
 {
 	struct weston_test *test;
 	struct wl_event_loop *loop;
diff --git a/xwayland/launcher.c b/xwayland/launcher.c
index df2efd2..2a76ee3 100644
--- a/xwayland/launcher.c
+++ b/xwayland/launcher.c
@@ -94,7 +94,7 @@ weston_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
 			goto fail;
 		snprintf(wm_fd, sizeof wm_fd, "%d", fd);
 
-		section = weston_config_get_section(wxs->compositor->config,
+		section = weston_config_get_section(wxs->config,
 						    "xwayland", NULL, NULL);
 		weston_config_section_get_string(section, "path",
 						 &xserver, XSERVER_PATH);
@@ -346,7 +346,8 @@ weston_xserver_destroy(struct wl_listener *l, void *data)
 
 WL_EXPORT int
 module_init(struct weston_compositor *compositor,
-	    int *argc, char *argv[])
+	    int *argc, char *argv[],
+	    struct weston_config *config)
 
 {
 	struct wl_display *display = compositor->wl_display;
@@ -394,6 +395,7 @@ module_init(struct weston_compositor *compositor,
 	weston_log("xserver listening on display %s\n", display_name);
 	setenv("DISPLAY", display_name, 1);
 
+	wxs->config = config;
 	wxs->loop = wl_display_get_event_loop(display);
 	wxs->abstract_source =
 		wl_event_loop_add_fd(wxs->loop, wxs->abstract_fd,
diff --git a/xwayland/xwayland.h b/xwayland/xwayland.h
index 312c9b2..161615f 100644
--- a/xwayland/xwayland.h
+++ b/xwayland/xwayland.h
@@ -47,6 +47,7 @@ struct weston_xserver {
 	struct wl_client *client;
 	struct weston_compositor *compositor;
 	struct weston_wm *wm;
+	struct weston_config *config;
 	struct wl_listener destroy_listener;
 };
 
-- 
2.1.3



More information about the wayland-devel mailing list