diff --git a/compositor/Makefile.am b/compositor/Makefile.am index 6716446b..ce5a3d2f 100644 --- a/compositor/Makefile.am +++ b/compositor/Makefile.am @@ -74,7 +74,8 @@ endif if ENABLE_DESKTOP_SHELL desktop_shell = desktop-shell.la desktop_shell_la_LDFLAGS = -module -avoid-version -desktop_shell_la_LIBADD = $(COMPOSITOR_LIBS) +desktop_shell_la_LIBADD = $(COMPOSITOR_LIBS) \ + ../shared/libconfig-parser.la desktop_shell_la_CFLAGS = $(GCC_CFLAGS) desktop_shell_la_SOURCES = \ shell.c \ diff --git a/compositor/shell.c b/compositor/shell.c index 99c2af5a..6cabcfcb 100644 --- a/compositor/shell.c +++ b/compositor/shell.c @@ -33,6 +33,7 @@ #include #include "compositor.h" #include "desktop-shell-server-protocol.h" +#include "../shared/config-parser.h" struct shell_surface; @@ -57,6 +58,7 @@ struct wl_shell { struct wl_list panels; struct { + const char *path; struct wl_resource *binding; struct wl_list surfaces; struct wlsc_process process; @@ -95,6 +97,28 @@ struct wlsc_move_grab { int32_t dx, dy; }; +static int +shell_configuration(struct wl_shell *shell) +{ + int ret; + char *config_file; + + struct config_key saver_keys[] = { + { "path", CONFIG_KEY_STRING, &shell->screensaver.path }, + }; + + struct config_section cs[] = { + { "screensaver", saver_keys, ARRAY_LENGTH(saver_keys), NULL }, + }; + + config_file = config_file_path("wayland-desktop-shell.ini"); + ret = parse_config_file(config_file, cs, ARRAY_LENGTH(cs), shell); + free(config_file); + + return ret; + /* FIXME: free(shell->screensaver.path) on plugin fini */ +} + static void move_grab_motion(struct wl_grab *grab, uint32_t time, int32_t x, int32_t y) @@ -503,9 +527,12 @@ launch_screensaver(struct wl_shell *shell) if (shell->screensaver.binding) return; + if (!shell->screensaver.path) + return; + wlsc_client_launch(shell->compositor, &shell->screensaver.process, - "./clients/wscreensaver", + shell->screensaver.path, handle_screensaver_sigchld); } @@ -1214,6 +1241,9 @@ shell_init(struct wlsc_compositor *ec) wl_list_init(&shell->panels); wl_list_init(&shell->screensaver.surfaces); + if (shell_configuration(shell) < 0) + return -1; + if (wl_display_add_global(ec->wl_display, &wl_shell_interface, shell, bind_shell) == NULL) return -1; diff --git a/wayland-desktop-shell.ini b/wayland-desktop-shell.ini index 3a869353..d438a85e 100644 --- a/wayland-desktop-shell.ini +++ b/wayland-desktop-shell.ini @@ -18,3 +18,7 @@ path=/usr/bin/google-chrome [launcher] icon=/usr/share/icons/gnome/24x24/apps/arts.png path=./clients/flower + +[screensaver] +#path=./clients/wscreensaver +