[vlc-devel] [PATCH] win32: fix Controls/toolbar never appears over embed element (ref #18831)

Pierre Lamot pierre at videolabs.io
Fri Nov 17 18:14:07 CET 2017


---
 common/win32_fullscreen.cpp | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/common/win32_fullscreen.cpp b/common/win32_fullscreen.cpp
index a11b2fe..17160f0 100644
--- a/common/win32_fullscreen.cpp
+++ b/common/win32_fullscreen.cpp
@@ -443,9 +443,10 @@ void VLCControlsWnd::RegisterToVLCEvents()
 
 void VLCControlsWnd::NeedShowControls()
 {
-    if( !(GetWindowLong(hWnd(), GWL_STYLE) & WS_VISIBLE) ) {
-        if(WM().IsFullScreen() || (PO() && PO()->get_show_toolbar() ) )
-            ShowWindow( hWnd(), SW_SHOW );
+    if ( WM().IsFullScreen() || (PO() && PO()->get_show_toolbar()) )
+    {
+        SetWindowPos( hWnd(),  HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
+        ShowWindow( hWnd(), SW_SHOW );
     }
     SetTimer(hWnd(), 1, 2 * 1000, nullptr);
 }
@@ -898,6 +899,19 @@ void VLCWindowsManager::StartFullScreen()
                      FSFlags);
 
         ShowWindow(_FSWnd->getHWND(), SW_SHOW);
+
+        HWND controlWindow = _HolderWnd->ControlWindow()->hWnd();
+        //parenting to NULL promotes window to WS_POPUP
+        SetParent(controlWindow, NULL);
+        //Ensure control window is on the right screen
+        RECT controlRect;
+        GetWindowRect(controlWindow, &controlRect);
+        OffsetRect(&controlRect, FSRect.left - controlRect.left, FSRect.bottom - controlRect.bottom);
+        SetWindowPos(controlWindow,  HWND_TOPMOST,
+                     controlRect.left, controlRect.top,
+                     controlRect.right - controlRect.left, controlRect.bottom - controlRect.top,
+                     SWP_FRAMECHANGED);
+
     }
 }
 
@@ -918,6 +932,10 @@ void VLCWindowsManager::EndFullScreen()
 
         _FSWnd->DestroyWindow();
         _FSWnd = nullptr;
+
+        HWND controlWindow = _HolderWnd->ControlWindow()->hWnd();
+        SetParent(controlWindow, _HolderWnd->hWnd());
+        SetWindowPos(controlWindow,  HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
    }
 }
 
-- 
2.14.1



More information about the vlc-devel mailing list