i'm very sorry for those mistakes i'm sending you a new patch with only 6 changes. The problem was that when you where capturing the screen, the mouse wasn't on the correct location.
On Fri, Feb 12, 2016 at 2:01 AM James Darnley <james.darn...@gmail.com> wrote: > On 2016-02-11 23:19, Γιώργος Μεταξάκης wrote: > > Subject: [PATCH] mouse dpi awareness > > > > --- > > libavdevice/gdigrab.c | 28 +++++++++++++++------------- > > 1 file changed, 15 insertions(+), 13 deletions(-) > > > > diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c > > index 4428a34..60f184e 100644 > > --- a/libavdevice/gdigrab.c > > +++ b/libavdevice/gdigrab.c > > @@ -71,6 +71,8 @@ struct gdigrab { > > > > #define REGION_WND_BORDER 3 > > > > + > > + > > /** > > * Callback to handle Windows messages for the region outline window. > > * > > Please don't add random whitespace changes. > > > @@ -235,8 +237,7 @@ gdigrab_read_header(AVFormatContext *s1) > > AVStream *st = NULL; > > > > int bpp; > > - int vertres; > > - int desktopvertres; > > + > > RECT virtual_rect; > > RECT clip_rect; > > BITMAP bmp; > > @@ -279,8 +280,8 @@ gdigrab_read_header(AVFormatContext *s1) > > GetClientRect(hwnd, &virtual_rect); > > } else { > > /* desktop -- get the right height and width for scaling DPI */ > > - vertres = GetDeviceCaps(source_hdc, VERTRES); > > - desktopvertres = GetDeviceCaps(source_hdc, DESKTOPVERTRES); > > + int vertres = GetDeviceCaps(source_hdc, VERTRES); > > + int desktopvertres = GetDeviceCaps(source_hdc, DESKTOPVERTRES); > > virtual_rect.left = GetSystemMetrics(SM_XVIRTUALSCREEN); > > virtual_rect.top = GetSystemMetrics(SM_YVIRTUALSCREEN); > > virtual_rect.right = (virtual_rect.left + > GetSystemMetrics(SM_CXVIRTUALSCREEN)) * desktopvertres / vertres; > > Is this change just moving the declaration? > > > @@ -431,8 +432,10 @@ error: > > static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab > *gdigrab) > > { > > CURSORINFO ci = {0}; > > + int vertres = GetDeviceCaps(gdigrab->source_hdc, VERTRES); > > + int desktopvertres = GetDeviceCaps(gdigrab->source_hdc, > DESKTOPVERTRES); > > > > -#define CURSOR_ERROR(str) \ > > + #define CURSOR_ERROR(str) \ > > if (!gdigrab->cursor_error_printed) { \ > > WIN32_API_ERROR(str); \ > > gdigrab->cursor_error_printed = 1; \ > > @@ -459,12 +462,7 @@ static void paint_mouse_pointer(AVFormatContext > *s1, struct gdigrab *gdigrab) > > icon = CopyCursor(LoadCursor(NULL, IDC_ARROW)); > > } > > > > - if (!GetIconInfo(icon, &info)) { > > - CURSOR_ERROR("Could not get icon info"); > > - goto icon_error; > > - } > > - > > - pos.x = ci.ptScreenPos.x - clip_rect.left - info.xHotspot; > > + pos.x = ci.ptScreenPos.x - clip_rect.left - info.xHotspot; > > pos.y = ci.ptScreenPos.y - clip_rect.top - info.yHotspot; > > > > if (hwnd) { > > No Tabs! > > Why did you remove the GetIconInfo() call? You need that to fill the > info data structure you use right here. > > > @@ -478,7 +476,11 @@ static void paint_mouse_pointer(AVFormatContext > *s1, struct gdigrab *gdigrab) > > goto icon_error; > > } > > } > > - > > + > > + //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); > > > > You probably want to round that division and add some brackets so the > division happens last. The change you want to make is probably right > but I would have to check the docs before signing off. > > > @@ -639,4 +641,4 @@ AVInputFormat ff_gdigrab_demuxer = { > > .read_close = gdigrab_read_close, > > .flags = AVFMT_NOFILE, > > .priv_class = &gdigrab_class, > > -}; > > +}; > > \ No newline at end of file > > I think you need a better editor. > > What were the symptoms of the problem before your fix? Was the cursor > being drawn too large or to small? The second last chunk suggests it > was in the wrong position. > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > -- Metaksakis Georgios FORTH - ICS Work : (0030) 281 139 2583 Mobile : (0030) 697 369 3871
0001-mouse-dpi-awareness.patch
Description: Binary data
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel