shell: use desktop-shell ini file for screensaver path

Read the same configuration file in the shell plugin (desktop-shell) as
the desktop-shell client does.

Add a new section "screensaver", where "path" defines the path of the
idle animation client to be executed. Not defining "path" disables the
animation.

Idle animations are not in use by default. It must be configured in
wayland-desktop-shell.ini or launched manually.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
dev
Pekka Paalanen 13 years ago
parent 18027e517a
commit e955f1edd1
  1. 3
      compositor/Makefile.am
  2. 32
      compositor/shell.c
  3. 4
      wayland-desktop-shell.ini

@ -74,7 +74,8 @@ endif
if ENABLE_DESKTOP_SHELL if ENABLE_DESKTOP_SHELL
desktop_shell = desktop-shell.la desktop_shell = desktop-shell.la
desktop_shell_la_LDFLAGS = -module -avoid-version 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_CFLAGS = $(GCC_CFLAGS)
desktop_shell_la_SOURCES = \ desktop_shell_la_SOURCES = \
shell.c \ shell.c \

@ -33,6 +33,7 @@
#include <wayland-server.h> #include <wayland-server.h>
#include "compositor.h" #include "compositor.h"
#include "desktop-shell-server-protocol.h" #include "desktop-shell-server-protocol.h"
#include "../shared/config-parser.h"
struct shell_surface; struct shell_surface;
@ -57,6 +58,7 @@ struct wl_shell {
struct wl_list panels; struct wl_list panels;
struct { struct {
const char *path;
struct wl_resource *binding; struct wl_resource *binding;
struct wl_list surfaces; struct wl_list surfaces;
struct wlsc_process process; struct wlsc_process process;
@ -95,6 +97,28 @@ struct wlsc_move_grab {
int32_t dx, dy; 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 static void
move_grab_motion(struct wl_grab *grab, move_grab_motion(struct wl_grab *grab,
uint32_t time, int32_t x, int32_t y) uint32_t time, int32_t x, int32_t y)
@ -503,9 +527,12 @@ launch_screensaver(struct wl_shell *shell)
if (shell->screensaver.binding) if (shell->screensaver.binding)
return; return;
if (!shell->screensaver.path)
return;
wlsc_client_launch(shell->compositor, wlsc_client_launch(shell->compositor,
&shell->screensaver.process, &shell->screensaver.process,
"./clients/wscreensaver", shell->screensaver.path,
handle_screensaver_sigchld); handle_screensaver_sigchld);
} }
@ -1214,6 +1241,9 @@ shell_init(struct wlsc_compositor *ec)
wl_list_init(&shell->panels); wl_list_init(&shell->panels);
wl_list_init(&shell->screensaver.surfaces); wl_list_init(&shell->screensaver.surfaces);
if (shell_configuration(shell) < 0)
return -1;
if (wl_display_add_global(ec->wl_display, &wl_shell_interface, if (wl_display_add_global(ec->wl_display, &wl_shell_interface,
shell, bind_shell) == NULL) shell, bind_shell) == NULL)
return -1; return -1;

@ -18,3 +18,7 @@ path=/usr/bin/google-chrome
[launcher] [launcher]
icon=/usr/share/icons/gnome/24x24/apps/arts.png icon=/usr/share/icons/gnome/24x24/apps/arts.png
path=./clients/flower path=./clients/flower
[screensaver]
#path=./clients/wscreensaver

Loading…
Cancel
Save