]> git.sesse.net Git - vlc/blobdiff - modules/video_output/msw/events.c
Moved a lock creation to CreateEventThread.
[vlc] / modules / video_output / msw / events.c
index 9c6598732d06630885ecac19a0a376c5d0ceed8a..bbf5931bf3f9b460b9b03dc24c83031cbea6106f 100644 (file)
 #include <vlc_keys.h>
 #include "vout.h"
 
+#ifndef UNDER_CE
+#include <vlc_windows_interfaces.h>
+#endif
+
 #ifdef UNDER_CE
 #include <aygshell.h>
     //WINSHELLAPI BOOL WINAPI SHFullScreen(HWND hwndRequester, DWORD dwState);
@@ -343,7 +347,6 @@ void* EventThread( vlc_object_t *p_this )
 #endif
             }
 
-#ifdef UNICODE
             {
                 wchar_t *psz_title = malloc( strlen(val.psz_string) * 2 + 2 );
                 if( psz_title )
@@ -353,7 +356,6 @@ void* EventThread( vlc_object_t *p_this )
                     free( val.psz_string ); val.psz_string = (char *)psz_title;
                 }
             }
-#endif
 
             SetWindowText( p_event->p_vout->p_sys->hwnd,
                            (LPCTSTR)val.psz_string );
@@ -647,7 +649,7 @@ void UpdateRects( vout_thread_t *p_vout, bool b_force )
 #define rect_dest p_vout->p_sys->rect_dest
 #define rect_dest_clipped p_vout->p_sys->rect_dest_clipped
 
-    int i_width, i_height, i_x, i_y;
+    unsigned int i_width, i_height, i_x, i_y;
 
     RECT  rect;
     POINT point;
@@ -717,7 +719,7 @@ void UpdateRects( vout_thread_t *p_vout, bool b_force )
 
 #ifndef NDEBUG
     msg_Dbg( p_vout, "DirectXUpdateRects image_dst_clipped coords:"
-                     " %i,%i,%i,%i",
+                     " %li,%li,%li,%li",
                      rect_dest_clipped.left, rect_dest_clipped.top,
                      rect_dest_clipped.right, rect_dest_clipped.bottom );
 #endif
@@ -778,7 +780,7 @@ void UpdateRects( vout_thread_t *p_vout, bool b_force )
 
 #ifndef NDEBUG
     msg_Dbg( p_vout, "DirectXUpdateRects image_src_clipped"
-                     " coords: %i,%i,%i,%i",
+                     " coords: %li,%li,%li,%li",
                      rect_src_clipped.left, rect_src_clipped.top,
                      rect_src_clipped.right, rect_src_clipped.bottom );
 #endif
@@ -795,6 +797,39 @@ void UpdateRects( vout_thread_t *p_vout, bool b_force )
         DirectDrawUpdateOverlay( p_vout );
 #endif
 
+#ifndef UNDER_CE
+    /* Windows 7 taskbar thumbnail code */
+    LPTASKBARLIST3 p_taskbl;
+    OSVERSIONINFO winVer;
+    winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+    if( GetVersionEx(&winVer) && winVer.dwMajorVersion > 5 )
+    {
+        CoInitialize( 0 );
+
+        if( S_OK == CoCreateInstance( &clsid_ITaskbarList,
+                    NULL, CLSCTX_INPROC_SERVER,
+                    &IID_ITaskbarList3,
+                    &p_taskbl) )
+        {
+            RECT rect_video, rect_parent, rect_relative;
+            HWND hroot = GetAncestor(p_vout->p_sys->hwnd,GA_ROOT);
+
+            p_taskbl->vt->HrInit(p_taskbl);
+            GetWindowRect(p_vout->p_sys->hvideownd, &rect_video);
+            GetWindowRect(hroot, &rect_parent);
+            rect_relative.left = rect_video.left - rect_parent.left - 8;
+            rect_relative.right = rect_video.right - rect_video.left + rect_relative.left;
+            rect_relative.top = rect_video.top - rect_parent.top - 10;
+            rect_relative.bottom = rect_video.bottom - rect_video.top + rect_relative.top - 25;
+
+            if (S_OK != p_taskbl->vt->SetThumbnailClip(p_taskbl, hroot, &rect_relative))
+                msg_Err( p_vout, "SetThumbNailClip failed");
+
+            p_taskbl->vt->Release(p_taskbl);
+        }
+        CoUninitialize();
+    }
+#endif
     /* Signal the change in size/position */
     p_vout->p_sys->i_changes |= DX_POSITION_CHANGE;
 
@@ -829,7 +864,8 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
     }
     else
     {
-        p_vout = (vout_thread_t *)GetWindowLongPtr( hwnd, GWLP_USERDATA );
+        LONG_PTR p_user_data = GetWindowLongPtr( hwnd, GWLP_USERDATA );
+        p_vout = (vout_thread_t *)p_user_data;
         if( !p_vout )
         {
             /* Hmmm mozilla does manage somehow to save the pointer to our
@@ -1127,6 +1163,7 @@ static int vaControlParentWindow( vout_thread_t *p_vout, int i_query,
     }
 }
 
+#if 0
 static int ControlParentWindow( vout_thread_t *p_vout, int i_query, ... )
 {
     va_list args;
@@ -1137,6 +1174,7 @@ static int ControlParentWindow( vout_thread_t *p_vout, int i_query, ... )
     va_end( args );
     return ret;
 }
+#endif
 
 void Win32ToggleFullscreen( vout_thread_t *p_vout )
 {
@@ -1173,7 +1211,7 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
             *on the right screen */
             HMONITOR hmon = MonitorFromWindow(p_vout->p_sys->hparent,
                                             MONITOR_DEFAULTTONEAREST);
-            MONITORINFO mi = {sizeof(mi)};
+            MONITORINFO mi;
             if (GetMonitorInfo(hmon, &mi))
             SetWindowPos( hwnd, 0,
                             mi.rcMonitor.left,
@@ -1296,6 +1334,9 @@ void RestoreScreensaver( vout_thread_t *p_vout )
 
 int CreateEventThread( vout_thread_t *p_vout )
 {
+    if( !( p_vout->p_sys->i_changes & SWITCHING_MODE_FLAG ) )
+        vlc_mutex_init( &p_vout->p_sys->lock );
+
     /* Create the Vout EventThread, this thread is created by us to isolate
      * the Win32 PeekMessage function calls. We want to do this because
      * Windows can stay blocked inside this call for a long time, and when
@@ -1360,6 +1401,6 @@ void StopEventThread( vout_thread_t *p_vout )
         vlc_object_release( p_vout->p_sys->p_event );
     }
 
-    if( !p_vout->p_sys->i_changes & SWITCHING_MODE_FLAG )
+    if( !( p_vout->p_sys->i_changes & SWITCHING_MODE_FLAG ) )
         vlc_mutex_destroy( &p_vout->p_sys->lock );
 }