📄 directx_fullscreen.diff
字号:
Index: modules/video_output/directx/directx.c
===================================================================
--- modules/video_output/directx/directx.c (revision 8308)
+++ modules/video_output/directx/directx.c (working copy)
@@ -468,8 +468,6 @@
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
- WINDOWPLACEMENT window_placement;
-
/* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */
vlc_mutex_lock( &p_vout->p_sys->lock );
@@ -541,13 +539,10 @@
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
|| p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
{
- int i_style = 0;
vlc_value_t val;
p_vout->b_fullscreen = ! p_vout->b_fullscreen;
- /* We need to switch between Maximized and Normal sized window */
- window_placement.length = sizeof(WINDOWPLACEMENT);
if( p_vout->b_fullscreen )
{
if( p_vout->p_sys->hparent )
@@ -557,45 +552,57 @@
/* Retrieve the window position */
point.x = point.y = 0;
ClientToScreen( p_vout->p_sys->hwnd, &point );
+
+ /* Make desktop the parent window */
SetParent( p_vout->p_sys->hwnd, GetDesktopWindow() );
+
+ /* Move window to the position on screen where it was before
+ * making the desktop parent. */
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 );
}
+
+ /* Change window style, no borders and no title bar */
+ SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE,
+ WS_CLIPCHILDREN | WS_VISIBLE | WS_POPUP );
- /* Maximized window */
- GetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );
- window_placement.showCmd = SW_SHOWMAXIMIZED;
- /* Change window style, no borders and no title bar */
- i_style = WS_CLIPCHILDREN | WS_VISIBLE | WS_POPUP;
+ /* Maximize window */
+ ShowWindow( p_vout->p_sys->hwnd, SW_SHOWMAXIMIZED );
}
else
{
+ /* Restore window to normal size */
+ ShowWindow( p_vout->p_sys->hwnd, SW_SHOWNORMAL );
+
if( p_vout->p_sys->hparent )
{
+ /* Change window style back */
+ SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE,
+ WS_CLIPCHILDREN | WS_VISIBLE | WS_CHILD );
+
+ /* Embed window again */
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;
+ SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
+
SetForegroundWindow( p_vout->p_sys->hparent );
}
else
{
- i_style = WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW |
- WS_SIZEBOX | WS_VISIBLE;
+ /* We have a stand alone window, give it a title bar, etc */
+ SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE,
+ WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW |
+ WS_SIZEBOX | WS_VISIBLE);
}
- /* Normal window */
- GetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );
- window_placement.showCmd = SW_SHOWNORMAL;
-
/* Make sure the mouse cursor is displayed */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
}
- /* Change window style, borders and title bar */
- SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE, i_style );
- SetWindowPlacement( p_vout->p_sys->hwnd, &window_placement );
+ /* Send WM_NCCALCSIZE to window. */
SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -