]> git.sesse.net Git - vlc/commitdiff
Use inhibit plugin
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 17 Oct 2009 18:12:44 +0000 (21:12 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 17 Oct 2009 18:41:35 +0000 (21:41 +0300)
TODO:
 - only inhibit screen saver when input is *not* paused.

src/video_output/window.c

index 503006b189edb6e0ee7883233c7b2466e7ca13b7..7fb66141f130b245ff7904ca81e685a684960c16 100644 (file)
 
 #include <vlc_common.h>
 #include <vlc_vout_window.h>
+#include "inhibit.h"
 #include <libvlc.h>
 
 typedef struct
 {
     vout_window_t wnd;
     module_t *module;
+    vlc_inhibit_t *inhibit;
 } window_t;
 
 vout_window_t *vout_window_New(vlc_object_t *obj,
@@ -72,6 +74,15 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
         vlc_object_release(window);
         return NULL;
     }
+
+    /* Hook for screensaver inhibition */
+    if (cfg->type == VOUT_WINDOW_TYPE_XID) {
+        w->inhibit = vlc_inhibit_Create (VLC_OBJECT (window),
+                                         window->handle.xid);
+        if (w->inhibit != NULL)
+            vlc_inhibit_Set (w->inhibit, true);
+            /* FIXME: ^ wait for vout activation, pause */
+    }
     return window;
 }
 
@@ -81,6 +92,8 @@ void vout_window_Delete(vout_window_t *window)
         return;
 
     window_t *w = (window_t *)window;
+    if (w->inhibit)
+        vlc_inhibit_Destroy (w->inhibit);
     vlc_object_detach(window);
 
     module_unneed(window, w->module);