]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/win32/win32_factory.cpp
skins(Win32): fix minimize not functioning (see #3300)
[vlc] / modules / gui / skins2 / win32 / win32_factory.cpp
index 812beda3d487ac064e7e29c964fc96f6838da572..395ba6d545e780056931ad42c20cd7d6236811be 100644 (file)
@@ -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 )
     {