#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,
const char *type;
switch (cfg->type) {
+#ifdef WIN32
case VOUT_WINDOW_TYPE_HWND:
type = "vout window hwnd";
+ window->handle.hwnd = NULL;
break;
+#endif
case VOUT_WINDOW_TYPE_XID:
type = "vout window xid";
+ window->handle.xid = 0;
+ window->display.x11 = NULL;
break;
default:
assert(0);
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 ( 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;
}
return;
window_t *w = (window_t *)window;
- vlc_object_detach(window);
+ if (w->inhibit)
+ vlc_inhibit_Destroy (w->inhibit);
module_unneed(window, w->module);