diff options
Diffstat (limited to 'src/eom-window.c')
-rw-r--r-- | src/eom-window.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/eom-window.c b/src/eom-window.c index 329b6da..a7c3575 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -161,6 +161,8 @@ struct _EomWindowPrivate { gint slideshow_switch_timeout; GSource *slideshow_switch_source; + guint fullscreen_idle_inhibit_cookie; + guint recent_menu_id; EomJob *load_job; @@ -1973,6 +1975,37 @@ update_ui_visibility (EomWindow *window) } static void +eom_window_inhibit_screensaver (EomWindow *window) +{ + EomWindowPrivate *priv = window->priv; + + g_return_if_fail (priv->fullscreen_idle_inhibit_cookie == 0); + + eom_debug (DEBUG_WINDOW); + + window->priv->fullscreen_idle_inhibit_cookie = + gtk_application_inhibit (GTK_APPLICATION (EOM_APP), + GTK_WINDOW (window), + GTK_APPLICATION_INHIBIT_IDLE, + _("Viewing a slideshow")); +} + +static void +eom_window_uninhibit_screensaver (EomWindow *window) +{ + EomWindowPrivate *priv = window->priv; + + if (G_UNLIKELY (priv->fullscreen_idle_inhibit_cookie == 0)) + return; + + eom_debug (DEBUG_WINDOW); + + gtk_application_uninhibit (GTK_APPLICATION (EOM_APP), + priv->fullscreen_idle_inhibit_cookie); + priv->fullscreen_idle_inhibit_cookie = 0; +} + +static void eom_window_run_fullscreen (EomWindow *window, gboolean slideshow) { static const GdkRGBA black = { 0., 0., 0., 1.}; @@ -2057,7 +2090,7 @@ eom_window_run_fullscreen (EomWindow *window, gboolean slideshow) gtk_window_fullscreen (GTK_WINDOW (window)); eom_window_update_fullscreen_popup (window); - eom_application_screensaver_disable (EOM_APP); + eom_window_inhibit_screensaver (window); /* Update both actions as we could've already been in one those modes */ eom_window_update_slideshow_action (window); @@ -2122,7 +2155,7 @@ eom_window_stop_fullscreen (EomWindow *window, gboolean slideshow) eom_scroll_view_show_cursor (EOM_SCROLL_VIEW (priv->view)); - eom_application_screensaver_enable (EOM_APP); + eom_window_uninhibit_screensaver (window); } static void @@ -4542,6 +4575,7 @@ eom_window_init (EomWindow *window) window->priv->slideshow_loop = FALSE; window->priv->slideshow_switch_timeout = 0; window->priv->slideshow_switch_source = NULL; + window->priv->fullscreen_idle_inhibit_cookie = 0; gtk_window_set_geometry_hints (GTK_WINDOW (window), GTK_WIDGET (window), @@ -4666,6 +4700,7 @@ eom_window_dispose (GObject *object) } slideshow_clear_timeout (window); + eom_window_uninhibit_screensaver (window); g_signal_handlers_disconnect_by_func (gtk_recent_manager_get_default (), G_CALLBACK (eom_window_recent_manager_changed_cb), |