summaryrefslogtreecommitdiff
path: root/src/eom-window.c
diff options
context:
space:
mode:
authorFelix Riemann <[email protected]>2012-09-23 17:50:02 +0200
committerraveit65 <[email protected]>2018-07-08 12:19:44 +0200
commit4817ee9e8d7f9d854870aa10085f3b6f1da3eadf (patch)
tree9ce442ddbe53e0543676323043401874c5b9e437 /src/eom-window.c
parent9e687fad2c7fc2a874c41090ad3a9ba8dc7b2c4e (diff)
downloadeom-4817ee9e8d7f9d854870aa10085f3b6f1da3eadf.tar.bz2
eom-4817ee9e8d7f9d854870aa10085f3b6f1da3eadf.tar.xz
Use GtkApplication to inhibit the screensaver during slideshows
Realized in a similar fashion as in Evince and Totem. https://bugzilla.gnome.org/show_bug.cgi?id=684581 origin commit: https://gitlab.gnome.org/GNOME/eog/commit/e8b50ab
Diffstat (limited to 'src/eom-window.c')
-rw-r--r--src/eom-window.c39
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),