[PATCH weston] shell: Start the desktop-shell client in the idle handler

Tiago Vignatti tiago.vignatti at intel.com
Tue Sep 25 07:57:01 PDT 2012


It fix https://bugs.freedesktop.org/show_bug.cgi?id=55259

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 src/shell.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index 2afa1b3..67d1060 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3028,7 +3028,7 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
 	}
 }
 
-static int launch_desktop_shell_process(struct desktop_shell *shell);
+static void launch_desktop_shell_process(void *data);
 
 static void
 desktop_shell_sigchld(struct weston_process *process, int status)
@@ -3057,9 +3057,10 @@ desktop_shell_sigchld(struct weston_process *process, int status)
 	launch_desktop_shell_process(shell);
 }
 
-static int
-launch_desktop_shell_process(struct desktop_shell *shell)
+static void
+launch_desktop_shell_process(void *data)
 {
+	struct desktop_shell *shell = data;
 	const char *shell_exe = LIBEXECDIR "/weston-desktop-shell";
 
 	shell->child.client = weston_client_launch(shell->compositor,
@@ -3068,8 +3069,7 @@ launch_desktop_shell_process(struct desktop_shell *shell)
 						 desktop_shell_sigchld);
 
 	if (!shell->child.client)
-		return -1;
-	return 0;
+		weston_log("not able to start %s\n", shell_exe);
 }
 
 static void
@@ -3697,6 +3697,7 @@ module_init(struct weston_compositor *ec)
 	struct desktop_shell *shell;
 	struct workspace **pws;
 	unsigned int i;
+	struct wl_event_loop *loop;
 
 	shell = malloc(sizeof *shell);
 	if (shell == NULL)
@@ -3774,8 +3775,9 @@ module_init(struct weston_compositor *ec)
 		return -1;
 
 	shell->child.deathstamp = weston_compositor_get_time();
-	if (launch_desktop_shell_process(shell) != 0)
-		return -1;
+
+	loop = wl_display_get_event_loop(ec->wl_display);
+	wl_event_loop_add_idle(loop, launch_desktop_shell_process, shell);
 
 	wl_list_for_each(seat, &ec->seat_list, link)
 		create_pointer_focus_listener(seat);
-- 
1.7.9.5



More information about the wayland-devel mailing list