Commit b28b9388 authored by Laurent Aimar's avatar Laurent Aimar

Modified the way title is updated (msw).

parent c4508cad
......@@ -275,7 +275,7 @@ static int Init( vout_thread_t *p_vout )
}
/* Change the window title bar text */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
EventThreadUpdateTitle( p_vout->p_sys->p_event, VOUT_TITLE " (Direct3D output)" );
p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
return VLC_SUCCESS;
......
......@@ -385,10 +385,18 @@ static int Init( vout_thread_t *p_vout )
NewPictureVec( p_vout, p_vout->p_picture );
}
p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
/* Change the window title bar text */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
const char *psz_fallback;
if( p_vout->p_sys->b_using_overlay )
psz_fallback = VOUT_TITLE " (hardware YUV overlay DirectX output)";
else if( p_vout->p_sys->b_hw_yuv )
psz_fallback = VOUT_TITLE " (hardware YUV DirectX output)";
else
psz_fallback = VOUT_TITLE " (software RGB DirectX output)";
EventThreadUpdateTitle( p_vout->p_sys->p_event, psz_fallback );
p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
return VLC_SUCCESS;
}
......
......@@ -330,50 +330,30 @@ static void *EventThread( void *p_this )
break;
case WM_VLC_CHANGE_TEXT:
var_Get( p_vout, "video-title", &val );
if( !val.psz_string || !*val.psz_string ) /* Default video title */
{
free( val.psz_string );
#ifdef MODULE_NAME_IS_wingdi
val.psz_string = strdup( VOUT_TITLE " (WinGDI output)" );
#endif
#ifdef MODULE_NAME_IS_wingapi
val.psz_string = strdup( VOUT_TITLE " (WinGAPI output)" );
#endif
#ifdef MODULE_NAME_IS_glwin32
val.psz_string = strdup( VOUT_TITLE " (OpenGL output)" );
#endif
#ifdef MODULE_NAME_IS_direct3d
val.psz_string = strdup( VOUT_TITLE " (Direct3D output)" );
#endif
#ifdef MODULE_NAME_IS_directx
if( p_event->p_vout->p_sys->b_using_overlay ) val.psz_string =
strdup( VOUT_TITLE " (hardware YUV overlay DirectX output)" );
else if( p_event->p_vout->p_sys->b_hw_yuv ) val.psz_string =
strdup( VOUT_TITLE " (hardware YUV DirectX output)" );
else val.psz_string =
strdup( VOUT_TITLE " (software RGB DirectX output)" );
#endif
}
{
vlc_mutex_lock( &p_event->lock );
wchar_t *pwz_title = NULL;
if( p_event->psz_title )
{
wchar_t *psz_title = malloc( strlen(val.psz_string) * 2 + 2 );
if( psz_title )
const size_t i_length = strlen(p_event->psz_title);
pwz_title = malloc( 2 * (i_length + 1) );
if( pwz_title )
{
mbstowcs( psz_title, val.psz_string, strlen(val.psz_string)*2);
psz_title[strlen(val.psz_string)] = 0;
free( val.psz_string ); val.psz_string = (char *)psz_title;
mbstowcs( pwz_title, p_event->psz_title, 2 * i_length );
pwz_title[i_length] = 0;
}
}
vlc_mutex_unlock( &p_event->lock );
SetWindowText( p_event->p_vout->p_sys->hwnd,
(LPCTSTR)val.psz_string );
if( p_event->p_vout->p_sys->hfswnd )
SetWindowText( p_event->p_vout->p_sys->hfswnd,
(LPCTSTR)val.psz_string );
free( val.psz_string );
if( pwz_title )
{
SetWindowText( p_vout->p_sys->hwnd, (LPCTSTR)pwz_title );
if( p_vout->p_sys->hfswnd )
SetWindowText( p_vout->p_sys->hfswnd, (LPCTSTR)pwz_title );
free( pwz_title );
}
break;
}
default:
/* Messages we don't handle directly are dispatched to the
......@@ -913,6 +893,21 @@ void EventThreadMouseAutoHide( event_thread_t *p_event )
}
}
}
void EventThreadUpdateTitle( event_thread_t *p_event, const char *psz_fallback )
{
char *psz_title = var_GetNonEmptyString( p_event->p_vout, "video-title" );
if( !psz_title )
psz_title = strdup( psz_fallback );
if( !psz_title )
return;
vlc_mutex_lock( &p_event->lock );
free( p_event->psz_title );
p_event->psz_title = psz_title;
vlc_mutex_unlock( &p_event->lock );
PostMessage( p_event->p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
}
event_thread_t *EventThreadCreate( vout_thread_t *p_vout )
{
......@@ -936,12 +931,14 @@ event_thread_t *EventThreadCreate( vout_thread_t *p_vout )
p_event->i_lastmoved = mdate();
p_event->i_mouse_hide_timeout =
var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
p_event->psz_title = NULL;
return p_event;
}
void EventThreadDestroy( event_thread_t *p_event )
{
free( p_event->psz_title );
vlc_cond_destroy( &p_event->wait );
vlc_mutex_destroy( &p_event->lock );
free( p_event );
......
......@@ -123,7 +123,7 @@ static int Init( vout_thread_t *p_vout )
int iFormat;
/* Change the window title bar text */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
EventThreadUpdateTitle( p_vout->p_sys->p_event, VOUT_TITLE " (OpenGL output)" );
p_vout->p_sys->hGLDC = GetDC( p_vout->p_sys->hvideownd );
......
......@@ -42,6 +42,9 @@ typedef struct
volatile mtime_t i_lastmoved;
mtime_t i_mouse_hide_timeout;
/* Title */
char *psz_title;
} event_thread_t;
#ifdef MODULE_NAME_IS_wingapi
......@@ -263,6 +266,7 @@ int EventThreadStart( event_thread_t * );
void EventThreadStop( event_thread_t * );
void EventThreadMouseAutoHide( event_thread_t * );
void EventThreadUpdateTitle( event_thread_t *, const char *psz_fallback );
/*****************************************************************************
* Prototypes from common.c
......
......@@ -270,7 +270,11 @@ static int Init( vout_thread_t *p_vout )
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES++ ] = p_pic;
/* Change the window title bar text */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
#ifdef MODULE_NAME_IS_wingapi
EventThreadUpdateTitle( p_vout->p_sys->p_event, VOUT_TITLE " (WinGAPI output)" );
#else
EventThreadUpdateTitle( p_vout->p_sys->p_event, VOUT_TITLE " (WinGDI output)" );
#endif
UpdateRects( p_vout, true );
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