aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice/x11grab.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-05 03:06:14 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-05 03:14:35 +0200
commit98baa8151a50777c327d88a500eb9048332866bb (patch)
tree0fed99079fbde8955c46afdbc9873c0a2245a62a /libavdevice/x11grab.c
parentde52af90172154168ef1a64b1392187767b0dd60 (diff)
parent89fa2b5616274194d90bde0aeebf6adbd1245193 (diff)
downloadffmpeg-98baa8151a50777c327d88a500eb9048332866bb.tar.gz
Merge commit '89fa2b5616274194d90bde0aeebf6adbd1245193'
* commit '89fa2b5616274194d90bde0aeebf6adbd1245193': x11grab: Check for XFixes availability at runtime See: a65c0a3fe822386be30fd3371af9f0d008b02874 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/x11grab.c')
-rw-r--r--libavdevice/x11grab.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 1481e7d871..f1c6a39248 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -172,6 +172,19 @@ static int setup_shm(AVFormatContext *s, Display *dpy, XImage **image)
return 0;
}
+static int setup_mouse(Display *dpy, int screen)
+{
+ int ev_ret, ev_err;
+
+ if (XFixesQueryExtension(dpy, &ev_ret, &ev_err)) {
+ Window root = RootWindow(dpy, screen);
+ XFixesSelectCursorInput(dpy, root, XFixesDisplayCursorNotifyMask);
+ return 0;
+ }
+
+ return AVERROR(ENOSYS);
+}
+
static int pixfmt_from_image(AVFormatContext *s, XImage *image, int *pix_fmt)
{
av_log(s, AV_LOG_DEBUG,
@@ -326,6 +339,12 @@ static int x11grab_read_header(AVFormatContext *s1)
AllPlanes, ZPixmap);
}
+ if (x11grab->draw_mouse && setup_mouse(dpy, screen) < 0) {
+ av_log(s1, AV_LOG_WARNING,
+ "XFixes not available, cannot draw the mouse cursor\n");
+ x11grab->draw_mouse = 0;
+ }
+
x11grab->frame_size = x11grab->width * x11grab->height * image->bits_per_pixel / 8;
x11grab->dpy = dpy;
x11grab->time_base = av_inv_q(x11grab->framerate);