Commit 66042f7a authored by Gildas Bazin's avatar Gildas Bazin

* modules/video_output/directx/*: embedded vout plays nicer with multi-monitor setups.

parent 8987cc14
...@@ -514,26 +514,36 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -514,26 +514,36 @@ static int Manage( vout_thread_t *p_vout )
/* We need to switch between Maximized and Normal sized window */ /* We need to switch between Maximized and Normal sized window */
window_placement.length = sizeof(WINDOWPLACEMENT); window_placement.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );
if( p_vout->b_fullscreen ) if( p_vout->b_fullscreen )
{ {
if( p_vout->p_sys->hparent ) if( p_vout->p_sys->hparent )
{ {
POINT point;
/* Retrieve the window position */
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hwnd, &point );
SetParent( p_vout->p_sys->hwnd, GetDesktopWindow() ); SetParent( p_vout->p_sys->hwnd, GetDesktopWindow() );
SetWindowPos( p_vout->p_sys->hwnd, 0, point.x, point.y, 0, 0,
SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );
SetForegroundWindow( p_vout->p_sys->hwnd ); SetForegroundWindow( p_vout->p_sys->hwnd );
} }
/* Maximized window */ /* Maximized window */
GetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );
window_placement.showCmd = SW_SHOWMAXIMIZED; window_placement.showCmd = SW_SHOWMAXIMIZED;
/* Change window style, no borders and no title bar */ /* Change window style, no borders and no title bar */
i_style = WS_CLIPCHILDREN; i_style = WS_CLIPCHILDREN | WS_VISIBLE | WS_POPUP;
} }
else else
{ {
if( p_vout->p_sys->hparent ) if( p_vout->p_sys->hparent )
{ {
SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent ); SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0, 0, 0,
SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );
i_style = WS_CLIPCHILDREN | WS_VISIBLE | WS_CHILD; i_style = WS_CLIPCHILDREN | WS_VISIBLE | WS_CHILD;
SetForegroundWindow( p_vout->p_sys->hparent );
} }
else else
{ {
...@@ -542,6 +552,7 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -542,6 +552,7 @@ static int Manage( vout_thread_t *p_vout )
} }
/* Normal window */ /* Normal window */
GetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );
window_placement.showCmd = SW_SHOWNORMAL; window_placement.showCmd = SW_SHOWNORMAL;
/* Make sure the mouse cursor is displayed */ /* Make sure the mouse cursor is displayed */
...@@ -551,6 +562,8 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -551,6 +562,8 @@ static int Manage( vout_thread_t *p_vout )
/* Change window style, borders and title bar */ /* Change window style, borders and title bar */
SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE, i_style ); SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE, i_style );
SetWindowPlacement( p_vout->p_sys->hwnd, &window_placement ); SetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );
/* Update the object variable and trigger callback */ /* Update the object variable and trigger callback */
val.b_bool = p_vout->b_fullscreen; val.b_bool = p_vout->b_fullscreen;
......
...@@ -893,6 +893,7 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -893,6 +893,7 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
{ {
double f_arg; double f_arg;
RECT rect_window; RECT rect_window;
POINT point;
switch( i_query ) switch( i_query )
{ {
...@@ -921,12 +922,16 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -921,12 +922,16 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
p_vout->p_sys->hparent = 0; p_vout->p_sys->hparent = 0;
vlc_mutex_unlock( &p_vout->p_sys->lock ); vlc_mutex_unlock( &p_vout->p_sys->lock );
/* Retrieve the window position */
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hwnd, &point );
SetParent( p_vout->p_sys->hwnd, GetDesktopWindow() ); SetParent( p_vout->p_sys->hwnd, GetDesktopWindow() );
SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE, SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE,
WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW |
WS_SIZEBOX | WS_VISIBLE ); WS_SIZEBOX | WS_VISIBLE );
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0, 0, 0, SetWindowPos( p_vout->p_sys->hwnd, 0, point.x, point.y, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED ); SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );
return VLC_SUCCESS; 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