[vlc-commits] vout: win32: Fix thumbnail rect

Hugo Beauzée-Luyssen git at videolan.org
Mon Mar 27 13:28:19 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Mar 27 13:19:00 2017 +0200| [849d937fcbb8fcf3f2e8a3f68811090b9330d87f] | committer: Hugo Beauzée-Luyssen

vout: win32: Fix thumbnail rect

Fix #9941

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

 modules/video_output/win32/common.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index e331cf1..719e749 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -544,20 +544,25 @@ static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
         taskbl->lpVtbl->HrInit(taskbl);
 
         HWND hroot = GetAncestor(sys->hwnd,GA_ROOT);
-        RECT relative;
+        RECT video;
         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;
+            GetWindowRect(sys->hparent, &video);
+            POINT client = {video.left, video.top};
+            if (ScreenToClient(hroot, &client))
+            {
+                unsigned int width = video.right - video.left;
+                unsigned int height = video.bottom - video.top;
+                video.left = client.x;
+                video.top = client.y;
+                video.right = video.left + width;
+                video.bottom = video.top + height;
+            }
         }
-        if (S_OK != taskbl->lpVtbl->SetThumbnailClip(taskbl, hroot,
-                                                 show ? &relative : NULL))
-            msg_Err(vd, "SetThumbNailClip failed");
+        HRESULT hr;
+        hr = taskbl->lpVtbl->SetThumbnailClip(taskbl, hroot,
+                                                 show ? &video : NULL);
+        if ( hr != S_OK )
+            msg_Err(vd, "SetThumbNailClip failed: %u", hr);
 
         taskbl->lpVtbl->Release(taskbl);
     }



More information about the vlc-commits mailing list