Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMetaksakis Georgios <metaxas4@gmail.com>2016-02-15 02:05:17 +0300
committerMatt Oliver <protogonoi@gmail.com>2016-02-15 02:11:11 +0300
commit00c73c475e3d2d7049eed73ea956f6798365b36a (patch)
tree3a996e83cdd015c18d3b4c52e3b4f009fc759ee7 /libavdevice/gdigrab.c
parent70d685a77f283b110e7b1ab565ff5de53f752d55 (diff)
lavd/gdigrab: mouse dpi awareness
correct mouse location on hidpi screens. fixes ticket #5008 Signed-off-by: Matt Oliver <protogonoi@gmail.com>
Diffstat (limited to 'libavdevice/gdigrab.c')
-rw-r--r--libavdevice/gdigrab.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index 4428a34ee7..7db587cd97 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);