Commit 00c73c47 authored by Metaksakis Georgios's avatar Metaksakis Georgios Committed by Matt Oliver

lavd/gdigrab: mouse dpi awareness

correct mouse location on hidpi screens.
fixes ticket #5008
Signed-off-by: 's avatarMatt Oliver <protogonoi@gmail.com>
parent 70d685a7
...@@ -446,6 +446,8 @@ static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab *gdigrab) ...@@ -446,6 +446,8 @@ static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab *gdigrab)
POINT pos; POINT pos;
RECT clip_rect = gdigrab->clip_rect; RECT clip_rect = gdigrab->clip_rect;
HWND hwnd = gdigrab->hwnd; HWND hwnd = gdigrab->hwnd;
int vertres = GetDeviceCaps(gdigrab->source_hdc, VERTRES);
int desktopvertres = GetDeviceCaps(gdigrab->source_hdc, DESKTOPVERTRES);
info.hbmMask = NULL; info.hbmMask = NULL;
info.hbmColor = NULL; info.hbmColor = NULL;
...@@ -479,6 +481,10 @@ static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab *gdigrab) ...@@ -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", av_log(s1, AV_LOG_DEBUG, "Cursor pos (%li,%li) -> (%li,%li)\n",
ci.ptScreenPos.x, ci.ptScreenPos.y, pos.x, pos.y); ci.ptScreenPos.x, ci.ptScreenPos.y, pos.x, pos.y);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment