From d012e9dfa4c00d2f97bfe600c847967d6a248be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 12 Apr 2012 10:37:23 -0400 Subject: [PATCH] Make xserver-launcher a module --- src/Makefile.am | 34 +++++++++++++++++++--------------- src/compositor.c | 16 ++++++++++------ src/xserver-launcher.c | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index c9fdc5a6..f0150e8a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,8 +11,7 @@ AM_CPPFLAGS = \ weston_LDFLAGS = -export-dynamic weston_CFLAGS = $(GCC_CFLAGS) weston_LDADD = \ - $(COMPOSITOR_LIBS) $(DLOPEN_LIBS) $(XSERVER_LAUNCHER_LIBS) -lm \ - ../shared/libconfig-parser.la + $(COMPOSITOR_LIBS) $(DLOPEN_LIBS) -lm ../shared/libconfig-parser.la weston_SOURCES = \ compositor.c \ @@ -23,8 +22,7 @@ weston_SOURCES = \ util.c \ matrix.c \ matrix.h \ - weston-launch.h \ - $(xserver_launcher_sources) + weston-launch.h if BUILD_WESTON_LAUNCH weston_launch = weston-launch @@ -50,19 +48,11 @@ endif endif # BUILD_WESTON_LAUNCH -if ENABLE_XSERVER_LAUNCHER -xserver_launcher_sources = \ - xserver-launcher.c \ - xserver-protocol.c \ - xserver-server-protocol.h \ - hash.c \ - hash.h -endif - moduledir = @libdir@/weston module_LTLIBRARIES = \ $(desktop_shell) \ - $(tablet_shell) \ + $(tablet_shell) \ + $(xserver_launcher) \ $(x11_backend) \ $(drm_backend) \ $(wayland_backend) \ @@ -80,7 +70,8 @@ endif if ENABLE_DRM_COMPOSITOR drm_backend = drm-backend.la drm_backend_la_LDFLAGS = -module -avoid-version -drm_backend_la_LIBADD = $(COMPOSITOR_LIBS) $(DRM_COMPOSITOR_LIBS) +drm_backend_la_LIBADD = $(COMPOSITOR_LIBS) $(DRM_COMPOSITOR_LIBS) \ + ../shared/libconfig-parser.la drm_backend_la_CFLAGS = $(DRM_COMPOSITOR_CFLAGS) $(GCC_CFLAGS) drm_backend_la_SOURCES = \ compositor-drm.c \ @@ -110,6 +101,19 @@ openwfd_backend_la_CFLAGS = $(OPENWFD_COMPOSITOR_CFLAGS) $(GCC_CFLAGS) openwfd_backend_la_SOURCES = compositor-openwfd.c tty.c evdev.c evdev.h endif +if ENABLE_XSERVER_LAUNCHER +xserver_launcher = xserver-launcher.la +xserver_launcher_la_LDFLAGS = -module -avoid-version +xserver_launcher_la_LIBADD = $(XSERVER_LAUNCHER_LIBS) +xserver_launcher_la_CFLAGS = $(GCC_CFLAGS) +xserver_launcher_la_SOURCES = \ + xserver-launcher.c \ + xserver-protocol.c \ + xserver-server-protocol.h \ + hash.c \ + hash.h +endif + if ENABLE_DESKTOP_SHELL desktop_shell = desktop-shell.la desktop_shell_la_LDFLAGS = -module -avoid-version diff --git a/src/compositor.c b/src/compositor.c index 1be1e100..3e0139d8 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -2509,8 +2509,9 @@ int main(int argc, char *argv[]) struct wl_event_source *signals[4]; struct wl_event_loop *loop; struct sigaction segv_action; - void *shell_module, *backend_module; + void *shell_module, *backend_module, *xserver_module; int (*shell_init)(struct weston_compositor *ec); + int (*xserver_init)(struct weston_compositor *ec); struct weston_compositor *(*backend_init)(struct wl_display *display, int argc, char *argv[]); @@ -2600,14 +2601,17 @@ int main(int argc, char *argv[]) ec->option_idle_time = idle_time; ec->idle_time = idle_time; -#ifdef BUILD_XSERVER_LAUNCHER - if (xserver) - weston_xserver_init(ec); -#endif - if (shell_init(ec) < 0) exit(EXIT_FAILURE); + xserver_init = NULL; + if (xserver) + xserver_init = load_module("xserver-launcher.so", + "weston_xserver_init", + &xserver_module); + if (xserver_init) + xserver_init(ec); + if (wl_display_add_socket(display, socket_name)) { fprintf(stderr, "failed to add socket: %m\n"); exit(EXIT_FAILURE); diff --git a/src/xserver-launcher.c b/src/xserver-launcher.c index 7038999e..2e4d7262 100644 --- a/src/xserver-launcher.c +++ b/src/xserver-launcher.c @@ -1701,7 +1701,7 @@ weston_xserver_destroy(struct wl_listener *l, void *data) free(wxs); } -int +WL_EXPORT int weston_xserver_init(struct weston_compositor *compositor) { struct wl_display *display = compositor->wl_display;