XLib and Xvfb: capture screen

Alex Sviridov ooo_saturn7 at mail.ru
Wed Feb 8 10:16:18 UTC 2017


Hi all

This is my c++ code which I use to capture screen:
    Display* display = XOpenDisplay(NULL);
    Window root = DefaultRootWindow(display);
    XWindowAttributes attributes = {0};
    XGetWindowAttributes(display, root, &attributes);
    int width, height;
    width = attributes.width;
    height = attributes.height;
    XImage* img = XGetImage(display, root, 0, 0 , width, height, AllPlanes, ZPixmap);
    ...
    XDestroyImage(img);
    XCloseDisplay(display);

When I run it without Xvfb I get a normal screen picture. However, when I use it in Xvfb is not not normal. For example I tried to capture youtube in firefox as a result I see some green/blue image with you tube pieces.

This question was asked on stackoverflow  http://stackoverflow.com/questions/42110050/xlib-and-xvfb-capture-screen
and there can be seen the result image.

How to fix it?


-- 
Alex Sviridov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg/attachments/20170208/dd68a25b/attachment.html>


More information about the xorg mailing list