Xlib: capture screen in separate xserver session
Alex Sviridov
ooo_saturn7 at mail.ru
Tue Feb 7 18:47:43 UTC 2017
Hi all.
I need to run some-program which makes screen capturing via xlib library in separate xserver session. So, I start my ubuntu 14 and `origin` xserver session (lets call it this way) starts. After that I run
startx some-program
After running this command a black screen appears and on this black screen I see my program and it works as expected. That's ok - this is what I need.
However, firstly I want to continue using my computer and secondly I must run N such programs in N separate xserver sessions. The problem is that when I try to return to my `origin` session by pressing ctrl+alt+f7 some-program continues working however, its screen captures become simple black rectangles (no any content).
This is my code of some-program using which I 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);
Could anyone say what should I do in order to capture screen in separate xserver session while it is not active (the user is using another xsession).
--
Alex Sviridov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg/attachments/20170207/998fb893/attachment.html>
More information about the xorg
mailing list