[vlc-devel] commit: skins(Win32): fix minimize not functioning (see #3300) ( Erwan Tulou )

git version control git at videolan.org
Sat Feb 27 00:06:10 CET 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Fri Feb 26 22:49:18 2010 +0100| [544d405502d2bd119328426c9c934d23c7414432] | committer: Erwan Tulou 

skins(Win32): fix minimize not functioning (see #3300)

This patch
    - uses owner/owned windows so that all skins2 windows get
    minimized at the same time
    - add WS_MINIMIZEBOX to enable minimize in taskbar button
    - some cosmetic

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=544d405502d2bd119328426c9c934d23c7414432
---

 modules/gui/skins2/win32/win32_factory.cpp |   24 ++++++++++++++----------
 modules/gui/skins2/win32/win32_factory.hpp |    2 ++
 modules/gui/skins2/win32/win32_window.cpp  |   19 ++++++++-----------
 3 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/modules/gui/skins2/win32/win32_factory.cpp b/modules/gui/skins2/win32/win32_factory.cpp
index 812beda..395ba6d 100644
--- a/modules/gui/skins2/win32/win32_factory.cpp
+++ b/modules/gui/skins2/win32/win32_factory.cpp
@@ -53,15 +53,9 @@ LRESULT CALLBACK Win32Proc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
         return DefWindowProc( hwnd, uMsg, wParam, lParam );
     }
 
-    // Here we know we are getting a message for the parent window, since it is
-    // the only one to store p_intf...
-    // Yes, it is a kludge :)
-
-//Win32Factory *pFactory = (Win32Factory*)Win32Factory::instance( p_intf );
-//msg_Err( p_intf, "Parent window %p %p %u %i\n", pFactory->m_hParentWindow, hwnd, uMsg, wParam );
-    // If Window is parent window
-    // XXX: this test isn't needed, see the kludge above...
-//    if( hwnd == pFactory->m_hParentWindow )
+    Win32Factory *pFactory = (Win32Factory*)Win32Factory::instance( p_intf );
+
+    if( hwnd == pFactory->getParentWindow() )
     {
         if( uMsg == WM_SYSCOMMAND )
         {
@@ -71,6 +65,16 @@ LRESULT CALLBACK Win32Proc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
                 libvlc_Quit( p_intf->p_libvlc );
                 return 0;
             }
+            else if( wParam == SC_MINIMIZE )
+            {
+                pFactory->minimize();
+                return 0;
+            }
+            else if( wParam == SC_RESTORE )
+            {
+                pFactory->restore();
+                return 0;
+            }
             else
             {
                 msg_Dbg( p_intf, "WM_SYSCOMMAND %i", wParam );
@@ -176,7 +180,7 @@ bool Win32Factory::init()
 
     // Create Window
     m_hParentWindow = CreateWindowEx( WS_EX_TOOLWINDOW, _T("SkinWindowClass"),
-        _T("VLC media player"), WS_SYSMENU|WS_POPUP,
+        _T("VLC media player"), WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX,
         -200, -200, 0, 0, 0, 0, m_hInst, 0 );
     if( m_hParentWindow == NULL )
     {
diff --git a/modules/gui/skins2/win32/win32_factory.hpp b/modules/gui/skins2/win32/win32_factory.hpp
index 93c688a..49d8596 100644
--- a/modules/gui/skins2/win32/win32_factory.hpp
+++ b/modules/gui/skins2/win32/win32_factory.hpp
@@ -128,6 +128,8 @@ public:
     BOOL (WINAPI *SetLayeredWindowAttributes)( HWND, COLORREF,
                                                BYTE, DWORD );
 
+    HWND getParentWindow() { return m_hParentWindow; }
+
 private:
     /// Handle of the instance
     HINSTANCE m_hInst;
diff --git a/modules/gui/skins2/win32/win32_window.cpp b/modules/gui/skins2/win32/win32_window.cpp
index a26bc65..18c8618 100644
--- a/modules/gui/skins2/win32/win32_window.cpp
+++ b/modules/gui/skins2/win32/win32_window.cpp
@@ -51,6 +51,8 @@ Win32Window::Win32Window( intf_thread_t *pIntf, GenericWindow &rWindow,
     OSWindow( pIntf ), m_dragDrop( dragDrop ), m_isLayered( false ),
     m_pParent( pParentWindow ), m_type ( type )
 {
+    Win32Factory *pFactory = (Win32Factory*)Win32Factory::instance( getIntf() );
+
     // Create the window
     if( type == GenericWindow::VoutWindow )
     {
@@ -59,27 +61,23 @@ Win32Window::Win32Window( intf_thread_t *pIntf, GenericWindow &rWindow,
         m_hWnd = CreateWindowEx( WS_EX_TOOLWINDOW | WS_EX_NOPARENTNOTIFY,
                      "VoutWindowClass", "default name",
                      WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
-                     CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-                     m_hWnd_parent, 0, hInst, NULL );
+                     0, 0, 0, 0, m_hWnd_parent, 0, hInst, NULL );
     }
     else if( type == GenericWindow::FullscreenWindow )
     {
-        // Normal window
-        m_hWnd_parent = NULL;
+        // top-level window
         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 );
+            0, 0, 0, 0, NULL, 0, hInst, NULL );
     }
 
     else
     {
-        // Normal window
-        m_hWnd_parent =  NULL;
+        // top-level window (owned by the root window)
+        HWND hWnd_owner = pFactory->getParentWindow();
         m_hWnd = CreateWindowEx( WS_EX_TOOLWINDOW, "SkinWindowClass",
             "default name", WS_POPUP | WS_CLIPCHILDREN,
-            CW_USEDEFAULT, CW_USEDEFAULT,
-            CW_USEDEFAULT, CW_USEDEFAULT, m_hWnd_parent, 0, hInst, NULL );
+            0, 0, 0, 0, hWnd_owner, 0, hInst, NULL );
     }
 
     if( !m_hWnd )
@@ -89,7 +87,6 @@ Win32Window::Win32Window( intf_thread_t *pIntf, GenericWindow &rWindow,
     }
 
     // Store a pointer to the GenericWindow in a map
-    Win32Factory *pFactory = (Win32Factory*)Win32Factory::instance( getIntf() );
     pFactory->m_windowMap[m_hWnd] = &rWindow;
 
     // Drag & drop




More information about the vlc-devel mailing list