Commit 64c48e9c authored by ipkiss's avatar ipkiss
Browse files

* modules/video_output/directx: added a configuration variable and a

   "normal" one to set the vout window on top of ther windows
 * modules/gui/win32: the interface can use these variables
   (almost closes #84)
parent f48edcc6
......@@ -213,6 +213,25 @@ void __fastcall TMainFrameDlg::FullscreenActionExecute( TObject *Sender )
vlc_object_release( p_vout );
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::OnTopActionExecute( TObject *Sender )
{
vlc_object_t *p_vout;
p_vout = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
vlc_value_t val;
if( var_Get( p_vout, "directx-on-top", &val ) >= 0 )
{
val.b_bool = ! val.b_bool;
var_Set( p_vout, "directx-on-top", val );
MenuOnTop->Checked = val.b_bool;
PopupOnTop->Checked = val.b_bool;
}
vlc_object_release( p_vout );
}
}
//---------------------------------------------------------------------------
void __fastcall TMainFrameDlg::PlaylistActionExecute( TObject *Sender )
{
TPlaylistDlg *p_playwin = p_intf->p_sys->p_playwin;
......
......@@ -480,6 +480,14 @@ object MainFrameDlg: TMainFrameDlg
object MenuView: TMenuItem
Tag = 3
Caption = '&View'
object MenuFullscreen: TMenuItem
Tag = 3
Action = FullscreenAction
end
object MenuOnTop: TMenuItem
Tag = 3
Action = OnTopAction
end
object MenuHideinterface: TMenuItem
Tag = 3
Caption = '&Hide interface'
......@@ -529,6 +537,7 @@ object MainFrameDlg: TMainFrameDlg
Action = VolumeDownAction
end
object MenuMute: TMenuItem
Tag = 3
Action = MuteAction
end
object MenuChannel: TMenuItem
......@@ -537,18 +546,11 @@ object MainFrameDlg: TMainFrameDlg
Enabled = False
Hint = 'Select audio channel'
end
object N2: TMenuItem
Caption = '-'
end
object MenuVDevice: TMenuItem
Tag = 3
Caption = 'Sc&reen'
Enabled = False
end
object MenuFullscreen: TMenuItem
Tag = 3
Action = FullscreenAction
end
object N11: TMenuItem
Caption = '-'
end
......@@ -2392,15 +2394,9 @@ object MainFrameDlg: TMainFrameDlg
object PopupJump: TMenuItem
Tag = 3
Caption = '&Jump...'
Enabled = False
OnClick = PopupJumpClick
end
object N6: TMenuItem
Caption = '-'
end
object PopupFullscreen: TMenuItem
Tag = 3
Action = FullscreenAction
end
end
object PopupAudioSettings: TMenuItem
Tag = 3
......@@ -2428,9 +2424,22 @@ object MainFrameDlg: TMainFrameDlg
Enabled = False
end
end
object PopupVDevice: TMenuItem
Caption = 'Screen'
Enabled = False
object Videosettings1: TMenuItem
Tag = 3
Caption = 'Video settings'
object PopupFullscreen: TMenuItem
Tag = 3
Action = FullscreenAction
end
object PopupOnTop: TMenuItem
Tag = 3
Action = OnTopAction
end
object PopupVDevice: TMenuItem
Tag = 3
Caption = 'Screen'
Enabled = False
end
end
object N1: TMenuItem
Caption = '-'
......@@ -2714,5 +2723,13 @@ object MainFrameDlg: TMainFrameDlg
Hint = 'Toggle mute'
OnExecute = MuteActionExecute
end
object OnTopAction: TAction
Tag = 3
Category = 'Menu'
Caption = 'Always on top...'
Hint = 'Set the window on top'
ShortCut = 16468
OnExecute = OnTopActionExecute
end
end
end
......@@ -74,7 +74,6 @@ __published: // IDE-managed Components
TMenuItem *MenuExit;
TMenuItem *MenuView;
TMenuItem *MenuHideinterface;
TMenuItem *MenuFullscreen;
TMenuItem *MenuTitle;
TMenuItem *MenuChapter;
TMenuItem *MenuAngle;
......@@ -97,7 +96,6 @@ __published: // IDE-managed Components
TMenuItem *PopupSlow;
TMenuItem *PopupFast;
TMenuItem *PopupToggleInterface;
TMenuItem *PopupFullscreen;
TMenuItem *PopupNext;
TMenuItem *PopupPrev;
TMenuItem *PopupJump;
......@@ -168,7 +166,6 @@ __published: // IDE-managed Components
TAction *AddSubtitlesAction;
TMenuItem *Control1;
TMenuItem *N5;
TMenuItem *N6;
TMenuItem *N10;
TMenuItem *N11;
TMenuItem *MenuChannel;
......@@ -183,13 +180,18 @@ __published: // IDE-managed Components
TMenuItem *VolumeUp1;
TMenuItem *Mute1;
TMenuItem *MenuVDevice;
TMenuItem *N2;
TMenuItem *N1;
TMenuItem *PopupVDevice;
TMenuItem *MenuStreamOuput;
TMenuItem *MenuAddSubtitles;
TMenuItem *N4;
TMenuItem *MenuAddInterface;
TAction *OnTopAction;
TMenuItem *MenuFullscreen;
TMenuItem *MenuOnTop;
TMenuItem *PopupFullscreen;
TMenuItem *Videosettings1;
TMenuItem *PopupOnTop;
void __fastcall TimerManageTimer( TObject *Sender );
void __fastcall TrackBarChange( TObject *Sender );
void __fastcall FormClose( TObject *Sender, TCloseAction &Action );
......@@ -225,6 +227,7 @@ __published: // IDE-managed Components
void __fastcall PrevChapterActionExecute( TObject *Sender );
void __fastcall NextChapterActionExecute( TObject *Sender );
void __fastcall AddSubtitlesActionsExecute( TObject *Sender );
void __fastcall OnTopActionExecute( TObject *Sender );
private: // User declarations
intf_thread_t *p_intf;
/* drag and drop handling */
......
......@@ -2,7 +2,7 @@
* win32.cpp : Win32 interface plugin for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: win32.cpp,v 1.12 2003/01/24 12:01:03 sam Exp $
* $Id: win32.cpp,v 1.13 2003/01/26 02:22:59 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
*
......@@ -174,8 +174,8 @@ int Win32Manage( intf_thread_t *p_intf )
{
vlc_bool_t b_need_menus = VLC_FALSE;
input_thread_t * p_input = p_intf->p_sys->p_input;
aout_instance_t * p_aout = NULL;
vout_thread_t * p_vout = NULL;
vlc_object_t * p_aout = NULL;
vlc_object_t * p_vout = NULL;
vlc_mutex_lock( &p_input->stream.stream_lock );
......@@ -229,35 +229,41 @@ int Win32Manage( intf_thread_t *p_intf )
}
/* Does the audio output require to update the menus ? */
p_aout = (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
p_aout = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_aout != NULL )
{
vlc_value_t val;
if( var_Get( (vlc_object_t *)p_aout, "intf-change", &val ) >= 0
if( var_Get( p_aout, "intf-change", &val ) >= 0
&& val.b_bool )
{
p_intf->p_sys->b_aout_update = 1;
b_need_menus = VLC_TRUE;
}
vlc_object_release( (vlc_object_t *)p_aout );
vlc_object_release( p_aout );
}
/* Does the video output require to update the menus ? */
p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
p_vout = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
vlc_value_t val;
if( var_Get( (vlc_object_t *)p_vout, "intf-change", &val ) >= 0
if( var_Get( p_vout, "intf-change", &val ) >= 0
&& val.b_bool )
{
p_intf->p_sys->b_vout_update = 1;
b_need_menus = VLC_TRUE;
}
vlc_object_release( (vlc_object_t *)p_vout );
if( var_Get( p_vout, "directx-on-top", &val ) >= 0 )
{
p_intf->p_sys->p_window->MenuOnTop->Checked = val.b_bool;
p_intf->p_sys->p_window->PopupOnTop->Checked = val.b_bool;
}
vlc_object_release( p_vout );
}
if( b_need_menus )
......
......@@ -2,7 +2,7 @@
* vout.c: Windows DirectX video output display method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: directx.c,v 1.9 2002/11/26 22:20:18 gbazin Exp $
* $Id: directx.c,v 1.10 2003/01/26 02:22:59 ipkiss Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -32,7 +32,7 @@
* surfaces that will be blitted onto the primary surface (display) to
* effectively display the pictures. This fallback method also enables us to
* display video in window mode.
*
*
*****************************************************************************/
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
......@@ -61,6 +61,8 @@ DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static void ToggleOnTop ();
static int OpenVideo ( vlc_object_t * );
static void CloseVideo ( vlc_object_t * );
......@@ -88,6 +90,8 @@ static int DirectXGetSurfaceDesc ( vout_thread_t *p_vout, picture_t *p_pic );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define ON_TOP_TEXT N_("always on top")
#define ON_TOP_LONGTEXT N_("place the directx window on top of other windows")
#define HW_YUV_TEXT N_("use hardware YUV->RGB conversions")
#define HW_YUV_LONGTEXT N_( \
"Try to use hardware acceleration for YUV->RGB conversions. " \
......@@ -105,6 +109,7 @@ static int DirectXGetSurfaceDesc ( vout_thread_t *p_vout, picture_t *p_pic );
vlc_module_begin();
add_category_hint( N_("Video"), NULL );
add_bool( "directx-on-top", 0, NULL, ON_TOP_TEXT, ON_TOP_LONGTEXT );
add_bool( "directx-hw-yuv", 1, NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT );
add_bool( "directx-use-sysmem", 0, NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT );
add_integer( "directx-window", 0, NULL, WINDOW_TEXT, WINDOW_LONGTEXT );
......@@ -130,6 +135,7 @@ vlc_module_end();
static int OpenVideo( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
......@@ -212,6 +218,11 @@ static int OpenVideo( vlc_object_t *p_this )
goto error;
}
/* Add a variable to indicate if the window should be on top of others */
var_Create( p_vout, "directx-on-top", VLC_VAR_BOOL );
val.b_bool = config_GetInt( p_vout, "directx-on-top" );
var_Set( p_vout, "directx-on-top", val );
return VLC_SUCCESS;
error:
......@@ -322,11 +333,13 @@ static void End( vout_thread_t *p_vout )
* Terminate an output method created by Create
*****************************************************************************/
static void CloseVideo( vlc_object_t *p_this )
{
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
msg_Dbg( p_vout, "CloseVideo" );
var_Destroy( p_vout, "directs-on-top" );
DirectXCloseDisplay( p_vout );
DirectXCloseDDraw( p_vout );
......@@ -378,7 +391,7 @@ static int Manage( vout_thread_t *p_vout )
* decided to isolate PeekMessage in another thread. */
/*
* Scale Change
* Scale Change
*/
if( p_vout->i_changes & VOUT_SCALE_CHANGE
|| p_vout->p_sys->i_changes & VOUT_SCALE_CHANGE )
......@@ -393,7 +406,7 @@ static int Manage( vout_thread_t *p_vout )
}
/*
* Size Change
* Size Change
*/
if( p_vout->i_changes & VOUT_SIZE_CHANGE
|| p_vout->p_sys->i_changes & VOUT_SIZE_CHANGE )
......@@ -455,6 +468,36 @@ static int Manage( vout_thread_t *p_vout )
}
}
/*
* "Always on top" status change
*/
HWND hwnd = p_vout->p_sys->hwnd;
HMENU hMenu = GetSystemMenu( hwnd , FALSE );
vlc_value_t val;
var_Get( p_vout, "directx-on-top", &val );
if( val.b_bool )
{
/* Set the window on top if necessary */
if( !( GetWindowLong( hwnd, GWL_EXSTYLE ) & WS_EX_TOPMOST ) )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
}
else
{
/* The window shouldn't be on top */
if( GetWindowLong( hwnd, GWL_EXSTYLE ) & WS_EX_TOPMOST )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
}
/* Check if the event thread is still running */
if( p_vout->p_sys->p_event->b_die )
{
......@@ -586,8 +629,8 @@ static int DirectXInitDDraw( vout_thread_t *p_vout )
msg_Warn( p_vout, "DirectXInitDDraw failed loading ddraw.dll" );
goto error;
}
OurDirectDrawCreate =
OurDirectDrawCreate =
(void *)GetProcAddress(p_vout->p_sys->hddraw_dll, "DirectDrawCreate");
if ( OurDirectDrawCreate == NULL )
{
......@@ -748,7 +791,7 @@ static int DirectXCreateClipper( vout_thread_t *p_vout )
msg_Warn( p_vout, "cannot attach clipper to surface (error %i)",
dxresult );
goto error;
}
}
return VLC_SUCCESS;
......@@ -1206,7 +1249,7 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic,
/*****************************************************************************
* FreePicture: destroy a picture vector allocated with NewPictureVec
*****************************************************************************
*
*
*****************************************************************************/
static void FreePictureVec( vout_thread_t *p_vout, picture_t *p_pic,
int i_num_pics )
......
......@@ -2,7 +2,7 @@
* events.c: Windows DirectX video output events handler
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: events.c,v 1.8 2002/11/25 03:12:42 ipkiss Exp $
* $Id: events.c,v 1.9 2003/01/26 02:22:59 ipkiss Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -629,27 +629,15 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
return 0; /* this stops them from happening */
case IDM_TOGGLE_ON_TOP: /* toggle the "on top" status */
{
HMENU hMenu = GetSystemMenu( hwnd , FALSE );
vlc_value_t val;
msg_Dbg( p_vout, "WinProc WM_SYSCOMMAND: IDM_TOGGLE_ON_TOP");
// Check if the window is already on top
if( GetWindowLong( hwnd, GWL_EXSTYLE ) & WS_EX_TOPMOST )
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_UNCHECKED );
SetWindowPos( hwnd, HWND_NOTOPMOST,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
else
{
CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
MF_BYCOMMAND | MFS_CHECKED );
SetWindowPos( hwnd, HWND_TOPMOST,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
}
/* Get the current value... */
if( var_Get( p_vout, "directx-on-top", &val ) < 0 )
return 0;
/* ...and change it */
val.b_bool = !val.b_bool;
var_Set( p_vout, "directx-on-top", val );
return 0;
break;
}
......
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