diff options
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r-- | shell/ev-window.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c index 0c8e1298..820b9f32 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -230,6 +230,8 @@ struct _EvWindowPrivate { gchar *dbus_object_path; #endif + guint presentation_mode_inhibit_id; + /* Caret navigation */ GtkWidget *ask_caret_navigation_check; }; @@ -4263,6 +4265,35 @@ ev_window_cmd_view_fullscreen (GtkAction *action, EvWindow *window) } static void +ev_window_inhibit_screensaver (EvWindow *window) +{ + EvWindowPrivate *priv = window->priv; + + if (priv->presentation_mode_inhibit_id != 0) + return; + + priv->presentation_mode_inhibit_id = + gtk_application_inhibit (GTK_APPLICATION (g_application_get_default ()), + GTK_WINDOW (window), + GTK_APPLICATION_INHIBIT_IDLE, + _("Running in presentation mode")); +} + + +static void +ev_window_uninhibit_screensaver (EvWindow *window) +{ + EvWindowPrivate *priv = window->priv; + + if (priv->presentation_mode_inhibit_id == 0) + return; + + gtk_application_uninhibit (GTK_APPLICATION (g_application_get_default ()), + priv->presentation_mode_inhibit_id); + priv->presentation_mode_inhibit_id = 0; +} + +static void ev_window_update_presentation_action (EvWindow *window) { GtkAction *action; @@ -4285,7 +4316,7 @@ ev_window_view_presentation_finished (EvWindow *window) static gboolean ev_window_view_presentation_focus_in (EvWindow *window) { - ev_application_screensaver_disable (EV_APP); + ev_window_uninhibit_screensaver (window); return FALSE; } @@ -4293,7 +4324,7 @@ ev_window_view_presentation_focus_in (EvWindow *window) static gboolean ev_window_view_presentation_focus_out (EvWindow *window) { - ev_application_screensaver_enable (EV_APP); + ev_window_uninhibit_screensaver (window); return FALSE; } @@ -4353,7 +4384,7 @@ ev_window_run_presentation (EvWindow *window) gtk_widget_show (window->priv->presentation_view); - ev_application_screensaver_disable (EV_APP); + ev_window_inhibit_screensaver (window); if (window->priv->metadata && !ev_window_is_empty (window)) ev_metadata_set_boolean (window->priv->metadata, "presentation", TRUE); @@ -4392,7 +4423,7 @@ ev_window_stop_presentation (EvWindow *window, gtk_widget_grab_focus (window->priv->webview); } #endif - ev_application_screensaver_enable (EV_APP); + ev_window_uninhibit_screensaver (window); if (window->priv->metadata && !ev_window_is_empty (window)) ev_metadata_set_boolean (window->priv->metadata, "presentation", FALSE); @@ -7625,6 +7656,7 @@ ev_window_init (EvWindow *ev_window) ev_window->priv->page_mode = PAGE_MODE_DOCUMENT; ev_window->priv->chrome = EV_CHROME_NORMAL; + ev_window->priv->presentation_mode_inhibit_id = 0; ev_window->priv->title = ev_window_title_new (ev_window); GtkStyleContext *context; |