[FFmpeg-cvslog] lavd/gdigrab: mouse dpi awareness

Metaksakis Georgios git at videolan.org
Mon Feb 15 00:12:10 CET 2016


ffmpeg | branch: master | Metaksakis Georgios <metaxas4 at gmail.com> | Mon Feb 15 10:05:17 2016 +1100| [00c73c475e3d2d7049eed73ea956f6798365b36a] | committer: Matt Oliver

lavd/gdigrab: mouse dpi awareness

correct mouse location on hidpi screens.
fixes ticket #5008

Signed-off-by: Matt Oliver <protogonoi at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00c73c475e3d2d7049eed73ea956f6798365b36a
---

 libavdevice/gdigrab.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index 4428a34..7db587c 100644
--- a/libavdevice/gdigrab.c
+++ b/libavdevice/gdigrab.c
@@ -446,6 +446,8 @@ static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab *gdigrab)
         POINT pos;
         RECT clip_rect = gdigrab->clip_rect;
         HWND hwnd = gdigrab->hwnd;
+        int vertres = GetDeviceCaps(gdigrab->source_hdc, VERTRES);
+        int desktopvertres = GetDeviceCaps(gdigrab->source_hdc, DESKTOPVERTRES);
         info.hbmMask = NULL;
         info.hbmColor = NULL;
 
@@ -479,6 +481,10 @@ static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab *gdigrab)
             }
         }
 
+        //that would keep the correct location of mouse with hidpi screens
+        pos.x = pos.x * desktopvertres / vertres;
+        pos.y = pos.y * desktopvertres / vertres;
+
         av_log(s1, AV_LOG_DEBUG, "Cursor pos (%li,%li) -> (%li,%li)\n",
                 ci.ptScreenPos.x, ci.ptScreenPos.y, pos.x, pos.y);
 



More information about the ffmpeg-cvslog mailing list