[vlc-commits] commit: Moved win7 taskbar disabling code from qt4 to msw. (Laurent Aimar )

git at videolan.org git at videolan.org
Tue Apr 27 00:45:48 CEST 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Apr 27 00:21:00 2010 +0200| [99388401035a3290b916e4878b004acb3ed5ab8f] | committer: Laurent Aimar 

Moved win7 taskbar disabling code from qt4 to msw.

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

 modules/gui/qt4/components/interface_widgets.cpp |   24 -------
 modules/video_output/msw/common.c                |   78 +++++++++++++---------
 2 files changed, 47 insertions(+), 55 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index ce17b9d..0539424 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -239,30 +239,6 @@ void VideoWidget::release( void )
     msg_Dbg( p_intf, "Video is not needed anymore" );
     //layout->removeWidget( reparentable );
 
-#ifdef WIN32
-    /* Come back to default thumbnail for Windows 7 taskbar */
-    LPTASKBARLIST3 p_taskbl;
-
-    CoInitialize( 0 );
-
-    if( S_OK == CoCreateInstance( &clsid_ITaskbarList,
-                NULL, CLSCTX_INPROC_SERVER,
-                &IID_ITaskbarList3,
-                (void **)&p_taskbl) )
-    {
-        p_taskbl->vt->HrInit(p_taskbl);
-
-        HWND hroot = GetAncestor(reparentable->winId(),GA_ROOT);
-
-        if (S_OK != p_taskbl->vt->SetThumbnailClip(p_taskbl, hroot, NULL))
-            msg_Err(p_intf, "SetThumbNailClip failed");
-        msg_Err(p_intf, "Releasing taskbar | root handle = %08x", hroot);
-        p_taskbl->vt->Release(p_taskbl);
-    }
-    CoUninitialize();
-
-#endif
-
     delete reparentable;
     reparentable = NULL;
     updateGeometry();
diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c
index 8dd2d79..ebc814a 100644
--- a/modules/video_output/msw/common.c
+++ b/modules/video_output/msw/common.c
@@ -60,6 +60,7 @@
     //WINSHELLAPI BOOL WINAPI SHFullScreen(HWND hwndRequester, DWORD dwState);
 #endif
 
+static void CommonChangeThumbnailClip(vout_display_t *, bool show);
 static int CommonControlSetFullscreen(vout_display_t *, bool is_fullscreen);
 
 static void DisableScreensaver(vout_display_t *);
@@ -135,6 +136,7 @@ void CommonClean(vout_display_t *vd)
     vout_display_sys_t *sys = vd->sys;
 
     if (sys->event) {
+        CommonChangeThumbnailClip(vd, false);
         EventThreadStop(sys->event);
         EventThreadDestroy(sys->event);
     }
@@ -230,6 +232,49 @@ void AlignRect(RECT *r, int align_boundary, int align_size)
         r->right = ((r->right - r->left + align_size/2) & ~align_size) + r->left;
 }
 
+/* */
+static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
+{
+#ifndef UNDER_CE
+    vout_display_sys_t *sys = vd->sys;
+
+    /* Windows 7 taskbar thumbnail code */
+    OSVERSIONINFO winVer;
+    winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+    if (!GetVersionEx(&winVer) || winVer.dwMajorVersion <= 5)
+        return;
+
+    CoInitialize(0);
+
+    LPTASKBARLIST3 taskbl;
+    if (S_OK == CoCreateInstance(&clsid_ITaskbarList,
+                                 NULL, CLSCTX_INPROC_SERVER,
+                                 &IID_ITaskbarList3,
+                                 &taskbl)) {
+        taskbl->vt->HrInit(taskbl);
+
+        HWND hroot = GetAncestor(sys->hwnd,GA_ROOT);
+        RECT relative;
+        if (show) {
+            RECT video, parent;
+            GetWindowRect(sys->hvideownd, &video);
+            GetWindowRect(hroot, &parent);
+            relative.left   = video.left   - parent.left - 8;
+            relative.top    = video.top    - parent.top - 10;
+
+            relative.right  = video.right  - video.left + relative.left;
+            relative.bottom = video.bottom - video.top  + relative.top - 25;
+        }
+        if (S_OK != taskbl->vt->SetThumbnailClip(taskbl, hroot,
+                                                 show ? &relative : NULL))
+            msg_Err(vd, "SetThumbNailClip failed");
+
+        taskbl->vt->Release(taskbl);
+    }
+    CoUninitialize();
+#endif
+}
+
 /*****************************************************************************
  * UpdateRects: update clipping rectangles
  *****************************************************************************
@@ -397,37 +442,8 @@ void UpdateRects(vout_display_t *vd,
     rect_dest_clipped.bottom -= sys->rect_display.top;
 #endif
 
-#ifndef UNDER_CE
-    /* Windows 7 taskbar thumbnail code */
-    LPTASKBARLIST3 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,
-                                     &taskbl)) {
-            RECT rect_video, rect_parent, rect_relative;
-            HWND hroot = GetAncestor(sys->hwnd,GA_ROOT);
-
-            taskbl->vt->HrInit(taskbl);
-            GetWindowRect(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 != taskbl->vt->SetThumbnailClip(taskbl, hroot, &rect_relative))
-                msg_Err(vd, "SetThumbNailClip failed");
-
-            taskbl->vt->Release(taskbl);
-        }
-        CoUninitialize();
-    }
-#endif
+    CommonChangeThumbnailClip(vd, true);
+
     /* Signal the change in size/position */
     sys->changes |= DX_POSITION_CHANGE;
 



More information about the vlc-commits mailing list