+void AlignRect(RECT *r, int align_boundary, int align_size)
+{
+ if (align_boundary)
+ r->left = (r->left + align_boundary/2) & ~align_boundary;
+ if (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
+}
+