summaryrefslogtreecommitdiff
path: root/shell/ev-window.c
diff options
context:
space:
mode:
authorChristian Persch <[email protected]>2012-06-13 00:25:29 +0200
committerraveit65 <[email protected]>2018-03-21 06:56:34 +0100
commit2f89fccf54a858495101cd57bac66ffca657ff62 (patch)
tree3d499f08c0d5b8da3245ecb6136a29616b9d2ec8 /shell/ev-window.c
parent15073fb029c8fc78d7184be7bc0e70d4cbe5ac1b (diff)
downloadatril-2f89fccf54a858495101cd57bac66ffca657ff62.tar.bz2
atril-2f89fccf54a858495101cd57bac66ffca657ff62.tar.xz
shell: Use GtkApplication to inhibit the screensaver
Remove TotemScrsaver copy, and use GtkApplication inhibition instead. origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-6&id=612701f
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r--shell/ev-window.c40
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;