Commit 64c48e9c authored by Olivier Teulière's avatar Olivier Teulière

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