[PATCH 5/7] compositor: make screensaver idle time shell specific
Tiago Vignatti
tiago.vignatti at intel.com
Fri Feb 24 08:08:43 PST 2012
just like "duration"
Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
src/compositor.c | 31 +------------------------------
src/shell.c | 18 ++++++++++++++++++
weston-desktop-shell.ini | 1 +
3 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index dcf3813..264784d 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1442,19 +1442,6 @@ weston_compositor_idle_release(struct weston_compositor *compositor)
weston_compositor_activity(compositor);
}
-static int
-idle_handler(void *data)
-{
- struct weston_compositor *compositor = data;
-
- if (compositor->idle_inhibit)
- return 1;
-
- weston_compositor_fade(compositor, 1.0);
-
- return 1;
-}
-
static void
weston_input_update_drag_surface(struct wl_input_device *input_device,
int dx, int dy);
@@ -2336,8 +2323,6 @@ weston_compositor_shutdown(struct weston_compositor *ec)
{
struct weston_output *output, *next;
- weston_timer_fini(ec);
-
if (ec->screenshooter)
screenshooter_destroy(ec->screenshooter);
@@ -2428,16 +2413,13 @@ int main(int argc, char *argv[])
char *backend = NULL;
char *backend_options = "";
char *shell = NULL;
- char *p;
- int option_idle_time = 300;
int i;
- static const char opts[] = "B:b:o:S:i:s:x";
+ static const char opts[] = "B:b:o:S:s:x";
static const struct option longopts[ ] = {
{ "backend", 1, NULL, 'B' },
{ "backend-options", 1, NULL, 'o' },
{ "socket", 1, NULL, 'S' },
- { "idle-time", 1, NULL, 'i' },
{ "shell", 1, NULL, 's' },
{ "xserver", 0, NULL, 'x' },
{ NULL, }
@@ -2454,15 +2436,6 @@ int main(int argc, char *argv[])
case 'S':
option_socket_name = optarg;
break;
- case 'i':
- option_idle_time = strtol(optarg, &p, 0);
- if (*p != '\0') {
- fprintf(stderr,
- "invalid idle time option: %s\n",
- optarg);
- exit(EXIT_FAILURE);
- }
- break;
case 's':
shell = optarg;
break;
@@ -2519,8 +2492,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- weston_timer_init(ec, idle_handler, option_idle_time);
-
if (xserver)
weston_xserver_init(ec);
diff --git a/src/shell.c b/src/shell.c
index 0a1efc1..270f789 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -130,15 +130,30 @@ struct rotate_grab {
} center;
};
+static int
+idle_handler(void *data)
+{
+ struct weston_compositor *compositor = data;
+
+ if (compositor->idle_inhibit)
+ return 1;
+
+ weston_compositor_fade(compositor, 1.0);
+
+ return 1;
+}
+
static void
shell_configuration(struct wl_shell *shell)
{
char *config_file;
char *path = NULL;
int duration = 60;
+ int screensaver = 300;
struct config_key saver_keys[] = {
{ "path", CONFIG_KEY_STRING, &path },
+ { "screensaver", CONFIG_KEY_INTEGER, &screensaver },
{ "duration", CONFIG_KEY_INTEGER, &duration },
};
@@ -152,6 +167,7 @@ shell_configuration(struct wl_shell *shell)
shell->screensaver.path = path;
shell->screensaver.duration = duration;
+ weston_timer_init(shell->compositor, idle_handler, screensaver);
}
static void
@@ -1809,6 +1825,8 @@ shell_destroy(struct weston_shell *base)
{
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
+ weston_timer_fini(shell->compositor);
+
if (shell->child.client)
wl_client_destroy(shell->child.client);
diff --git a/weston-desktop-shell.ini b/weston-desktop-shell.ini
index 9460a4e..01289a8 100644
--- a/weston-desktop-shell.ini
+++ b/weston-desktop-shell.ini
@@ -22,5 +22,6 @@ path=./clients/flower
[screensaver]
#path=./clients/wscreensaver
+screensaver=300
duration=600
--
1.7.5.4
More information about the wayland-devel
mailing list