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:
authorDilshod Mukhtarov <dilshodm@gmail.com>2019-01-27 22:10:37 +0300
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2019-01-30 23:55:22 +0300
commit1100862a94ea960c2cb2392edf9c9670f78b74e9 (patch)
tree7a662952d8cb1393a5c8cd6034bed264e7936f1b /libavdevice
parentd7c9ddd0c4b02c1e8872a299a6613f9b55b858a4 (diff)
libavdevice/gdigrab: fix HIDPI support for mouse positioning
Mouse position was not calculated properly in area or window mode Signed-off-by: Dilshod Mukhtarov <dilshodm@gmail.com>
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/gdigrab.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index 0e6ae2bd5d..b226bd0831 100644
--- a/libavdevice/gdigrab.c
+++ b/libavdevice/gdigrab.c
@@ -479,25 +479,26 @@ static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab *gdigrab)
goto icon_error;
}
- pos.x = ci.ptScreenPos.x - clip_rect.left - info.xHotspot;
- pos.y = ci.ptScreenPos.y - clip_rect.top - info.yHotspot;
-
if (hwnd) {
RECT rect;
if (GetWindowRect(hwnd, &rect)) {
- pos.x -= rect.left;
- pos.y -= rect.top;
+ pos.x = ci.ptScreenPos.x - clip_rect.left - info.xHotspot - rect.left;
+ pos.y = ci.ptScreenPos.y - clip_rect.top - info.yHotspot - rect.top;
+
+ //that would keep the correct location of mouse with hidpi screens
+ pos.x = pos.x * desktophorzres / horzres;
+ pos.y = pos.y * desktopvertres / vertres;
} else {
CURSOR_ERROR("Couldn't get window rectangle");
goto icon_error;
}
+ } else {
+ //that would keep the correct location of mouse with hidpi screens
+ pos.x = ci.ptScreenPos.x * desktophorzres / horzres - clip_rect.left - info.xHotspot;
+ pos.y = ci.ptScreenPos.y * desktopvertres / vertres - clip_rect.top - info.yHotspot;
}
- //that would keep the correct location of mouse with hidpi screens
- pos.x = pos.x * desktophorzres / horzres;
- 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);