shell: quit weston, if weston-desktop-shell dies early

If weston-desktop-shell dies soon after launch, or maybe cannot be
executed at all, let weston exit rather than letting the user stare at a
black screen.

But, do not exit weston, if weston-desktop-shell dies later, as the user
may already have apps open, and those apps would likely still function
correctly. This gives the user the opportunity to save his work and
close the apps properly.

This should make one class of "I see only black screen" failures obvious.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
dev
Pekka Paalanen 10 years ago
parent 8e3fe08c42
commit 2e62e4ad71
  1. 30
      desktop-shell/shell.c
  2. 3
      desktop-shell/shell.h

@ -5298,6 +5298,32 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
} }
} }
static bool
check_desktop_shell_crash_too_early(struct desktop_shell *shell)
{
struct timespec now;
if (clock_gettime(CLOCK_MONOTONIC, &now) < 0)
return false;
/*
* If the shell helper client dies before the session has been
* up for roughly 30 seconds, better just make Weston shut down,
* because the user likely has no way to interact with the desktop
* anyway.
*/
if (now.tv_sec - shell->startup_time.tv_sec < 30) {
weston_log("Error: %s apparently cannot run at all.\n",
shell->client);
weston_log_continue(STAMP_SPACE "Quitting...");
wl_display_terminate(shell->compositor->wl_display);
return true;
}
return false;
}
static void launch_desktop_shell_process(void *data); static void launch_desktop_shell_process(void *data);
static void static void
@ -5340,7 +5366,9 @@ desktop_shell_client_destroy(struct wl_listener *listener, void *data)
* returning. * returning.
*/ */
if (!check_desktop_shell_crash_too_early(shell))
respawn_desktop_shell_process(shell); respawn_desktop_shell_process(shell);
shell_fade_startup(shell); shell_fade_startup(shell);
} }
@ -6407,5 +6435,7 @@ module_init(struct weston_compositor *ec,
shell_fade_init(shell); shell_fade_init(shell);
clock_gettime(CLOCK_MONOTONIC, &shell->startup_time);
return 0; return 0;
} }

@ -23,6 +23,7 @@
*/ */
#include <stdbool.h> #include <stdbool.h>
#include <time.h>
#include "compositor.h" #include "compositor.h"
@ -209,6 +210,8 @@ struct desktop_shell {
enum desktop_shell_panel_position panel_position; enum desktop_shell_panel_position panel_position;
char *client; char *client;
struct timespec startup_time;
}; };
struct weston_output * struct weston_output *

Loading…
Cancel
Save