1 /*****************************************************************************
2 * window.c: "vout window" managment
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
7 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
32 #include <vlc_common.h>
33 #include <vlc_vout_window.h>
41 vlc_inhibit_t *inhibit;
44 vout_window_t *vout_window_New(vlc_object_t *obj,
46 const vout_window_cfg_t *cfg)
48 static char const name[] = "window";
49 window_t *w = vlc_custom_create(obj, sizeof(*w), VLC_OBJECT_GENERIC, name);
50 vout_window_t *window = &w->wnd;
53 window->control = NULL;
56 vlc_object_attach(window, obj);
60 case VOUT_WINDOW_TYPE_HWND:
61 type = "vout window hwnd";
64 case VOUT_WINDOW_TYPE_XID:
65 type = "vout window xid";
72 w->module = module_need(window, type, module, module && *module != '\0');
74 vlc_object_detach(window);
75 vlc_object_release(window);
79 /* Hook for screensaver inhibition */
80 if (cfg->type == VOUT_WINDOW_TYPE_XID) {
81 w->inhibit = vlc_inhibit_Create (VLC_OBJECT (window),
83 if (w->inhibit != NULL)
84 vlc_inhibit_Set (w->inhibit, true);
85 /* FIXME: ^ wait for vout activation, pause */
92 void vout_window_Delete(vout_window_t *window)
97 window_t *w = (window_t *)window;
99 vlc_inhibit_Destroy (w->inhibit);
100 vlc_object_detach(window);
102 module_unneed(window, w->module);
104 vlc_object_release(window);
107 int vout_window_Control(vout_window_t *window, int query, ...)
110 va_start(args, query);
111 int ret = window->control(window, query, args);