]> git.sesse.net Git - ffmpeg/commitdiff
lavd/x11grab: fix vertical repositioning
authorOctavio Alvarez <octalffdev@alvarezp.org>
Thu, 28 Mar 2019 04:52:32 +0000 (22:52 -0600)
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>
Sat, 6 Apr 2019 13:20:36 +0000 (15:20 +0200)
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.

libavdevice/xcbgrab.c

index 6d142abd4fd3a94c535f0d3ae96ba54d4a1a70b3..b7e689343e0a2a8217019d9f0c4bb884fd454b87 100644 (file)
@@ -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) {