diff options
author | Pekka Paalanen <ppaalanen@gmail.com> | 2011-12-02 16:31:49 +0200 |
---|---|---|
committer | Pekka Paalanen <ppaalanen@gmail.com> | 2011-12-14 13:45:33 +0200 |
commit | 18027e517aa5768df81447061d94db867f15845a (patch) | |
tree | 40f0c8ca186c6daf33dd66ae4c650219339e1f37 /compositor | |
parent | bce2d3f9a742c67f5485886b655a2d50d491e096 (diff) |
shell: automatic exec and kill of wscreensaver
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Diffstat (limited to 'compositor')
-rw-r--r-- | compositor/shell.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/compositor/shell.c b/compositor/shell.c index 32738819..99c2af5a 100644 --- a/compositor/shell.c +++ b/compositor/shell.c @@ -28,6 +28,7 @@ #include <unistd.h> #include <linux/input.h> #include <assert.h> +#include <signal.h> #include <wayland-server.h> #include "compositor.h" @@ -58,6 +59,7 @@ struct wl_shell { struct { struct wl_resource *binding; struct wl_list surfaces; + struct wlsc_process process; } screensaver; }; @@ -490,18 +492,30 @@ static const struct wl_shell_interface shell_implementation = { }; static void +handle_screensaver_sigchld(struct wlsc_process *proc, int status) +{ + proc->pid = 0; +} + +static void launch_screensaver(struct wl_shell *shell) { if (shell->screensaver.binding) return; - /* TODO: exec() the screensaver process */ + wlsc_client_launch(shell->compositor, + &shell->screensaver.process, + "./clients/wscreensaver", + handle_screensaver_sigchld); } static void terminate_screensaver(struct wl_shell *shell) { - /* TODO */ + if (shell->screensaver.process.pid == 0) + return; + + kill(shell->screensaver.process.pid, SIGTERM); } static void |