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

Pierre Lamot git at videolan.org
Mon Nov 20 11:11:30 CET 2017


npapi-vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Fri Nov 17 18:14:07 2017 +0100| [aa98041e46e34ba4698bdf50a3fbf240246729b4] | committer: Jean-Baptiste Kempf

win32: fix Controls/toolbar never appears over embed element (ref #18831)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> https://code.videolan.org/videolan/npapi-vlc/commit/aa98041e46e34ba4698bdf50a3fbf240246729b4
---

 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);
    }
 }
 



More information about the vlc-commits mailing list