Commit c759006f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Partially cleanup the vout_window API

parent a57a0364
...@@ -512,7 +512,6 @@ struct vout_thread_t ...@@ -512,7 +512,6 @@ struct vout_thread_t
unsigned int i_window_height; /**< video window height */ unsigned int i_window_height; /**< video window height */
unsigned int i_alignment; /**< video alignment in window */ unsigned int i_alignment; /**< video alignment in window */
struct vout_window_t *p_window; /**< window for embedded vout (if any) */
/**@}*/ /**@}*/
/** \name Plugin used and shortcuts to access its capabilities */ /** \name Plugin used and shortcuts to access its capabilities */
...@@ -670,9 +669,6 @@ VLC_EXPORT( void, vout_UnlinkPicture, ( vout_thread_t *, picture_t * ...@@ -670,9 +669,6 @@ VLC_EXPORT( void, vout_UnlinkPicture, ( vout_thread_t *, picture_t *
VLC_EXPORT( void, vout_PlacePicture, ( vout_thread_t *, unsigned int, unsigned int, unsigned int *, unsigned int *, unsigned int *, unsigned int * ) ); VLC_EXPORT( void, vout_PlacePicture, ( vout_thread_t *, unsigned int, unsigned int, unsigned int *, unsigned int *, unsigned int *, unsigned int * ) );
VLC_EXPORT( int, vout_vaControlDefault, ( vout_thread_t *, int, va_list ) ); VLC_EXPORT( int, vout_vaControlDefault, ( vout_thread_t *, int, va_list ) );
VLC_EXPORT( void *, vout_RequestWindow, ( vout_thread_t *, int *, int *, unsigned int *, unsigned int * ) );
VLC_EXPORT( void, vout_ReleaseWindow, ( vout_thread_t *, void * ) );
VLC_EXPORT( int, vout_ControlWindow, ( vout_thread_t *, void *, int, va_list ) );
void vout_IntfInit( vout_thread_t * ); void vout_IntfInit( vout_thread_t * );
VLC_EXPORT( int, vout_Snapshot, ( vout_thread_t *p_vout, picture_t *p_pic ) ); VLC_EXPORT( int, vout_Snapshot, ( vout_thread_t *p_vout, picture_t *p_pic ) );
VLC_EXPORT( void, vout_EnableFilter, ( vout_thread_t *, char *,bool , bool ) ); VLC_EXPORT( void, vout_EnableFilter, ( vout_thread_t *, char *,bool , bool ) );
......
...@@ -46,4 +46,8 @@ struct vout_window_t ...@@ -46,4 +46,8 @@ struct vout_window_t
int (*control) (struct vout_window_t *, int, va_list); int (*control) (struct vout_window_t *, int, va_list);
}; };
VLC_EXPORT( vout_window_t *, vout_RequestWindow, ( vout_thread_t *, int *, int *, unsigned int *, unsigned int * ) );
VLC_EXPORT( void, vout_ReleaseWindow, ( vout_window_t * ) );
VLC_EXPORT( int, vout_ControlWindow, ( vout_window_t *, int, va_list ) );
#endif /* !LIBVLCCORE_WINDOW_H */ #endif /* !LIBVLCCORE_WINDOW_H */
...@@ -1021,7 +1021,7 @@ static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout, ...@@ -1021,7 +1021,7 @@ static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout,
vout_OSDMessage( p_input, POSITION_TEXT_CHAN, psz_time ); vout_OSDMessage( p_input, POSITION_TEXT_CHAN, psz_time );
} }
if( !p_vout->p_window || p_vout->b_fullscreen ) if( p_vout->b_fullscreen )
{ {
var_Get( p_input, "position", &pos ); var_Get( p_input, "position", &pos );
vout_OSDSlider( VLC_OBJECT( p_input ), POSITION_WIDGET_CHAN, vout_OSDSlider( VLC_OBJECT( p_input ), POSITION_WIDGET_CHAN,
...@@ -1038,7 +1038,7 @@ static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout, ...@@ -1038,7 +1038,7 @@ static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout,
} }
ClearChannels( p_intf, p_vout ); ClearChannels( p_intf, p_vout );
if( !p_vout->p_window || p_vout->b_fullscreen ) if( p_vout->b_fullscreen )
{ {
vout_OSDSlider( VLC_OBJECT( p_vout ), VOLUME_WIDGET_CHAN, vout_OSDSlider( VLC_OBJECT( p_vout ), VOLUME_WIDGET_CHAN,
i_vol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER ); i_vol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_window.h>
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
...@@ -64,7 +65,7 @@ ...@@ -64,7 +65,7 @@
//WINSHELLAPI BOOL WINAPI SHFullScreen(HWND hwndRequester, DWORD dwState); //WINSHELLAPI BOOL WINAPI SHFullScreen(HWND hwndRequester, DWORD dwState);
#endif #endif
/*#if defined(UNDER_CE) && !defined(__PLUGIN__) /*FIXME*/ /*#if defined(UNDER_CE) && !defined(__PLUGIN__) --FIXME*/
/*# define SHFS_SHOWSIPBUTTON 0x0004 /*# define SHFS_SHOWSIPBUTTON 0x0004
# define SHFS_HIDESIPBUTTON 0x0008 # define SHFS_HIDESIPBUTTON 0x0008
# define MENU_HEIGHT 26 # define MENU_HEIGHT 26
...@@ -80,6 +81,7 @@ static void DirectXCloseWindow ( vout_thread_t *p_vout ); ...@@ -80,6 +81,7 @@ static void DirectXCloseWindow ( vout_thread_t *p_vout );
static long FAR PASCAL DirectXEventProc( HWND, UINT, WPARAM, LPARAM ); static long FAR PASCAL DirectXEventProc( HWND, UINT, WPARAM, LPARAM );
static int Control( vout_thread_t *p_vout, int i_query, va_list args ); static int Control( vout_thread_t *p_vout, int i_query, va_list args );
static int vaControlParentWindow( vout_thread_t *, int, va_list );
static void DirectXPopupMenu( event_thread_t *p_event, bool b_open ) static void DirectXPopupMenu( event_thread_t *p_event, bool b_open )
{ {
...@@ -416,11 +418,12 @@ static int DirectXCreateWindow( vout_thread_t *p_vout ) ...@@ -416,11 +418,12 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
hInstance = GetModuleHandle(NULL); hInstance = GetModuleHandle(NULL);
/* If an external window was specified, we'll draw in it. */ /* If an external window was specified, we'll draw in it. */
p_vout->p_sys->hparent = p_vout->p_sys->parent_window =
vout_RequestWindow( p_vout, &p_vout->p_sys->i_window_x, vout_RequestWindow( p_vout, &p_vout->p_sys->i_window_x,
&p_vout->p_sys->i_window_y, &p_vout->p_sys->i_window_y,
&p_vout->p_sys->i_window_width, &p_vout->p_sys->i_window_width,
&p_vout->p_sys->i_window_height ); &p_vout->p_sys->i_window_height );
p_vout->p_sys->hparent = p_vout->p_sys->parent_window->handle;
/* We create the window ourself, there is no previous window proc. */ /* We create the window ourself, there is no previous window proc. */
p_vout->p_sys->pf_wndproc = NULL; p_vout->p_sys->pf_wndproc = NULL;
...@@ -598,9 +601,7 @@ static void DirectXCloseWindow( vout_thread_t *p_vout ) ...@@ -598,9 +601,7 @@ static void DirectXCloseWindow( vout_thread_t *p_vout )
DestroyWindow( p_vout->p_sys->hwnd ); DestroyWindow( p_vout->p_sys->hwnd );
if( p_vout->p_sys->hfswnd ) DestroyWindow( p_vout->p_sys->hfswnd ); if( p_vout->p_sys->hfswnd ) DestroyWindow( p_vout->p_sys->hfswnd );
if( p_vout->p_sys->hparent ) vout_ReleaseWindow( p_vout->p_sys->parent_window );
vout_ReleaseWindow( p_vout, (void *)p_vout->p_sys->hparent );
p_vout->p_sys->hwnd = NULL; p_vout->p_sys->hwnd = NULL;
/* We don't unregister the Window Class because it could lead to race /* We don't unregister the Window Class because it could lead to race
...@@ -1044,9 +1045,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -1044,9 +1045,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
switch( i_query ) switch( i_query )
{ {
case VOUT_GET_SIZE: case VOUT_GET_SIZE:
if( p_vout->p_sys->hparent ) if( p_vout->p_sys->parent_window )
return vout_ControlWindow( p_vout, return vaControlParentWindow( p_vout, i_query, args );
(void *)p_vout->p_sys->hparent, i_query, args );
pi_width = va_arg( args, unsigned int * ); pi_width = va_arg( args, unsigned int * );
pi_height = va_arg( args, unsigned int * ); pi_height = va_arg( args, unsigned int * );
...@@ -1058,9 +1058,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -1058,9 +1058,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
return VLC_SUCCESS; return VLC_SUCCESS;
case VOUT_SET_SIZE: case VOUT_SET_SIZE:
if( p_vout->p_sys->hparent ) if( p_vout->p_sys->parent_window )
return vout_ControlWindow( p_vout, return vaControlParentWindow( p_vout, i_query, args );
(void *)p_vout->p_sys->hparent, i_query, args );
/* Update dimensions */ /* Update dimensions */
rect_window.top = rect_window.left = 0; rect_window.top = rect_window.left = 0;
...@@ -1121,12 +1120,12 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -1121,12 +1120,12 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
SWP_FRAMECHANGED ); SWP_FRAMECHANGED );
} }
return vout_vaControlDefault( p_vout, i_query, args ); vout_ReleaseWindow( p_vout->p_sys->parent_window );
return VLC_SUCCESS;
case VOUT_SET_STAY_ON_TOP: case VOUT_SET_STAY_ON_TOP:
if( p_vout->p_sys->hparent && !var_GetBool( p_vout, "fullscreen" ) ) if( p_vout->p_sys->hparent && !var_GetBool( p_vout, "fullscreen" ) )
return vout_ControlWindow( p_vout, return vaControlParentWindow( p_vout, i_query, args );
(void *)p_vout->p_sys->hparent, i_query, args );
p_vout->p_sys->b_on_top_change = true; p_vout->p_sys->b_on_top_change = true;
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -1165,13 +1164,21 @@ static void SetWindowState(HWND hwnd, int nShowCmd,WINDOWPLACEMENT window_placem ...@@ -1165,13 +1164,21 @@ static void SetWindowState(HWND hwnd, int nShowCmd,WINDOWPLACEMENT window_placem
} }
/* Internal wrapper to call vout_ControlWindow for hparent */ /* Internal wrapper to call vout_ControlWindow for hparent */
static void ControlParentWindow( vout_thread_t *p_vout, int i_query, ... ) static int vaControlParentWindow( vout_thread_t *p_vout, int i_query,
va_list args )
{
return vout_ControlWindow( p_vout->p_sys->parent_window, i_query, args );
}
static int ControlParentWindow( vout_thread_t *p_vout, int i_query, ... )
{ {
va_list args; va_list args;
int ret;
va_start( args, i_query ); va_start( args, i_query );
vout_ControlWindow( p_vout, ret = vaControlParentWindow( p_vout, i_query, args );
(void *)p_vout->p_sys->hparent, i_query, args );
va_end( args ); va_end( args );
return ret;
} }
void Win32ToggleFullscreen( vout_thread_t *p_vout ) void Win32ToggleFullscreen( vout_thread_t *p_vout )
......
...@@ -68,6 +68,8 @@ typedef struct event_thread_t ...@@ -68,6 +68,8 @@ typedef struct event_thread_t
#endif #endif
struct vout_window_t;
/***************************************************************************** /*****************************************************************************
* vout_sys_t: video output method descriptor * vout_sys_t: video output method descriptor
***************************************************************************** *****************************************************************************
...@@ -78,6 +80,7 @@ struct vout_sys_t ...@@ -78,6 +80,7 @@ struct vout_sys_t
{ {
HWND hwnd; /* Handle of the main window */ HWND hwnd; /* Handle of the main window */
HWND hvideownd; /* Handle of the video sub-window */ HWND hvideownd; /* Handle of the video sub-window */
struct vout_window_t *parent_window; /* Parent window VLC object */
HWND hparent; /* Handle of the parent window */ HWND hparent; /* Handle of the parent window */
HWND hfswnd; /* Handle of the fullscreen window */ HWND hfswnd; /* Handle of the fullscreen window */
WNDPROC pf_wndproc; /* Window handling callback */ WNDPROC pf_wndproc; /* Window handling callback */
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_keys.h> #include <vlc_keys.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_window.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
/***************************************************************************** /*****************************************************************************
...@@ -160,7 +161,7 @@ struct vout_sys_t ...@@ -160,7 +161,7 @@ struct vout_sys_t
/* X11 */ /* X11 */
Display *p_display; Display *p_display;
Window owner_window; vout_window_t *owner_window;
Window window; Window window;
mtime_t i_time_button_last_pressed; /* To detect double click */ mtime_t i_time_button_last_pressed; /* To detect double click */
...@@ -243,7 +244,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -243,7 +244,7 @@ static void Destroy( vlc_object_t *p_this )
if( p_vout->p_sys->b_embed ) if( p_vout->p_sys->b_embed )
{ {
vout_ReleaseWindow( p_vout, (void *)p_vout->p_sys->owner_window ); vout_ReleaseWindow( p_vout->p_sys->owner_window );
if( p_vout->b_fullscreen ) if( p_vout->b_fullscreen )
XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window ); XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
XCloseDisplay( p_vout->p_sys->p_display ); XCloseDisplay( p_vout->p_sys->p_display );
...@@ -374,6 +375,10 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -374,6 +375,10 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
{ {
switch( i_query ) switch( i_query )
{ {
case VOUT_REPARENT:
case VOUT_CLOSE:
vout_ReleaseWindow( p_vout->p_sys->owner_window );
return VLC_SUCCESS;
default: default:
return vout_vaControlDefault( p_vout, i_query, args ); return vout_vaControlDefault( p_vout, i_query, args );
} }
...@@ -696,7 +701,7 @@ static void CreateWindow( vout_sys_t *p_sys ) ...@@ -696,7 +701,7 @@ static void CreateWindow( vout_sys_t *p_sys )
BlackPixel( p_sys->p_display, DefaultScreen(p_sys->p_display) ); BlackPixel( p_sys->p_display, DefaultScreen(p_sys->p_display) );
xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask; xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask;
p_sys->window = XCreateWindow( p_sys->p_display, p_sys->window = XCreateWindow( p_sys->p_display,
p_sys->owner_window, p_sys->owner_window->handle,
0, 0, 0, 0,
p_sys->main_window.i_width, p_sys->main_window.i_width,
p_sys->main_window.i_height, p_sys->main_window.i_height,
...@@ -709,7 +714,7 @@ static void CreateWindow( vout_sys_t *p_sys ) ...@@ -709,7 +714,7 @@ static void CreateWindow( vout_sys_t *p_sys )
XSelectInput( p_sys->p_display, p_sys->window, XSelectInput( p_sys->p_display, p_sys->window,
KeyPressMask | ButtonPressMask | StructureNotifyMask | KeyPressMask | ButtonPressMask | StructureNotifyMask |
VisibilityChangeMask | FocusChangeMask ); VisibilityChangeMask | FocusChangeMask );
XSelectInput( p_sys->p_display, p_sys->owner_window, XSelectInput( p_sys->p_display, p_sys->owner_window->handle,
StructureNotifyMask ); StructureNotifyMask );
XSetInputFocus( p_sys->p_display, p_sys->window, RevertToParent, CurrentTime ); XSetInputFocus( p_sys->p_display, p_sys->window, RevertToParent, CurrentTime );
} }
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_window.h>
#include <vlc_keys.h> #include <vlc_keys.h>
#include <errno.h> /* ENOMEM */ #include <errno.h> /* ENOMEM */
...@@ -1160,7 +1161,7 @@ static int ManageVideo( vout_thread_t *p_vout ) ...@@ -1160,7 +1161,7 @@ static int ManageVideo( vout_thread_t *p_vout )
if( p_vout->p_sys->p_win->owner_window ) if( p_vout->p_sys->p_win->owner_window )
{ {
while( XCheckWindowEvent( p_vout->p_sys->p_display, while( XCheckWindowEvent( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->owner_window, p_vout->p_sys->p_win->owner_window->handle,
StructureNotifyMask, &xevent ) == True ) StructureNotifyMask, &xevent ) == True )
{ {
/* ConfigureNotify event: prepare */ /* ConfigureNotify event: prepare */
...@@ -1621,9 +1622,8 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win ) ...@@ -1621,9 +1622,8 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
if( !p_vout->b_fullscreen ) if( !p_vout->b_fullscreen )
{ {
void *ptr = vout_RequestWindow( p_vout, &p_win->i_x, &p_win->i_y, p_win->owner_window = vout_RequestWindow( p_vout, &p_win->i_x,
&p_win->i_width, &p_win->i_height ); &p_win->i_y, &p_win->i_width, &p_win->i_height );
p_win->owner_window = (uintptr_t)ptr;
xsize_hints.base_width = xsize_hints.width = p_win->i_width; xsize_hints.base_width = xsize_hints.width = p_win->i_width;
xsize_hints.base_height = xsize_hints.height = p_win->i_height; xsize_hints.base_height = xsize_hints.height = p_win->i_height;
xsize_hints.flags = PSize | PMinSize; xsize_hints.flags = PSize | PMinSize;
...@@ -1638,7 +1638,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win ) ...@@ -1638,7 +1638,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
else else
{ {
/* Fullscreen window size and position */ /* Fullscreen window size and position */
p_win->owner_window = 0; p_win->owner_window = NULL;
p_win->i_x = p_win->i_y = 0; p_win->i_x = p_win->i_y = 0;
p_win->i_width = p_win->i_width =
DisplayWidth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen ); DisplayWidth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
...@@ -1719,11 +1719,11 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win ) ...@@ -1719,11 +1719,11 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
unsigned int dummy4, dummy5; unsigned int dummy4, dummy5;
/* Select events we are interested in. */ /* Select events we are interested in. */
XSelectInput( p_vout->p_sys->p_display, p_win->owner_window, XSelectInput( p_vout->p_sys->p_display, p_win->owner_window->handle,
StructureNotifyMask ); StructureNotifyMask );
/* Get the parent window's geometry information */ /* Get the parent window's geometry information */
XGetGeometry( p_vout->p_sys->p_display, p_win->owner_window, XGetGeometry( p_vout->p_sys->p_display, p_win->owner_window->handle,
&dummy1, &dummy2, &dummy3, &dummy1, &dummy2, &dummy3,
&p_win->i_width, &p_win->i_width,
&p_win->i_height, &p_win->i_height,
...@@ -1736,7 +1736,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win ) ...@@ -1736,7 +1736,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
* ButtonPress event, so we need to open a new window anyway. */ * ButtonPress event, so we need to open a new window anyway. */
p_win->base_window = p_win->base_window =
XCreateWindow( p_vout->p_sys->p_display, XCreateWindow( p_vout->p_sys->p_display,
p_win->owner_window, p_win->owner_window->handle,
0, 0, 0, 0,
p_win->i_width, p_win->i_height, p_win->i_width, p_win->i_height,
0, 0,
...@@ -1883,8 +1883,7 @@ static void DestroyWindow( vout_thread_t *p_vout, x11_window_t *p_win ) ...@@ -1883,8 +1883,7 @@ static void DestroyWindow( vout_thread_t *p_vout, x11_window_t *p_win )
XUnmapWindow( p_vout->p_sys->p_display, p_win->base_window ); XUnmapWindow( p_vout->p_sys->p_display, p_win->base_window );
XDestroyWindow( p_vout->p_sys->p_display, p_win->base_window ); XDestroyWindow( p_vout->p_sys->p_display, p_win->base_window );
if( p_win->owner_window ) vout_ReleaseWindow( p_win->owner_window );
vout_ReleaseWindow( p_vout, (void *)p_win->owner_window );
} }
/***************************************************************************** /*****************************************************************************
...@@ -3131,8 +3130,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -3131,8 +3130,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
{ {
case VOUT_GET_SIZE: case VOUT_GET_SIZE:
if( p_vout->p_sys->p_win->owner_window ) if( p_vout->p_sys->p_win->owner_window )
return vout_ControlWindow( p_vout, return vout_ControlWindow( p_vout->p_sys->p_win->owner_window,
(void *)p_vout->p_sys->p_win->owner_window, i_query, args); i_query, args);
pi_width = va_arg( args, unsigned int * ); pi_width = va_arg( args, unsigned int * );
pi_height = va_arg( args, unsigned int * ); pi_height = va_arg( args, unsigned int * );
...@@ -3145,8 +3144,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -3145,8 +3144,8 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
case VOUT_SET_SIZE: case VOUT_SET_SIZE:
if( p_vout->p_sys->p_win->owner_window ) if( p_vout->p_sys->p_win->owner_window )
return vout_ControlWindow( p_vout, return vout_ControlWindow( p_vout->p_sys->p_win->owner_window,
(void *)p_vout->p_sys->p_win->owner_window, i_query, args); i_query, args);
vlc_mutex_lock( &p_vout->p_sys->lock ); vlc_mutex_lock( &p_vout->p_sys->lock );
...@@ -3193,17 +3192,18 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -3193,17 +3192,18 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
p_vout->p_sys->original_window.base_window, p_vout->p_sys->original_window.base_window,
d, 0, 0); d, 0, 0);
XSync( p_vout->p_sys->p_display, False ); XSync( p_vout->p_sys->p_display, False );
p_vout->p_sys->original_window.owner_window = 0;
#ifdef MODULE_NAME_IS_xvmc #ifdef MODULE_NAME_IS_xvmc
xvmc_context_reader_unlock( &p_vout->p_sys->xvmc_lock ); xvmc_context_reader_unlock( &p_vout->p_sys->xvmc_lock );
#endif #endif
vlc_mutex_unlock( &p_vout->p_sys->lock ); vlc_mutex_unlock( &p_vout->p_sys->lock );
return vout_vaControlDefault( p_vout, i_query, args ); vout_ReleaseWindow( p_vout->p_sys->p_win->owner_window );
p_vout->p_sys->original_window.owner_window = NULL;
return VLC_SUCCESS;
case VOUT_SET_STAY_ON_TOP: case VOUT_SET_STAY_ON_TOP:
if( p_vout->p_sys->p_win->owner_window ) if( p_vout->p_sys->p_win->owner_window )
return vout_ControlWindow( p_vout, return vout_ControlWindow( p_vout->p_sys->p_win->owner_window,
(void *)p_vout->p_sys->p_win->owner_window, i_query, args); i_query, args);
b_arg = (bool) va_arg( args, int ); b_arg = (bool) va_arg( args, int );
vlc_mutex_lock( &p_vout->p_sys->lock ); vlc_mutex_lock( &p_vout->p_sys->lock );
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include <libosso.h> #include <libosso.h>
#endif #endif
struct vout_window_t;
/***************************************************************************** /*****************************************************************************
* x11_window_t: X11 window descriptor * x11_window_t: X11 window descriptor
...@@ -63,7 +64,7 @@ ...@@ -63,7 +64,7 @@
*****************************************************************************/ *****************************************************************************/
typedef struct x11_window_t typedef struct x11_window_t
{ {
Window owner_window; /* owner window (if any) */ struct vout_window_t*owner_window; /* owner window (if any) */
Window base_window; /* base window */ Window base_window; /* base window */
Window video_window; /* sub-window for displaying video */ Window video_window; /* sub-window for displaying video */
GC gc; /* graphic context instance handler */ GC gc; /* graphic context instance handler */
......
...@@ -385,7 +385,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) ...@@ -385,7 +385,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
p_vout->p->b_paused = false; p_vout->p->b_paused = false;
p_vout->p->i_pause_date = 0; p_vout->p->i_pause_date = 0;
p_vout->pf_control = NULL; p_vout->pf_control = NULL;
p_vout->p_window = NULL;
p_vout->p->i_par_num = p_vout->p->i_par_num =
p_vout->p->i_par_den = 1; p_vout->p->i_par_den = 1;
p_vout->p->p_picture_displayed = NULL; p_vout->p->p_picture_displayed = NULL;
......
...@@ -81,30 +81,25 @@ static int TitlePositionCallback( vlc_object_t *, char const *, ...@@ -81,30 +81,25 @@ static int TitlePositionCallback( vlc_object_t *, char const *,
/** /**
* Creates a video output window. * Creates a video output window.
* On Unix systems, this returns an X11 drawable handle. * On Unix systems, this is an X11 drawable (handle).
* On Windows, this returns a Win32 window handle. * On Windows, this is a Win32 window (handle).
* Video output plugins are supposed to called this function and display the * Video output plugins are supposed to called this function and display the
* video within the resulting window, while in windowed mode. * video within the resulting window, while in windowed mode.
* *
* Note that a given video output thread must not allocate more than one
* such window at a time.
*
* @param p_vout video output thread to create a window for * @param p_vout video output thread to create a window for
* @param pi_x_hint pointer to store the recommended horizontal position [OUT] * @param pi_x_hint pointer to store the recommended horizontal position [OUT]
* @param pi_y_hint pointer to store the recommended vertical position [OUT] * @param pi_y_hint pointer to store the recommended vertical position [OUT]
* @param pi_width_hint pointer to store the recommended width [OUT] * @param pi_width_hint pointer to store the recommended width [OUT]
* @param pi_height_hint pointer to store the recommended height [OUT] * @param pi_height_hint pointer to store the recommended height [OUT]
* *
* @return a platform-specific window handle, or NULL in case of failure. * @return a vout_window_t object, or NULL in case of failure.
* In case of success, the handle is released with vout_ReleaseWindow(). * The window is released with vout_ReleaseWindow().
*/ */
void *vout_RequestWindow( vout_thread_t *p_vout, vout_window_t *vout_RequestWindow( vout_thread_t *p_vout,
int *pi_x_hint, int *pi_y_hint, int *pi_x_hint, int *pi_y_hint,
unsigned int *pi_width_hint, unsigned int *pi_width_hint,
unsigned int *pi_height_hint ) unsigned int *pi_height_hint )
{ {
assert (p_vout->p_window == NULL);
/* Get requested coordinates */ /* Get requested coordinates */
*pi_x_hint = var_GetInteger( p_vout, "video-x" ); *pi_x_hint = var_GetInteger( p_vout, "video-x" );
*pi_y_hint = var_GetInteger( p_vout, "video-y" ); *pi_y_hint = var_GetInteger( p_vout, "video-y" );
...@@ -135,40 +130,31 @@ void *vout_RequestWindow( vout_thread_t *p_vout, ...@@ -135,40 +130,31 @@ void *vout_RequestWindow( vout_thread_t *p_vout,
vlc_object_release (wnd); vlc_object_release (wnd);
return NULL; return NULL;
} }
p_vout->p_window = wnd;
*pi_width_hint = wnd->width; *pi_width_hint = wnd->width;
*pi_height_hint = wnd->height; *pi_height_hint = wnd->height;
*pi_x_hint = wnd->pos_x; *pi_x_hint = wnd->pos_x;
*pi_y_hint = wnd->pos_y; *pi_y_hint = wnd->pos_y;
return wnd->handle; return wnd;
} }
/** /**
* Releases a window handle obtained with vout_RequestWindow(). * Releases a window handle obtained with vout_RequestWindow().
* @param p_vout video output thread that allocated the window * @param p_vout video output thread that allocated the window
* @param dummy unused legacy paramater * (if this is NULL; this fnction is a no-op).
*/ */
void vout_ReleaseWindow( vout_thread_t *p_vout, void *dummy ) void vout_ReleaseWindow( vout_window_t *wnd )
{ {
vout_window_t *wnd = p_vout->p_window;
if (wnd == NULL) if (wnd == NULL)
return; return;
p_vout->p_window = NULL;
assert (wnd->module); assert (wnd->module);
module_unneed (wnd, wnd->module); module_unneed (wnd, wnd->module);
vlc_object_release (wnd); vlc_object_release (wnd);
(void)dummy;
} }
int vout_ControlWindow( vout_thread_t *p_vout, void *dummy, int vout_ControlWindow( vout_window_t *wnd, int i_query, va_list args )
int i_query, va_list args )
{ {
(void)dummy;
vout_window_t *wnd = p_vout->p_window;
if (wnd == NULL) if (wnd == NULL)
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -922,11 +908,6 @@ int vout_vaControlDefault( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -922,11 +908,6 @@ int vout_vaControlDefault( vout_thread_t *p_vout, int i_query, va_list args )
(void)args; (void)args;
switch( i_query ) switch( i_query )
{ {
case VOUT_REPARENT:
case VOUT_CLOSE:
vout_ReleaseWindow( p_vout, NULL );
return VLC_SUCCESS;
case VOUT_SNAPSHOT: case VOUT_SNAPSHOT:
p_vout->p->b_snapshot = true; p_vout->p->b_snapshot = true;
return VLC_SUCCESS; return VLC_SUCCESS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment