]> git.sesse.net Git - vlc/blobdiff - src/video_output/window.c
Merge branch 'master' of git://git.videolan.org/vlc
[vlc] / src / video_output / window.c
index 7fb66141f130b245ff7904ca81e685a684960c16..e5f4c25bead61daf2b805fade7f35999150207bf 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <vlc_common.h>
 #include <vlc_vout_window.h>
+#include <vlc_modules.h>
 #include "inhibit.h"
 #include <libvlc.h>
 
@@ -58,11 +59,22 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
 
     const char *type;
     switch (cfg->type) {
+#ifdef WIN32
     case VOUT_WINDOW_TYPE_HWND:
         type = "vout window hwnd";
+        window->handle.hwnd = NULL;
         break;
+#endif
+#ifdef __APPLE__
+    case VOUT_WINDOW_TYPE_NSOBJECT:
+        type = "vout window nsobject";
+        window->handle.nsobject = NULL;
+        break;
+#endif
     case VOUT_WINDOW_TYPE_XID:
         type = "vout window xid";
+        window->handle.xid = 0;
+        window->display.x11 = NULL;
         break;
     default:
         assert(0);
@@ -70,19 +82,20 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
 
     w->module = module_need(window, type, module, module && *module != '\0');
     if (!w->module) {
-        vlc_object_detach(window);
         vlc_object_release(window);
         return NULL;
     }
 
     /* Hook for screensaver inhibition */
-    if (cfg->type == VOUT_WINDOW_TYPE_XID) {
+    if ( var_InheritBool( obj, "disable-screensaver" ) && 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 */
     }
+    else
+        w->inhibit = NULL;
     return window;
 }
 
@@ -94,7 +107,6 @@ void vout_window_Delete(vout_window_t *window)
     window_t *w = (window_t *)window;
     if (w->inhibit)
         vlc_inhibit_Destroy (w->inhibit);
-    vlc_object_detach(window);
 
     module_unneed(window, w->module);