union {
void *hwnd; /* Win32 window handle */
uint32_t xid; /* X11 windows ID */
- };
+ } handle;
/* display server (mandatory) */
union {
while ((intf = wnd_req.intf) == NULL)
vlc_cond_wait (&wnd_req.wait, &wnd_req.lock);
- wnd->xid = request_video( intf, vout );
+ wnd->handle.xid = request_video( intf, vout );
vlc_mutex_unlock (&wnd_req.lock);
vlc_object_release( vout );
- if (!wnd->xid)
+ if (!wnd->handle.xid)
return VLC_EGENERIC;
- msg_Dbg( intf, "Using handle %"PRIu32, wnd->xid );
+ msg_Dbg( intf, "Using handle %"PRIu32, wnd->handle.xid );
wnd->control = ControlWindow;
wnd->sys = (vout_window_sys_t*)intf;
unsigned i_height = p_wnd->cfg->height;
#if defined (Q_WS_X11)
- p_wnd->xid = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
- if( !p_wnd->xid )
+ p_wnd->handle.xid = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
+ if( !p_wnd->handle.xid )
return VLC_EGENERIC;
p_wnd->x11_display = x11_display;
#elif defined (Q_WS_WIN)
- p_wnd->hwnd = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
- if( !p_wnd->hwnd )
+ p_wnd->handle.hwnd = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
+ if( !p_wnd->handle.hwnd )
return VLC_EGENERIC;
#else
# error FIXME
vlc_mutex_lock( &serializer );
- pWnd->hwnd = VoutManager::getWindow( pIntf, pWnd );
+ pWnd->handle.hwnd = VoutManager::getWindow( pIntf, pWnd );
- if( pWnd->hwnd )
+ if( pWnd->handle.hwnd )
{
pWnd->control = &VoutManager::controlWindow;
pWnd->sys = (vout_window_sys_t*)pIntf;
if (val == NULL)
return VLC_EGENERIC;
- wnd->hwnd = val;
+ wnd->handle.hwnd = val;
wnd->control = Control;
wnd->sys = val;
return VLC_SUCCESS;
/* If an external window was specified, we'll draw in it. */
p_event->parent_window = vout_display_NewWindow(vd, &p_event->wnd_cfg );
if( p_event->parent_window )
- p_event->hparent = p_event->parent_window->hwnd;
+ p_event->hparent = p_event->parent_window->handle.hwnd;
else
p_event->hparent = NULL;
#ifdef MODULE_NAME_IS_direct3d
xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask
| VisibilityChangeMask;
p_sys->window = XCreateWindow( p_sys->p_display,
- p_sys->owner_window->xid,
+ p_sys->owner_window->handle.xid,
0, 0,
p_sys->main_window.i_width,
p_sys->main_window.i_height,
&xwindow_attributes );
XMapWindow( p_sys->p_display, p_sys->window );
- XSelectInput( p_sys->p_display, p_sys->owner_window->xid,
+ XSelectInput( p_sys->p_display, p_sys->owner_window->handle.xid,
StructureNotifyMask );
}
goto error;
*pconn = conn;
- *pscreen = FindWindow (VLC_OBJECT(vd), conn, wnd->xid, pdepth);
+ *pscreen = FindWindow (VLC_OBJECT(vd), conn, wnd->handle.xid, pdepth);
if (*pscreen == NULL)
{
xcb_disconnect (conn);
goto error;
}
- RegisterMouseEvents (VLC_OBJECT(vd), conn, wnd->xid);
+ RegisterMouseEvents (VLC_OBJECT(vd), conn, wnd->handle.xid);
return wnd;
error:
int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
unsigned *restrict width, unsigned *restrict height)
{
- xcb_get_geometry_cookie_t ck = xcb_get_geometry (conn, wnd->xid);
+ xcb_get_geometry_cookie_t ck = xcb_get_geometry (conn, wnd->handle.xid);
xcb_get_geometry_reply_t *geo = xcb_get_geometry_reply (conn, ck, NULL);
if (!geo)
xcb_get_geometry_reply_t *geo =
xcb_get_geometry_reply (conn,
- xcb_get_geometry (conn, sys->embed->xid), NULL);
+ xcb_get_geometry (conn, sys->embed->handle.xid), NULL);
if (geo == NULL)
{
msg_Err (vd, "parent window not valid");
xcb_void_cookie_t cc, cm;
cc = xcb_create_window_checked (conn, depth, sys->window,
- sys->embed->xid, 0, 0,
+ sys->embed->handle.xid, 0, 0,
width, height, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
vid, mask, values);
xcb_connection_t *conn = XGetXCBConnection (dpy);
assert (conn);
- RegisterMouseEvents (obj, conn, sys->embed->xid);
+ RegisterMouseEvents (obj, conn, sys->embed->handle.xid);
/* Find window parameters */
unsigned snum;
xcb_get_window_attributes_reply_t *wa =
xcb_get_window_attributes_reply (conn,
- xcb_get_window_attributes (conn, sys->embed->xid), NULL);
+ xcb_get_window_attributes (conn, sys->embed->handle.xid),
+ NULL);
if (wa == NULL)
goto error;
xcb_visualid_t visual = wa->visual;
* vout_display_t::info.b_hide_mouse is false */
case VOUT_DISPLAY_HIDE_MOUSE:
xcb_change_window_attributes (XGetXCBConnection (sys->display),
- sys->embed->xid,
+ sys->embed->handle.xid,
XCB_CW_CURSOR, &(uint32_t){ sys->cursor });
return VLC_SUCCESS;
goto error;
}
- wnd->xid = window;
+ wnd->handle.xid = window;
wnd->x11_display = display;
wnd->control = Control;
wnd->sys = p_sys;
#ifdef MATCHBOX_HACK
if (p_sys->mb_current_app_window)
xcb_set_input_focus (p_sys->conn, XCB_INPUT_FOCUS_POINTER_ROOT,
- wnd->xid, XCB_CURRENT_TIME);
+ wnd->handle.xid, XCB_CURRENT_TIME);
#endif
xcb_flush (conn); /* Make sure map_window is sent (should be useless) */
return VLC_SUCCESS;
xcb_get_property (conn, 0, pne->window, pne->atom,
XA_WINDOW, 0, 4), NULL);
if (r != NULL
- && !memcmp (xcb_get_property_value (r), &wnd->xid,
+ && !memcmp (xcb_get_property_value (r), &wnd->handle.xid,
4))
{
msg_Dbg (wnd, "asking Matchbox for input focus");
xcb_set_input_focus (conn,
XCB_INPUT_FOCUS_POINTER_ROOT,
- wnd->xid, pne->time);
+ wnd->handle.xid, pne->time);
xcb_flush (conn);
}
free (r);
xcb_client_message_event_t ev = {
.response_type = XCB_CLIENT_MESSAGE,
.format = 32,
- .window = wnd->xid,
+ .window = wnd->handle.xid,
.type = sys->wm_state,
};
unsigned height = va_arg (ap, unsigned);
const uint32_t values[] = { width, height, };
- xcb_configure_window (conn, wnd->xid,
+ xcb_configure_window (conn, wnd->handle.xid,
XCB_CONFIG_WINDOW_WIDTH |
XCB_CONFIG_WINDOW_HEIGHT, values);
break;
if (p_sys == NULL || xcb_connection_has_error (conn))
goto error;
- wnd->xid = window;
+ wnd->handle.xid = window;
wnd->control = Control;
wnd->sys = p_sys;
static void EmClose (vlc_object_t *obj)
{
vout_window_t *wnd = (vout_window_t *)obj;
- xcb_window_t window = wnd->xid;
+ xcb_window_t window = wnd->handle.xid;
Close (obj);
ReleaseDrawable (obj, window);
c = xcb_create_window_checked (p_sys->conn, p_sys->depth,
p_sys->window,
- p_sys->embed->xid, 0, 0,
+ p_sys->embed->handle.xid, 0, 0,
width, height, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
vid, mask, values);
/* Hide the mouse. It will be send when
* vout_display_t::info.b_hide_mouse is false */
case VOUT_DISPLAY_HIDE_MOUSE:
- xcb_change_window_attributes (p_sys->conn, p_sys->embed->xid,
+ xcb_change_window_attributes (p_sys->conn, p_sys->embed->handle.xid,
XCB_CW_CURSOR, &(uint32_t){ p_sys->cursor });
return VLC_SUCCESS;
/* Cache adaptors infos */
xcb_xv_query_adaptors_reply_t *adaptors =
xcb_xv_query_adaptors_reply (conn,
- xcb_xv_query_adaptors (conn, p_sys->embed->xid), NULL);
+ xcb_xv_query_adaptors (conn, p_sys->embed->handle.xid), NULL);
if (adaptors == NULL)
goto error;
xcb_void_cookie_t c;
c = xcb_create_window_checked (conn, f->depth, p_sys->window,
- p_sys->embed->xid, 0, 0, 1, 1, 0,
+ p_sys->embed->handle.xid, 0, 0, 1, 1, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT, f->visual,
XCB_CW_EVENT_MASK, &mask);
/* Hide the mouse. It will be send when
* vout_display_t::info.b_hide_mouse is false */
case VOUT_DISPLAY_HIDE_MOUSE:
- xcb_change_window_attributes (p_sys->conn, p_sys->embed->xid,
+ xcb_change_window_attributes (p_sys->conn, p_sys->embed->handle.xid,
XCB_CW_CURSOR, &(uint32_t){ p_sys->cursor });
return VLC_SUCCESS;
case VOUT_DISPLAY_RESET_PICTURES:
vout_window_t *window = &w->wnd;
window->cfg = cfg;
+ memset(&window->handle, 0, sizeof(window->handle));
window->control = NULL;
window->sys = NULL;
#ifdef WIN32
case VOUT_WINDOW_TYPE_HWND:
type = "vout window hwnd";
- window->hwnd = NULL;
break;
#endif
case VOUT_WINDOW_TYPE_XID:
type = "vout window xid";
- window->xid = 0;
+ window->handle.xid = 0;
window->x11_display = NULL;
break;
default:
/* Hook for screensaver inhibition */
if (cfg->type == VOUT_WINDOW_TYPE_XID) {
w->inhibit = vlc_inhibit_Create (VLC_OBJECT (window),
- window->xid);
+ window->handle.xid);
if (w->inhibit != NULL)
vlc_inhibit_Set (w->inhibit, true);
/* FIXME: ^ wait for vout activation, pause */