From patchwork Thu Mar 28 04:52:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Octavio Alvarez X-Patchwork-Id: 12508 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 B85C4448BC9 for ; Thu, 28 Mar 2019 06:52:47 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 98E5B68A7B1; Thu, 28 Mar 2019 06:52:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from sobre.alvarezp.com (sobre.alvarezp.com [173.230.155.94]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9632668A129 for ; Thu, 28 Mar 2019 06:52:40 +0200 (EET) Received: from localhost.localdomain (unknown [189.205.206.165]) by sobre.alvarezp.com (Postfix) with ESMTPSA id 70FE81E356; Wed, 27 Mar 2019 22:52:39 -0600 (CST) From: Octavio Alvarez To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2019 22:52:32 -0600 Message-Id: <20190328045232.3720-1-octalffdev@alvarezp.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] x11grab: fix vertical repositioning 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 Cc: Octavio Alvarez Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" There is a calculation error in xcbgrab_reposition() that breaks vertical repositioning on follow_mouse. It made the bottom reposition occur when moving the mouse lower than N pixels after the capture bottom edge, instead of before. This commit fixes the calculation to match the documentation. follow_mouse: centered or number of pixels. The documentation says: When it is specified with "centered", the grabbing region follows the mouse pointer and keeps the pointer at the center of region; otherwise, the region follows only when the mouse pointer reaches within PIXELS (greater than zero) to the edge of region. The patch is untested, but it looks fairly straightforward. --- libavdevice/xcbgrab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index 6d142abd4f..b7e689343e 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -127,7 +127,7 @@ static int xcbgrab_reposition(AVFormatContext *s, int left = x + f; int right = x + w - f; int top = y + f; - int bottom = y + h + f; + int bottom = y + h - f; if (p_x > right) { x += p_x - right; } else if (p_x < left) {