[vlc-commits] Win32: added support for disabling fullscreen mode

Sergey Radionov git at videolan.org
Fri Jan 13 12:01:06 CET 2012


npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Tue Jan 10 19:31:29 2012 +0700| [75229ae89969c82099c3c66a1eb09d770459692d] | committer: Jean-Baptiste Kempf

Win32: added support for disabling fullscreen mode

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

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=75229ae89969c82099c3c66a1eb09d770459692d
---

 common/win32_fullscreen.cpp |   37 ++++++++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/common/win32_fullscreen.cpp b/common/win32_fullscreen.cpp
index 8243095..6bb8575 100644
--- a/common/win32_fullscreen.cpp
+++ b/common/win32_fullscreen.cpp
@@ -190,9 +190,13 @@ LRESULT VLCControlsWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
             SendMessage(hVolumeSlider, TBM_SETTICFREQ, (WPARAM) 10, 0);
 
             ControlWidth = ButtonsWidth;
+            DWORD dwFSBtnStyle = WS_CHILD|BS_BITMAP|BS_FLAT;
+            if( !PO() || PO()->get_enable_fs() ){
+                dwFSBtnStyle |= WS_VISIBLE;
+            }
             hFSButton =
                 CreateWindow(TEXT("BUTTON"), TEXT("Toggle fullscreen"),
-                             WS_CHILD|WS_VISIBLE|BS_BITMAP|BS_FLAT,
+                             dwFSBtnStyle,
                              HorizontalOffset, xControlsSpace,
                              ControlWidth, ControlsHeight, hWnd(),
                              (HMENU)ID_FS_SWITCH_FS, 0, 0);
@@ -309,6 +313,9 @@ LRESULT VLCControlsWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
             const int new_client_width = LOWORD(lParam);
             const int new_client_height = HIWORD(lParam);
 
+            bool isFSBtnVisible =
+                (GetWindowLong(hFSButton, GWL_STYLE) & WS_VISIBLE) != 0;
+
             HDWP hDwp = BeginDeferWindowPos(4);
 
             int VideoScrollWidth = new_client_width;
@@ -334,11 +341,13 @@ LRESULT VLCControlsWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
             VideoScrollWidth -= xControlsSpace;
             VideoScrollWidth -= (VolumeRect.right - VolumeRect.left);
 
-            RECT FSRect;
-            GetWindowRect(hFSButton, &FSRect);
-            VideoScrollWidth -= xControlsSpace;
-            VideoScrollWidth -= (FSRect.right - FSRect.left);
-            VideoScrollWidth -= xControlsSpace;
+            RECT FSRect = {0, 0, 0, 0};
+            if( isFSBtnVisible ) {
+                GetWindowRect(hFSButton, &FSRect);
+                VideoScrollWidth -= xControlsSpace;
+                VideoScrollWidth -= (FSRect.right - FSRect.left);
+                VideoScrollWidth -= xControlsSpace;
+            }
 
             pt.x = VideoSrcollRect.left;
             pt.y = VideoSrcollRect.top;
@@ -368,12 +377,14 @@ LRESULT VLCControlsWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
             HorizontalOffset +=
                 VolumeRect.right - VolumeRect.left + xControlsSpace;
 
-            pt.x = 0;
-            pt.y = FSRect.top;
-            ScreenToClient(hWnd(), &pt);
-            hDwp = DeferWindowPos(hDwp, hFSButton, 0,
-                                  HorizontalOffset, pt.y, 0, 0,
-                                  SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOOWNERZORDER);
+            if( isFSBtnVisible ) {
+                pt.x = 0;
+                pt.y = FSRect.top;
+                ScreenToClient(hWnd(), &pt);
+                hDwp = DeferWindowPos(hDwp, hFSButton, 0,
+                                      HorizontalOffset, pt.y, 0, 0,
+                                      SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOOWNERZORDER);
+            }
 
             EndDeferWindowPos(hDwp);
             break;
@@ -1004,7 +1015,7 @@ void VLCWindowsManager::LibVlcDetach()
 
 void VLCWindowsManager::StartFullScreen()
 {
-    if(!_HolderWnd)
+    if( !_HolderWnd || ( PO() && !PO()->get_enable_fs() ) )
         return;//VLCWindowsManager::CreateWindows was not called
 
     if(getMD()&&!IsFullScreen()){



More information about the vlc-commits mailing list