diff options
author | Thomas White <taw@physics.org> | 2018-01-19 21:54:53 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-01-19 22:30:31 +0100 |
commit | 3ded4e93cb9657c4cdb0a86bce6d18b98f00d087 (patch) | |
tree | 2e43517e2a0f73c95597626a49215761cc3b726f /src/slideshow.c | |
parent | 62bc4fb111b38e8d3969451462d3c5e08b086c35 (diff) |
Inhibit screensaver using native GTK method
Diffstat (limited to 'src/slideshow.c')
-rw-r--r-- | src/slideshow.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/slideshow.c b/src/slideshow.c index e0d33bb..596b3ff 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -34,7 +34,6 @@ #include "presentation.h" #include "render.h" #include "pr_clock.h" -#include "inhibit_screensaver.h" #include "frame.h" G_DEFINE_TYPE_WITH_CODE(SCSlideshow, sc_slideshow, GTK_TYPE_WINDOW, NULL) @@ -87,6 +86,9 @@ static gint ss_destroy_sig(GtkWidget *widget, SCSlideshow *ss) if ( ss->surface != NULL ) { cairo_surface_destroy(ss->surface); } + if ( ss->app != NULL ) { + gtk_application_uninhibit(ss->app, ss->inhibit_cookie); + } return FALSE; } @@ -167,7 +169,7 @@ void sc_slideshow_set_slide(SCSlideshow *ss, SCBlock *ns) } -SCSlideshow *sc_slideshow_new(struct presentation *p) +SCSlideshow *sc_slideshow_new(struct presentation *p, GtkApplication *app) { GdkDisplay *display; int n_monitors; @@ -182,10 +184,6 @@ SCSlideshow *sc_slideshow_new(struct presentation *p) ss->blank_cursor = NULL; ss->surface = NULL; - if ( ss->inhibit == NULL ) { - ss->inhibit = inhibit_prepare(); - } - ss->drawingarea = gtk_drawing_area_new(); gtk_container_add(GTK_CONTAINER(ss), ss->drawingarea); @@ -227,7 +225,12 @@ SCSlideshow *sc_slideshow_new(struct presentation *p) ss->linked = 1; - if ( ss->inhibit != NULL ) do_inhibit(ss->inhibit, 1); + if ( app != NULL ) { + ss->inhibit_cookie = gtk_application_inhibit(app, GTK_WINDOW(ss), + GTK_APPLICATION_INHIBIT_IDLE, + "Presentation slide show is running"); + ss->app = app; + } return ss; } |