Commit e6621431 authored by Laurent Aimar's avatar Laurent Aimar

Factorized Manage() common code (msw).

parent 07c6122a
......@@ -130,6 +130,157 @@ void CommonClean( vout_thread_t *p_vout )
#endif
}
void CommonManage( vout_thread_t *p_vout )
{
/* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */
vlc_mutex_lock( &p_vout->p_sys->lock );
if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )
{
RECT rect_parent;
POINT point;
vlc_mutex_unlock( &p_vout->p_sys->lock );
GetClientRect( p_vout->p_sys->hparent, &rect_parent );
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hparent, &point );
OffsetRect( &rect_parent, point.x, point.y );
if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )
{
p_vout->p_sys->rect_parent = rect_parent;
/* FIXME I find such #ifdef quite weirds. Are they really needed ? */
#if defined(MODULE_NAME_IS_direct3d)
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top,
SWP_NOZORDER );
UpdateRects( p_vout, true );
#else
/* This one is to force the update even if only
* the position has changed */
SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
#if defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi)
unsigned int i_x, i_y, i_width, i_height;
vout_PlacePicture( p_vout, rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top,
&i_x, &i_y, &i_width, &i_height );
SetWindowPos( p_vout->p_sys->hvideownd, HWND_TOP,
i_x, i_y, i_width, i_height, 0 );
#endif
#endif
}
}
else
{
vlc_mutex_unlock( &p_vout->p_sys->lock );
}
/* autoscale toggle */
if( p_vout->i_changes & VOUT_SCALE_CHANGE )
{
p_vout->i_changes &= ~VOUT_SCALE_CHANGE;
p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" );
p_vout->i_zoom = (int) ZOOM_FP_FACTOR;
UpdateRects( p_vout, true );
}
/* scaling factor */
if( p_vout->i_changes & VOUT_ZOOM_CHANGE )
{
p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;
p_vout->b_autoscale = false;
p_vout->i_zoom =
(int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) );
UpdateRects( p_vout, true );
}
/* Check for cropping / aspect changes */
if( p_vout->i_changes & VOUT_CROP_CHANGE ||
p_vout->i_changes & VOUT_ASPECT_CHANGE )
{
p_vout->i_changes &= ~VOUT_CROP_CHANGE;
p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset;
p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset;
p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width;
p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height;
p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;
p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
UpdateRects( p_vout, true );
}
/* We used to call the Win32 PeekMessage function here to read the window
* messages. But since window can stay blocked into this function for a
* long time (for example when you move your window on the screen), I
* decided to isolate PeekMessage in another thread. */
/*
* Fullscreen change
*/
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
|| p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
{
Win32ToggleFullscreen( p_vout );
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
/*
* Pointer change
*/
EventThreadMouseAutoHide( p_vout->p_sys->p_event );
/*
* "Always on top" status change
*/
if( p_vout->p_sys->b_on_top_change )
{
HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
bool b = var_GetBool( p_vout, "video-on-top" );
/* Set the window on top if necessary */
if( b && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
else
/* The window shouldn't be on top */
if( !b && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
p_vout->p_sys->b_on_top_change = false;
}
}
/*****************************************************************************
* UpdateRects: update clipping rectangles
*****************************************************************************
......
......@@ -302,36 +302,7 @@ static void End( vout_thread_t *p_vout )
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
/* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */
vlc_mutex_lock( &p_vout->p_sys->lock );
if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )
{
RECT rect_parent;
POINT point;
vlc_mutex_unlock( &p_vout->p_sys->lock );
GetClientRect( p_vout->p_sys->hparent, &rect_parent );
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hparent, &point );
OffsetRect( &rect_parent, point.x, point.y );
if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )
{
p_vout->p_sys->rect_parent = rect_parent;
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top,
SWP_NOZORDER );
UpdateRects( p_vout, true );
}
}
else
{
vlc_mutex_unlock( &p_vout->p_sys->lock );
}
CommonManage( p_vout );
/*
* Position Change
......@@ -382,99 +353,6 @@ static int Manage( vout_thread_t *p_vout )
p_vout->p_sys->i_changes &= ~DX_DESKTOP_CHANGE;
}
/* autoscale toggle */
if( p_vout->i_changes & VOUT_SCALE_CHANGE )
{
p_vout->i_changes &= ~VOUT_SCALE_CHANGE;
p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" );
p_vout->i_zoom = (int) ZOOM_FP_FACTOR;
UpdateRects( p_vout, true );
}
/* scaling factor */
if( p_vout->i_changes & VOUT_ZOOM_CHANGE )
{
p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;
p_vout->b_autoscale = false;
p_vout->i_zoom =
(int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) );
UpdateRects( p_vout, true );
}
/* Check for cropping / aspect changes */
if( p_vout->i_changes & VOUT_CROP_CHANGE ||
p_vout->i_changes & VOUT_ASPECT_CHANGE )
{
p_vout->i_changes &= ~VOUT_CROP_CHANGE;
p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset;
p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset;
p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width;
p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height;
p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;
p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
UpdateRects( p_vout, true );
}
/* We used to call the Win32 PeekMessage function here to read the window
* messages. But since window can stay blocked into this function for a
* long time (for example when you move your window on the screen), I
* decided to isolate PeekMessage in another thread. */
/*
* Fullscreen change
*/
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
|| p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
{
Win32ToggleFullscreen( p_vout );
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
/*
* Pointer change
*/
EventThreadMouseAutoHide( p_vout->p_sys->p_event );
/*
* "Always on top" status change
*/
if( p_vout->p_sys->b_on_top_change )
{
HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
bool b = var_GetBool( p_vout, "video-on-top" );
/* Set the window on top if necessary */
if( b && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
else
/* The window shouldn't be on top */
if( !b && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
p_vout->p_sys->b_on_top_change = false;
}
return VLC_SUCCESS;
}
......
......@@ -434,40 +434,7 @@ static void CloseVideo( vlc_object_t *p_this )
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
/* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */
vlc_mutex_lock( &p_vout->p_sys->lock );
if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )
{
RECT rect_parent;
POINT point;
vlc_mutex_unlock( &p_vout->p_sys->lock );
GetClientRect( p_vout->p_sys->hparent, &rect_parent );
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hparent, &point );
OffsetRect( &rect_parent, point.x, point.y );
if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )
{
p_vout->p_sys->rect_parent = rect_parent;
/* This one is to force the update even if only
* the position has changed */
SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
}
}
else
{
vlc_mutex_unlock( &p_vout->p_sys->lock );
}
CommonManage( p_vout );
/*
* Position Change
......@@ -487,51 +454,6 @@ static int Manage( vout_thread_t *p_vout )
}
}
/* autoscale toggle */
if( p_vout->i_changes & VOUT_SCALE_CHANGE )
{
p_vout->i_changes &= ~VOUT_SCALE_CHANGE;
p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" );
p_vout->i_zoom = (int) ZOOM_FP_FACTOR;
UpdateRects( p_vout, true );
}
/* scaling factor */
if( p_vout->i_changes & VOUT_ZOOM_CHANGE )
{
p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;
p_vout->b_autoscale = false;
p_vout->i_zoom =
(int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) );
UpdateRects( p_vout, true );
}
/* Check for cropping / aspect changes */
if( p_vout->i_changes & VOUT_CROP_CHANGE ||
p_vout->i_changes & VOUT_ASPECT_CHANGE )
{
p_vout->i_changes &= ~VOUT_CROP_CHANGE;
p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset;
p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset;
p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width;
p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height;
p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;
p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
UpdateRects( p_vout, true );
}
/* We used to call the Win32 PeekMessage function here to read the window
* messages. But since window can stay blocked into this function for a
* long time (for example when you move your window on the screen), I
* decided to isolate PeekMessage in another thread. */
if( p_vout->p_sys->i_changes & DX_WALLPAPER_CHANGE )
{
SwitchWallpaperMode( p_vout, !p_vout->p_sys->b_wallpaper );
......@@ -539,56 +461,6 @@ static int Manage( vout_thread_t *p_vout )
DirectDrawUpdateOverlay( p_vout );
}
/*
* Fullscreen change
*/
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
|| p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
{
Win32ToggleFullscreen( p_vout );
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
/*
* Pointer change
*/
EventThreadMouseAutoHide( p_vout->p_sys->p_event );
/*
* "Always on top" status change
*/
if( p_vout->p_sys->b_on_top_change )
{
vlc_value_t val;
HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
var_Get( p_vout, "video-on-top", &val );
/* Set the window on top if necessary */
if( val.b_bool && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
else
/* The window shouldn't be on top */
if( !val.b_bool && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
p_vout->p_sys->b_on_top_change = false;
}
return VLC_SUCCESS;
}
......
......@@ -182,142 +182,13 @@ static void CloseVideo( vlc_object_t *p_this )
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
int i_width = p_vout->p_sys->rect_dest.right -
p_vout->p_sys->rect_dest.left;
int i_height = p_vout->p_sys->rect_dest.bottom -
p_vout->p_sys->rect_dest.top;
glViewport( 0, 0, i_width, i_height );
/* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */
vlc_mutex_lock( &p_vout->p_sys->lock );
if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )
{
RECT rect_parent;
POINT point;
vlc_mutex_unlock( &p_vout->p_sys->lock );
GetClientRect( p_vout->p_sys->hparent, &rect_parent );
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hparent, &point );
OffsetRect( &rect_parent, point.x, point.y );
if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )
{
p_vout->p_sys->rect_parent = rect_parent;
/* This one is to force the update even if only
* the position has changed */
SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
}
}
else
{
vlc_mutex_unlock( &p_vout->p_sys->lock );
}
/* autoscale toggle */
if( p_vout->i_changes & VOUT_SCALE_CHANGE )
{
p_vout->i_changes &= ~VOUT_SCALE_CHANGE;
p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" );
p_vout->i_zoom = (int) ZOOM_FP_FACTOR;
UpdateRects( p_vout, true );
}
/* scaling factor */
if( p_vout->i_changes & VOUT_ZOOM_CHANGE )
{
p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;
p_vout->b_autoscale = false;
p_vout->i_zoom =
(int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) );
UpdateRects( p_vout, true );
}
/* Check for cropping / aspect changes */
if( p_vout->i_changes & VOUT_CROP_CHANGE ||
p_vout->i_changes & VOUT_ASPECT_CHANGE )
{
p_vout->i_changes &= ~VOUT_CROP_CHANGE;
p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset;
p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset;
p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width;
p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height;
p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;
p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
UpdateRects( p_vout, true );
}
/* We used to call the Win32 PeekMessage function here to read the window
* messages. But since window can stay blocked into this function for a
* long time (for example when you move your window on the screen), I
* decided to isolate PeekMessage in another thread. */
/*
* Fullscreen change
*/
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
|| p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
{
Win32ToggleFullscreen( p_vout );
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
vout_sys_t *p_sys = p_vout->p_sys;
/*
* Pointer change
*/
EventThreadMouseAutoHide( p_vout->p_sys->p_event );
/*
* "Always on top" status change
*/
if( p_vout->p_sys->b_on_top_change )
{
vlc_value_t val;
HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
var_Get( p_vout, "video-on-top", &val );
/* Set the window on top if necessary */
if( val.b_bool && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
else
/* The window shouldn't be on top */
if( !val.b_bool && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
p_vout->p_sys->b_on_top_change = false;
}
const int i_width = p_sys->rect_dest.right - p_sys->rect_dest.left;
const int i_height = p_sys->rect_dest.bottom - p_sys->rect_dest.top;
glViewport( 0, 0, i_width, i_height );
CommonManage( p_vout );
return VLC_SUCCESS;
}
......
......@@ -271,8 +271,9 @@ void EventThreadMouseAutoHide( event_thread_t * );
/*****************************************************************************
* Prototypes from common.c
*****************************************************************************/
int CommonInit( vout_thread_t * );
int CommonInit( vout_thread_t * );
void CommonClean( vout_thread_t * );
void CommonManage( vout_thread_t * );
int Control( vout_thread_t *p_vout, int i_query, va_list args );
......
......@@ -300,89 +300,6 @@ static void End( vout_thread_t *p_vout )
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
/* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */
vlc_mutex_lock( &p_vout->p_sys->lock );
if( p_vout->p_sys->hparent && !p_vout->b_fullscreen )
{
RECT rect_parent;
POINT point;
vlc_mutex_unlock( &p_vout->p_sys->lock );
GetClientRect( p_vout->p_sys->hparent, &rect_parent );
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hparent, &point );
OffsetRect( &rect_parent, point.x, point.y );
if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) )
{
unsigned int i_x, i_y, i_width, i_height;
p_vout->p_sys->rect_parent = rect_parent;
/* This one is to force the update even if only
* the position has changed */
SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0 );
vout_PlacePicture( p_vout, rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top,
&i_x, &i_y, &i_width, &i_height );
SetWindowPos( p_vout->p_sys->hvideownd, HWND_TOP,
i_x, i_y, i_width, i_height, 0 );
}
}
else
{
vlc_mutex_unlock( &p_vout->p_sys->lock );
}
/* autoscale toggle */
if( p_vout->i_changes & VOUT_SCALE_CHANGE )
{
p_vout->i_changes &= ~VOUT_SCALE_CHANGE;
p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" );
p_vout->i_zoom = (int) ZOOM_FP_FACTOR;
UpdateRects( p_vout, true );
}
/* scaling factor */
if( p_vout->i_changes & VOUT_ZOOM_CHANGE )
{
p_vout->i_changes &= ~VOUT_ZOOM_CHANGE;
p_vout->b_autoscale = false;
p_vout->i_zoom =
(int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) );
UpdateRects( p_vout, true );
}
/* Check for cropping / aspect changes */
if( p_vout->i_changes & VOUT_CROP_CHANGE ||
p_vout->i_changes & VOUT_ASPECT_CHANGE )
{
p_vout->i_changes &= ~VOUT_CROP_CHANGE;
p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset;
p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset;
p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width;
p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height;
p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect;
p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
UpdateRects( p_vout, true );
}
/*
* Position Change
*/
......@@ -391,60 +308,7 @@ static int Manage( vout_thread_t *p_vout )
p_vout->p_sys->i_changes &= ~DX_POSITION_CHANGE;
}
/* We used to call the Win32 PeekMessage function here to read the window
* messages. But since window can stay blocked into this function for a
* long time (for example when you move your window on the screen), I
* decided to isolate PeekMessage in another thread. */
/*
* Fullscreen change
*/
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
|| p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
{
Win32ToggleFullscreen( p_vout );
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
/*
* Pointer change
*/
EventThreadMouseAutoHide( p_vout->p_sys->p_event );
/*
* "Always on top" status change
*/
if( p_vout->p_sys->b_on_top_change )
{
vlc_value_t val;
HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
var_Get( p_vout, "video-on-top", &val );
/* Set the window on top if necessary */
if( val.b_bool && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
else
/* The window shouldn't be on top */
if( !val.b_bool && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
p_vout->p_sys->b_on_top_change = false;
}
CommonManage( p_vout );
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