Paste: DPMS!
Author: | blei |
Mode: | patch |
Date: | Fri, 29 Mar 2013 19:38:18 |
Plain Text |
From 15903829aa8f8553829770ce052dc165797738e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= <blei42@gmail.com>
Date: Fri, 29 Mar 2013 20:32:54 +0100
Subject: [PATCH] compositor: don't let weston terminate with dpms set to off
if possible
This will not catch the cases where weston crashes, but it's at least
better than the current state.
src/compositor.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 1617d96..c3e6bed 100644
+++ b/src/compositor.c
@@ -3236,10 +3236,15 @@ weston_version(int *major, int *minor, int *micro)
static int on_term_signal(int signal_number, void *data)
{
+ struct weston_compositor *ec = data;
weston_log("caught signal %d\n", signal_number);
+
+ /* Turn DPMS back on, so we're not left with a black screen */
+ if (ec->state == WESTON_COMPOSITOR_SLEEPING)
+ weston_compositor_dpms(ec, WESTON_DPMS_ON);
+
+ wl_display_terminate(ec->wl_display);
return 1;
}
@@ -3571,15 +3576,9 @@ int main(int argc, char *argv[])
display = wl_display_create();
loop = wl_display_get_event_loop(display);
wl_list_init(&child_process_list);
+ signals[0] = wl_event_loop_add_signal(loop, SIGCHLD, sigchld_handler,
NULL);
if (!backend) {
@@ -3604,6 +3603,13 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
+ signals[1] = wl_event_loop_add_signal(loop, SIGTERM, on_term_signal,
+ ec);
+ signals[2] = wl_event_loop_add_signal(loop, SIGINT, on_term_signal,
+ ec);
+ signals[3] = wl_event_loop_add_signal(loop, SIGQUIT, on_term_signal,
+ ec);
+
catch_signals();
segv_compositor = ec;
@@ -3636,6 +3642,10 @@ int main(int argc, char *argv[])
wl_display_run(display);
out:
+ /* Turn DPMS back on, so we're not left with a black screen */
+ if (ec->state == WESTON_COMPOSITOR_SLEEPING)
+ weston_compositor_dpms(ec, WESTON_DPMS_ON);
+
/* prevent further rendering while shutting down */
ec->state = WESTON_COMPOSITOR_OFFSCREEN;
1.8.2
New Annotation