Commit 90b2c0dd authored by Guido Gunther's avatar Guido Gunther Committed by Sebastian Krzyszkowiak

Kill fader after 15 seconds

if we can't shut down promptly kill the fader instead of leaving
the shell in an unusable state.
Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
parent d1aaabb0
Pipeline #35328 passed with stages
in 6 minutes and 54 seconds
......@@ -28,7 +28,7 @@ quit (gpointer unused)
static gboolean
sigterm_cb (gpointer unused)
{
phosh_shell_fade_out (phosh_shell_get_default ());
phosh_shell_fade_out (phosh_shell_get_default (), 0);
g_timeout_add_seconds (2, (GSourceFunc)quit, NULL);
return FALSE;
......
......@@ -19,6 +19,8 @@
#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager"
#define GNOME_SESSION_CLIENT_PRIVATE_DBUS_INTERFACE "org.gnome.SessionManager.ClientPrivate"
#define SESSION_SHUTDOWN_TIMEOUT 15
/**
* SECTION:phosh-session
* @short_description: Manages gnome-session registration and shutdown
......@@ -34,7 +36,7 @@ static void
respond_to_end_session (GDBusProxy *proxy, gboolean shutdown)
{
if (shutdown)
phosh_shell_fade_out (phosh_shell_get_default ());
phosh_shell_fade_out (phosh_shell_get_default (), SESSION_SHUTDOWN_TIMEOUT);
/* we must answer with "EndSessionResponse" */
g_dbus_proxy_call (proxy, "EndSessionResponse",
g_variant_new ("(bs)", TRUE, ""),
......
......@@ -452,6 +452,21 @@ on_toplevel_added (PhoshShell *self, GParamSpec *pspec, PhoshToplevelManager *to
}
static gboolean
on_fade_out_timeout (PhoshShell *self)
{
PhoshShellPrivate *priv;
g_return_val_if_fail (PHOSH_IS_SHELL (self), G_SOURCE_REMOVE);
priv = phosh_shell_get_instance_private (self);
/* kill all faders if we time out */
g_clear_pointer (&priv->faders, g_ptr_array_unref);
return G_SOURCE_REMOVE;
}
static gboolean
setup_idle_cb (PhoshShell *self)
{
......@@ -787,7 +802,7 @@ phosh_shell_get_default (void)
}
void
phosh_shell_fade_out (PhoshShell *self)
phosh_shell_fade_out (PhoshShell *self, guint timeout)
{
PhoshShellPrivate *priv;
PhoshWayland *wl = phosh_wayland_get_default ();
......@@ -805,5 +820,7 @@ phosh_shell_fade_out (PhoshShell *self)
monitor->wl_output);
g_ptr_array_add (priv->faders, fader);
gtk_widget_show (GTK_WIDGET (fader));
if (timeout > 0)
g_timeout_add_seconds (timeout, (GSourceFunc) on_fade_out_timeout, self);
}
}
......@@ -38,4 +38,4 @@ PhoshMonitorManager *phosh_shell_get_monitor_manager (PhoshShell *self);
PhoshOskManager *phosh_shell_get_osk_manager (PhoshShell *self);
PhoshToplevelManager *phosh_shell_get_toplevel_manager (PhoshShell *self);
PhoshWifiManager *phosh_shell_get_wifi_manager (PhoshShell *self);
void phosh_shell_fade_out (PhoshShell *self);
void phosh_shell_fade_out (PhoshShell *self, guint timeout);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment