[PATCH weston 1/2] desktop-shell: Add an option for shell startup timeout

Derek Foreman derekf at osg.samsung.com
Mon May 25 13:19:37 PDT 2015


Make the time to wait for shell startup before removing the fade surface
configurable.

Use this in internal-screenshot so we can screenshot without waiting for
the shell to start.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 desktop-shell/shell.c         | 18 +++++++++++++++---
 man/weston.ini.man            |  5 +++++
 tests/internal-screenshot.ini |  1 +
 weston.ini.in                 |  1 +
 4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 452cd5f..5e60312 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5369,7 +5369,7 @@ fade_startup_timeout(void *data)
 }
 
 static void
-shell_fade_init(struct desktop_shell *shell)
+shell_fade_init(struct desktop_shell *shell, uint32_t timeout)
 {
 	/* Make compositor output all black, and wait for the desktop-shell
 	 * client to signal it is ready, then fade in. The timer triggers a
@@ -5378,6 +5378,9 @@ shell_fade_init(struct desktop_shell *shell)
 
 	struct wl_event_loop *loop;
 
+	if (!timeout)
+		return;
+
 	if (shell->fade.view != NULL) {
 		weston_log("%s: warning: fade surface already exists\n",
 			   __func__);
@@ -5394,7 +5397,7 @@ shell_fade_init(struct desktop_shell *shell)
 	loop = wl_display_get_event_loop(shell->compositor->wl_display);
 	shell->fade.startup_timer =
 		wl_event_loop_add_timer(loop, fade_startup_timeout, shell);
-	wl_event_source_timer_update(shell->fade.startup_timer, 15000);
+	wl_event_source_timer_update(shell->fade.startup_timer, timeout);
 }
 
 static void
@@ -6613,6 +6616,10 @@ module_init(struct weston_compositor *ec,
 	struct workspace **pws;
 	unsigned int i;
 	struct wl_event_loop *loop;
+	struct weston_config *config;
+	struct weston_config_section *s;
+	uint32_t timeout;
+	const char *config_file;
 
 	shell = zalloc(sizeof *shell);
 	if (shell == NULL)
@@ -6717,7 +6724,12 @@ module_init(struct weston_compositor *ec,
 
 	shell_add_bindings(ec, shell);
 
-	shell_fade_init(shell);
+	config_file = weston_config_get_name_from_env();
+	config = weston_config_parse(config_file);
+	s = weston_config_get_section(config, "shell", NULL, NULL);
+	weston_config_section_get_uint(s, "startup-timeout", &timeout, 15000);
+	weston_config_destroy(config);
+	shell_fade_init(shell, timeout);
 
 	clock_gettime(CLOCK_MONOTONIC, &shell->startup_time);
 
diff --git a/man/weston.ini.man b/man/weston.ini.man
index fe86bb6..0bb77e0 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -287,6 +287,11 @@ sets the path to lock screen background image (string). (tablet shell only)
 .TP 7
 .BI "homescreen=" path
 sets the path to home screen background image (string). (tablet shell only)
+.TP 7
+.BI "startup-timeout=" 15000
+sets the time in milliseconds to wait for the shell to start.  Normally the
+screen is black until the shell finishes starting.  If shell startup exceeds
+this timeout, windows will be displayed anyway.
 .RE
 .SH "LAUNCHER SECTION"
 There can be multiple launcher sections, one for each launcher.
diff --git a/tests/internal-screenshot.ini b/tests/internal-screenshot.ini
index abc046e..95c01bd 100644
--- a/tests/internal-screenshot.ini
+++ b/tests/internal-screenshot.ini
@@ -1,3 +1,4 @@
 [shell]
 startup-animation=none
 background-color=0xCC336699
+startup-timeout=0
diff --git a/weston.ini.in b/weston.ini.in
index 4fca0bb..534bb09 100644
--- a/weston.ini.in
+++ b/weston.ini.in
@@ -15,6 +15,7 @@ startup-animation=fade
 #num-workspaces=6
 #cursor-theme=whiteglass
 #cursor-size=24
+#startup-timeout=15000
 
 #lockscreen-icon=/usr/share/icons/gnome/256x256/actions/lock.png
 #lockscreen=/usr/share/backgrounds/gnome/Garden.jpg
-- 
2.1.4



More information about the wayland-devel mailing list