shell: automatic exec and kill of wscreensaver
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
+16
-2
@@ -28,6 +28,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include "compositor.h"
|
#include "compositor.h"
|
||||||
@@ -58,6 +59,7 @@ struct wl_shell {
|
|||||||
struct {
|
struct {
|
||||||
struct wl_resource *binding;
|
struct wl_resource *binding;
|
||||||
struct wl_list surfaces;
|
struct wl_list surfaces;
|
||||||
|
struct wlsc_process process;
|
||||||
} screensaver;
|
} screensaver;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -489,19 +491,31 @@ static const struct wl_shell_interface shell_implementation = {
|
|||||||
shell_get_shell_surface
|
shell_get_shell_surface
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_screensaver_sigchld(struct wlsc_process *proc, int status)
|
||||||
|
{
|
||||||
|
proc->pid = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
launch_screensaver(struct wl_shell *shell)
|
launch_screensaver(struct wl_shell *shell)
|
||||||
{
|
{
|
||||||
if (shell->screensaver.binding)
|
if (shell->screensaver.binding)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* TODO: exec() the screensaver process */
|
wlsc_client_launch(shell->compositor,
|
||||||
|
&shell->screensaver.process,
|
||||||
|
"./clients/wscreensaver",
|
||||||
|
handle_screensaver_sigchld);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
terminate_screensaver(struct wl_shell *shell)
|
terminate_screensaver(struct wl_shell *shell)
|
||||||
{
|
{
|
||||||
/* TODO */
|
if (shell->screensaver.process.pid == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
kill(shell->screensaver.process.pid, SIGTERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user