Commit c80aee13 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/skins/src/vlcproc.cpp: fixed yesterday's breakage.
* modules/gui/wxwindows/menus.cpp: fixes for menu auto-generation.
* src/video_output/video_output.c: added a "fullscreen" object variable.
* modules/video_output/directx/*: added an always-on-top object variable and modified to take into account the fullscreen object variable.
parent 1d444764
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class * vlcproc.cpp: VlcProc class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: vlcproc.cpp,v 1.23 2003/05/20 23:17:59 gbazin Exp $ * $Id: vlcproc.cpp,v 1.24 2003/05/21 13:27:25 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -408,7 +408,7 @@ void VlcProc::OpenFile( bool play ) ...@@ -408,7 +408,7 @@ void VlcProc::OpenFile( bool play )
if( play ) if( play )
{ {
// Append and play // Append and play
for( size_t i = 0; i < p_open_dialog->mrl.GetCount(); i++ ) for( size_t i = 0; i < p_intf->p_sys->OpenDlg->mrl.GetCount(); i++ )
{ {
playlist_Add( p_playlist, playlist_Add( p_playlist,
(const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(), (const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(),
...@@ -420,7 +420,7 @@ void VlcProc::OpenFile( bool play ) ...@@ -420,7 +420,7 @@ void VlcProc::OpenFile( bool play )
else else
{ {
// Append only // Append only
for( size_t i = 0; i < p_open_dialog->mrl.GetCount(); i++ ) for( size_t i = 0; i < p_intf->p_sys->OpenDlg->mrl.GetCount(); i++ )
{ {
playlist_Add( p_playlist, playlist_Add( p_playlist,
(const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(), (const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* menus.cpp : wxWindows plugin for vlc * menus.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: menus.cpp,v 1.11 2003/05/17 22:48:09 gbazin Exp $ * $Id: menus.cpp,v 1.12 2003/05/21 13:27:25 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -96,12 +96,12 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface, ...@@ -96,12 +96,12 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface,
const wxPoint& pos ) const wxPoint& pos )
{ {
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[19]; char *ppsz_varnames[29];
int pi_objects[19]; int pi_objects[29];
int i = 0; int i = 0;
/* Initializations */ /* Initializations */
memset( pi_objects, 0, 19 * sizeof(int) ); memset( pi_objects, 0, 29 * sizeof(int) );
/* Audio menu */ /* Audio menu */
ppsz_varnames[i++] = _("Audio menu"); ppsz_varnames[i++] = _("Audio menu");
...@@ -129,6 +129,8 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface, ...@@ -129,6 +129,8 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface,
{ {
ppsz_varnames[i] = "fullscreen"; ppsz_varnames[i] = "fullscreen";
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "directx-on-top";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
...@@ -210,12 +212,12 @@ wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ) ...@@ -210,12 +212,12 @@ wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ) wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
{ {
vlc_object_t *p_object; vlc_object_t *p_object;
char *ppsz_varnames[4]; char *ppsz_varnames[6];
int pi_objects[4]; int pi_objects[6];
int i = 0; int i = 0;
/* Initializations */ /* Initializations */
memset( pi_objects, 0, 4 * sizeof(int) ); memset( pi_objects, 0, 6 * sizeof(int) );
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_VOUT, p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -223,6 +225,8 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ) ...@@ -223,6 +225,8 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface )
{ {
ppsz_varnames[i] = "fullscreen"; ppsz_varnames[i] = "fullscreen";
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "directx-on-top";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
...@@ -373,6 +377,8 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var, ...@@ -373,6 +377,8 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
/* Get the descriptive name of the variable */ /* Get the descriptive name of the variable */
var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL ); var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
var_Get( p_object, psz_var, &val );
if( i_type & VLC_VAR_HASCHOICE ) if( i_type & VLC_VAR_HASCHOICE )
{ {
menu->Append( MenuDummy_Event, menu->Append( MenuDummy_Event,
...@@ -397,13 +403,14 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var, ...@@ -397,13 +403,14 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
break; break;
case VLC_VAR_BOOL: case VLC_VAR_BOOL:
val.b_bool = !val.b_bool;
menuitem = new wxMenuItemExt( menu, ++i_item_id, menuitem = new wxMenuItemExt( menu, ++i_item_id,
wxU(text.psz_string ? wxU(text.psz_string ?
text.psz_string : psz_var), text.psz_string : psz_var),
wxT(""), wxITEM_CHECK, strdup(psz_var), wxT(""), wxITEM_CHECK, strdup(psz_var),
p_object->i_object_id, val, i_type ); p_object->i_object_id, val, i_type );
menu->Append( menuitem ); menu->Append( menuitem );
Check( i_item_id -1, val.b_bool ? FALSE : TRUE ); Check( i_item_id, val.b_bool ? FALSE : TRUE );
break; break;
default: default:
...@@ -411,6 +418,7 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var, ...@@ -411,6 +418,7 @@ void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
return; return;
} }
if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
if( text.psz_string ) free( text.psz_string ); if( text.psz_string ) free( text.psz_string );
} }
...@@ -519,7 +527,7 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object ) ...@@ -519,7 +527,7 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object )
} }
/* clean up everything */ /* clean up everything */
if( i_type == VLC_VAR_STRING ) free( val.psz_string ); if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list ); var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
return menu; return menu;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.c: Windows DirectX video output display method * vout.c: Windows DirectX video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: directx.c,v 1.19 2003/05/15 22:27:37 massiot Exp $ * $Id: directx.c,v 1.20 2003/05/21 13:27:25 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -84,6 +84,10 @@ static void DirectXGetDDrawCaps ( vout_thread_t *p_vout ); ...@@ -84,6 +84,10 @@ static void DirectXGetDDrawCaps ( vout_thread_t *p_vout );
static int DirectXLockSurface ( vout_thread_t *p_vout, picture_t *p_pic ); static int DirectXLockSurface ( vout_thread_t *p_vout, picture_t *p_pic );
static int DirectXUnlockSurface ( vout_thread_t *p_vout, picture_t *p_pic ); static int DirectXUnlockSurface ( vout_thread_t *p_vout, picture_t *p_pic );
/* Object variables callbacks */
static int OnTopCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -132,7 +136,7 @@ vlc_module_end(); ...@@ -132,7 +136,7 @@ vlc_module_end();
static int OpenVideo( vlc_object_t *p_this ) static int OpenVideo( vlc_object_t *p_this )
{ {
vout_thread_t * p_vout = (vout_thread_t *)p_this; vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val; vlc_value_t val, text;
/* Allocate structure */ /* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
...@@ -218,8 +222,12 @@ static int OpenVideo( vlc_object_t *p_this ) ...@@ -218,8 +222,12 @@ static int OpenVideo( vlc_object_t *p_this )
/* Add a variable to indicate if the window should be on top of others */ /* Add a variable to indicate if the window should be on top of others */
var_Create( p_vout, "directx-on-top", VLC_VAR_BOOL ); var_Create( p_vout, "directx-on-top", VLC_VAR_BOOL );
text.psz_string = _("Always on top");
var_Change( p_vout, "directx-on-top", VLC_VAR_SETTEXT, &text, NULL );
val.b_bool = config_GetInt( p_vout, "directx-on-top" ); val.b_bool = config_GetInt( p_vout, "directx-on-top" );
var_Set( p_vout, "directx-on-top", val ); var_Set( p_vout, "directx-on-top", val );
p_vout->p_sys->b_on_top_change = val.b_bool;
var_AddCallback( p_vout, "directx-on-top", OnTopCallback, NULL );
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -375,9 +383,6 @@ static void CloseVideo( vlc_object_t *p_this ) ...@@ -375,9 +383,6 @@ static void CloseVideo( vlc_object_t *p_this )
static int Manage( vout_thread_t *p_vout ) static int Manage( vout_thread_t *p_vout )
{ {
WINDOWPLACEMENT window_placement; WINDOWPLACEMENT window_placement;
HWND hwnd;
HMENU hMenu;
vlc_value_t val;
/* If we do not control our window, we check for geometry changes /* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */ * ourselves because the parent might not send us its events. */
...@@ -427,6 +432,8 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -427,6 +432,8 @@ static int Manage( vout_thread_t *p_vout )
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
|| p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE ) || p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
{ {
vlc_value_t val;
p_vout->b_fullscreen = ! p_vout->b_fullscreen; p_vout->b_fullscreen = ! p_vout->b_fullscreen;
/* We need to switch between Maximized and Normal sized window */ /* We need to switch between Maximized and Normal sized window */
...@@ -453,6 +460,10 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -453,6 +460,10 @@ static int Manage( vout_thread_t *p_vout )
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE; p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE; p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
/* Update the object variable without triggering a callback */
val.b_bool = p_vout->b_fullscreen;
var_Change( p_vout, "fullscreen", VLC_VAR_SETVALUE, &val, NULL );
} }
/* /*
...@@ -472,30 +483,34 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -472,30 +483,34 @@ static int Manage( vout_thread_t *p_vout )
/* /*
* "Always on top" status change * "Always on top" status change
*/ */
hwnd = p_vout->p_sys->hwnd; if( p_vout->p_sys->b_on_top_change )
hMenu = GetSystemMenu( hwnd , FALSE );
var_Get( p_vout, "directx-on-top", &val );
if( val.b_bool )
{ {
vlc_value_t val;
HMENU hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
var_Get( p_vout, "directx-on-top", &val );
/* Set the window on top if necessary */ /* Set the window on top if necessary */
if( !( GetWindowLong( hwnd, GWL_EXSTYLE ) & WS_EX_TOPMOST ) ) if( val.b_bool && !( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{ {
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP, CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED ); MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( hwnd, HWND_TOPMOST, 0, 0, 0, 0, SetWindowPos( p_vout->p_sys->hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE ); SWP_NOSIZE | SWP_NOMOVE );
} }
} else
else
{
/* The window shouldn't be on top */ /* The window shouldn't be on top */
if( GetWindowLong( hwnd, GWL_EXSTYLE ) & WS_EX_TOPMOST ) if( !val.b_bool && ( GetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE )
& WS_EX_TOPMOST ) )
{ {
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP, CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED ); MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SetWindowPos( p_vout->p_sys->hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE ); SWP_NOSIZE | SWP_NOMOVE );
} }
p_vout->p_sys->b_on_top_change = VLC_FALSE;
} }
/* Check if the event thread is still running */ /* Check if the event thread is still running */
...@@ -1518,3 +1533,15 @@ static int DirectXUnlockSurface( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1518,3 +1533,15 @@ static int DirectXUnlockSurface( vout_thread_t *p_vout, picture_t *p_pic )
else else
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/*****************************************************************************
* object variables callbacks: a bunch of object variables are used by the
* interfaces to interact with the vout.
*****************************************************************************/
static int OnTopCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
p_vout->p_sys->b_on_top_change = VLC_TRUE;
return VLC_SUCCESS;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.h: Windows DirectX video output header file * vout.h: Windows DirectX video output header file
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vout.h,v 1.4 2003/03/28 17:02:25 gbazin Exp $ * $Id: vout.h,v 1.5 2003/05/21 13:27:25 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -84,6 +84,9 @@ struct vout_sys_t ...@@ -84,6 +84,9 @@ struct vout_sys_t
volatile vlc_bool_t b_cursor_hidden; volatile vlc_bool_t b_cursor_hidden;
volatile mtime_t i_lastmoved; volatile mtime_t i_lastmoved;
/* Misc */
vlc_bool_t b_on_top_change;
event_thread_t * p_event; event_thread_t * p_event;
}; };
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread. * thread, and destroy a previously oppened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.221 2003/05/11 18:40:11 hartman Exp $ * $Id: video_output.c,v 1.222 2003/05/21 13:27:25 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -57,6 +57,10 @@ static int BinaryLog ( uint32_t ); ...@@ -57,6 +57,10 @@ static int BinaryLog ( uint32_t );
static void MaskToShift ( int *, int *, uint32_t ); static void MaskToShift ( int *, int *, uint32_t );
static void InitWindowSize ( vout_thread_t *, int *, int * ); static void InitWindowSize ( vout_thread_t *, int *, int * );
/* Object variables callbacks */
static int FullscreenCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
/***************************************************************************** /*****************************************************************************
* vout_Request: find a video output thread, create one, or destroy one. * vout_Request: find a video output thread, create one, or destroy one.
***************************************************************************** *****************************************************************************
...@@ -196,7 +200,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, ...@@ -196,7 +200,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
input_thread_t * p_input_thread; input_thread_t * p_input_thread;
int i_index; /* loop variable */ int i_index; /* loop variable */
char * psz_plugin; char * psz_plugin;
vlc_value_t val; vlc_value_t val, text;
/* Allocate descriptor */ /* Allocate descriptor */
p_vout = vlc_object_create( p_parent, VLC_OBJECT_VOUT ); p_vout = vlc_object_create( p_parent, VLC_OBJECT_VOUT );
...@@ -373,6 +377,12 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, ...@@ -373,6 +377,12 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
return NULL; return NULL;
} }
/* Create a few object variables for interface interaction */
var_Create( p_vout, "fullscreen", VLC_VAR_BOOL );
text.psz_string = _("Fullscreen");
var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, &text, NULL );
var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL );
/* Calculate delay created by internal caching */ /* Calculate delay created by internal caching */
p_input_thread = (input_thread_t *)vlc_object_find( p_vout, p_input_thread = (input_thread_t *)vlc_object_find( p_vout,
VLC_OBJECT_INPUT, FIND_ANYWHERE ); VLC_OBJECT_INPUT, FIND_ANYWHERE );
...@@ -1148,5 +1158,20 @@ int vout_VarCallback( vlc_object_t * p_this, const char * psz_variable, ...@@ -1148,5 +1158,20 @@ int vout_VarCallback( vlc_object_t * p_this, const char * psz_variable,
vlc_value_t val; vlc_value_t val;
val.b_bool = VLC_TRUE; val.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val ); var_Set( p_vout, "intf-change", val );
return 0; return VLC_SUCCESS;
}
/*****************************************************************************
* object variables callbacks: a bunch of object variables are used by the
* interfaces to interact with the vout.
*****************************************************************************/
static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
val.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val );
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