]> git.sesse.net Git - vlc/commitdiff
skins2(Windows): add a black windows for fullscreen and manage z-order
authorErwan Tulou <erwan10@videolan.org>
Sun, 20 Dec 2009 09:00:35 +0000 (10:00 +0100)
committerErwan Tulou <erwan10@videolan.org>
Sat, 26 Dec 2009 22:21:51 +0000 (23:21 +0100)
modules/gui/skins2/win32/win32_factory.cpp
modules/gui/skins2/win32/win32_factory.hpp
modules/gui/skins2/win32/win32_window.cpp

index 0a1cba57c250be05cc8380a6e61a06558411ca69..3618886dea05b5fce1402b6d2a8f950c86b7e1e1 100644 (file)
@@ -129,7 +129,7 @@ bool Win32Factory::init()
     skinWindowClass.cbClsExtra = 0;
     skinWindowClass.cbWndExtra = 0;
     skinWindowClass.hbrBackground = NULL;
-    skinWindowClass.hCursor = LoadCursor( NULL , IDC_ARROW );
+    skinWindowClass.hCursor = LoadCursor( NULL, IDC_ARROW );
     skinWindowClass.hIcon = LoadIcon( m_hInst, _T("VLC_ICON") );
     skinWindowClass.hInstance = m_hInst;
 
@@ -147,6 +147,34 @@ bool Win32Factory::init()
         }
     }
 
+
+    // Create window class for window of VoutWindow type
+    WNDCLASS voutWindowClass;
+    voutWindowClass.style = CS_OWNDC|CS_DBLCLKS;
+    voutWindowClass.lpfnWndProc = (WNDPROC) Win32Proc;
+    voutWindowClass.lpszClassName = _T("VoutWindowClass");
+    voutWindowClass.lpszMenuName = NULL;
+    voutWindowClass.cbClsExtra = 0;
+    voutWindowClass.cbWndExtra = 0;
+    voutWindowClass.hbrBackground = (HBRUSH__*) GetStockObject( BLACK_BRUSH);
+    voutWindowClass.hCursor = LoadCursor( NULL , IDC_ARROW );
+    voutWindowClass.hIcon = LoadIcon( m_hInst, _T("VLC_ICON") );
+    voutWindowClass.hInstance = m_hInst;
+
+    // Register class and check it
+    if( !RegisterClass( &voutWindowClass ) )
+    {
+        WNDCLASS wndclass;
+
+        // Check why it failed. If it's because the class already exists
+        // then fine, otherwise return with an error.
+        if( !GetClassInfo( m_hInst, _T("VoutWindowClass"), &wndclass ) )
+        {
+            msg_Err( getIntf(), "cannot register voutWindow window class" );
+            return false;
+        }
+    }
+
     // Create Window
     m_hParentWindow = CreateWindowEx( WS_EX_TOOLWINDOW, _T("SkinWindowClass"),
         _T("VLC media player"), WS_SYSMENU|WS_POPUP,
index 9e4db905128c2f7bf9fe63ba8cef3e1eb79ab484..93c688a22aa9115ab5a4e74cb6d770a0e56ce451 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <windows.h>
 #include <shellapi.h>
+// #include <wingdi.h>
 #include "../src/os_factory.hpp"
 #include "../src/generic_window.hpp"
 
index 413168dc676729ca71998f8a981f10104bf42531..b94ad9f2862fed807873ab6a15c2c699e4b6b1f0 100644 (file)
@@ -52,19 +52,30 @@ Win32Window::Win32Window( intf_thread_t *pIntf, GenericWindow &rWindow,
     m_pParent( pParentWindow ), m_type ( type )
 {
     // Create the window
-    if( pParentWindow )
+    if( type == GenericWindow::VoutWindow )
     {
         // Child window (for vout)
         m_hWnd_parent = pParentWindow->getHandle();
         m_hWnd = CreateWindowEx( WS_EX_TOOLWINDOW | WS_EX_NOPARENTNOTIFY,
-                     "SkinWindowClass", "default name", WS_CHILD,
+                     "VoutWindowClass", "default name",
+                     WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                      CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                      m_hWnd_parent, 0, hInst, NULL );
     }
+    else if( type == GenericWindow::FullscreenWindow )
+    {
+        // Normal window
+        m_hWnd_parent = NULL;
+        m_hWnd = CreateWindowEx( WS_EX_APPWINDOW, "SkinWindowClass",
+            "default name", WS_POPUP | WS_CLIPCHILDREN,
+            CW_USEDEFAULT, CW_USEDEFAULT,
+            CW_USEDEFAULT, CW_USEDEFAULT, m_hWnd_parent, 0, hInst, NULL );
+    }
+
     else
     {
         // Normal window
-        m_hWnd_parent = hParentWindow;
+        m_hWnd_parent =  NULL;
         m_hWnd = CreateWindowEx( WS_EX_TOOLWINDOW, "SkinWindowClass",
             "default name", WS_POPUP | WS_CLIPCHILDREN,
             CW_USEDEFAULT, CW_USEDEFAULT,
@@ -121,7 +132,12 @@ void Win32Window::reparent( void* OSHandle, int x, int y, int w, int h )
 
 void Win32Window::show() const
 {
-    ShowWindow( m_hWnd, SW_SHOW );
+
+   if( m_type == GenericWindow::VoutWindow )
+       SetWindowPos( m_hWnd, HWND_BOTTOM, 0, 0, 0, 0,
+            SWP_NOMOVE | SWP_NOSIZE );
+
+   ShowWindow( m_hWnd, SW_SHOW );
 }