Merge commit '2a5ac99e6e06078713f684fee2466c91f677b303'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 5 Oct 2014 01:35:22 +0000 (03:35 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 5 Oct 2014 01:42:55 +0000 (03:42 +0200)
* commit '2a5ac99e6e06078713f684fee2466c91f677b303':
  x11grab: Check the XQueryPointer return value

Conflicts:
libavdevice/x11grab.c

See: 69c34a6ac986e31b5286a1d566617ec25b93e6a7
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavdevice/x11grab.c

index 9066ae21adbda0710a4aac5c28dec7e27cbc2300,3aa42940595425a05d76d3c15908d9d0c821bb19..3a833eb27fc7fd86b8e512fe81ab030c8e903f2d
@@@ -408,32 -386,14 +408,25 @@@ static void paint_mouse_pointer(XImage 
       * Anyone who performs further investigation of the xlib API likely risks
       * permanent brain damage. */
      uint8_t *pix = image->data;
-     Bool pointer_on_screen;
-     Window w;
-     int _;
-     root = DefaultRootWindow(dpy);
-     pointer_on_screen = XQueryPointer(dpy, root, &w, &w, &_, &_, &_, &_, &_);
-     if (!pointer_on_screen)
-         return;
 +    Window root;
 +    XSetWindowAttributes attr;
  
      /* Code doesn't currently support 16-bit or PAL8 */
      if (image->bits_per_pixel != 24 && image->bits_per_pixel != 32)
          return;
  
 +    if (!s->c)
 +        s->c = XCreateFontCursor(dpy, XC_left_ptr);
++    root = DefaultRootWindow(dpy);
 +    attr.cursor = s->c;
 +    XChangeWindowAttributes(dpy, root, CWCursor, &attr);
 +
      xcim = XFixesGetCursorImage(dpy);
 -    if (!xcim)
 +    if (!xcim) {
 +        av_log(s1, AV_LOG_WARNING,
 +               "XFixesGetCursorImage failed\n");
          return;
 +    }
  
      x = xcim->x - xcim->xhot;
      y = xcim->y - xcim->yhot;
@@@ -622,8 -574,8 +617,8 @@@ static int x11grab_read_packet(AVFormat
              av_log(s1, AV_LOG_INFO, "XGetZPixmap() failed\n");
      }
  
-     if (s->draw_mouse)
+     if (s->draw_mouse && same_screen)
 -        paint_mouse_pointer(image, s);
 +        paint_mouse_pointer(image, s1);
  
      return s->frame_size;
  }