From: Leandro Lucarella Date: Sat, 4 Aug 2012 01:19:04 +0000 (+0200) Subject: Request display blanking inhibition immediately X-Git-Tag: v1.0~5 X-Git-Url: https://git.llucax.com/software/sadba.git/commitdiff_plain/2e10a3b957ce7ef36c4deb641a2e53feca431e42?ds=sidebyside;hp=d2f759219bfd2906ff68c40a9c217fdd5e5f5a6e Request display blanking inhibition immediately When enabling display blanking inhibition, send the request immediately besides setting up the timer for the regular request, otherwise people with a display blanking timeout less than INHIBIT_MSG_INTERVAL will have their screen blanked anyway before the first timeout is reached. --- diff --git a/src/lib-display-blanking-status-menu-widget.c b/src/lib-display-blanking-status-menu-widget.c index dce50b6..7f5a489 100644 --- a/src/lib-display-blanking-status-menu-widget.c +++ b/src/lib-display-blanking-status-menu-widget.c @@ -178,12 +178,18 @@ disable_inhibition (DisplayBlankingStatusPluginPrivate *priv) HD_STATUS_PLUGIN_ITEM (priv->plugin), NULL); } -static gboolean -on_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv) +static void +inhibit_display_blanking (DisplayBlankingStatusPluginPrivate *priv) { dbus_bool_t ok = dbus_connection_send (priv->dbus_conn, priv->dbus_msg, NULL); g_assert (ok == TRUE); +} + +static gboolean +on_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv) +{ + inhibit_display_blanking (priv); return TRUE; } @@ -210,6 +216,8 @@ on_timed_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv) static void enable_inhibition (DisplayBlankingStatusPluginPrivate *priv) { + inhibit_display_blanking (priv); + g_assert (priv->inhibit_timer_id == 0); priv->inhibit_timer_id = g_timeout_add_seconds (INHIBIT_MSG_INTERVAL, (GSourceFunc) on_inhibit_timeout, priv);