From patchwork Sun Jan 27 19:15:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dilshod Mukhtarov X-Patchwork-Id: 11881 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 96D3844D067 for ; Sun, 27 Jan 2019 21:15:17 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BDC9668AF8C; Sun, 27 Jan 2019 21:15:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DA2E68AF7B for ; Sun, 27 Jan 2019 21:14:59 +0200 (EET) Received: by mail-wm1-f49.google.com with SMTP id f188so11480602wmf.5 for ; Sun, 27 Jan 2019 11:15:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=IfrhQet9pY4XS989+7vxBwmLkvpocR8jQMvo2BZLAxQ=; b=MqyHB6wAwxpiMBJA7EJb0PQdRwppotrx1hadPaJmuxMY8q5/C5q0Se+MaNofExIz9b EpKqabTDH87w5va7zUySBfHaiISZqf3lB6N3cIDIebtwAQV3TGtayLGBWlmck5yZqUFA 1JhuzUeUbGpTVVWfnNJH6bQq57Ub4R7r7RUWQDAKEK9SblIpdULBq2zcUaIESxOqT7hZ sl9I4fFC2I99HRJiebP9CpfnjzWH3dWXvYgOx0uqcCwFhqFr2dMhYuOHm8fkaQmF/fW/ 09t4rxqhmqE2izTSDqCrwhHTv9b46DMXzXNQEKYXOOFDsmYVDt0N7vB33xRmBPUIa+/u 99Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=IfrhQet9pY4XS989+7vxBwmLkvpocR8jQMvo2BZLAxQ=; b=bYyJW7Ykd3zNpZ59Uq0IAD+K+GhrDk49MgyUzdNlOMOK1geuqrn0vN4u0/E/sADnxe xo/uOUB2+vTjzHOCpN3qbO7DQIWiHEFrw0jZr/5eXU3uCE4XPwbbgihjF8n5vjKvEBBe vCpcAmLP1AyvnJT0/CgfqBR4ImM2ZjQGr5Uy8nr5FKlR5rjxkiB2ruk10UCA2HqHcI+7 VH7g+GKhK56GRFEpDusL2ElDz4Z10xMuA7+F6nEP3mDK76XpoUybzYa/s6cbUEU0Sj7v DWt8se2RhppuNV4uTykA4Xiqfy90Pan2XbUOtVdQQe3yDgLSpNzDkYgJJNhMMIeYIBeb vRIQ== X-Gm-Message-State: AJcUukcb3rYMNmBo0BkBlzn78EE4VmZcEXiZp4QsrZFkl6fEcu+8MLej 5F5S55FlAqv8HqrFCLcr1fbXapZ8NEw= X-Google-Smtp-Source: ALg8bN61roRpQm/ty1dqaXPPhkFPNNrKyIWyq4pRAcwnqD/jiSyvRufU3hQ3b4ZOrR2/doxfDUcvHA== X-Received: by 2002:a1c:8b09:: with SMTP id n9mr14339998wmd.38.1548616518369; Sun, 27 Jan 2019 11:15:18 -0800 (PST) Received: from [192.168.101.101] ([5.30.109.119]) by smtp.googlemail.com with ESMTPSA id 200sm76752088wmw.31.2019.01.27.11.15.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Jan 2019 11:15:17 -0800 (PST) From: Dilshod Mukhtarov To: ffmpeg-devel@ffmpeg.org References: <9e9f8cbe-87e3-426f-c51d-fb437ab51715@gmail.com> Message-ID: <0fd52427-fc8c-3c9b-5708-aa4472077ae0@gmail.com> Date: Sun, 27 Jan 2019 23:15:15 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <9e9f8cbe-87e3-426f-c51d-fb437ab51715@gmail.com> Content-Language: en-US Subject: Re: [FFmpeg-devel] gdigrab: fix HIDPI support for mouse positioning X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" New version, which uses integer arithmetics From 586d4b3ed3406b66e3d0bd69806bc33beaddc026 Mon Sep 17 00:00:00 2001 From: Dilshod Mukhtarov Date: Sun, 27 Jan 2019 23:10:37 +0400 Subject: [PATCH 2/2] libavdevice/gdigrab: fix HIDPI support for mouse positioning Mouse position was not calculated properly in area or window mode Signed-off-by: Dilshod Mukhtarov --- libavdevice/gdigrab.c | 19 ++++++++++--------- 1 file 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); -- 2.17.1