<HTML><BODY>Hi all.<br><br>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<br><br> startx some-program<br>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. <br><br>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).<br><br>This is my code of some-program using which I capture screen:<br><br> Display* display = XOpenDisplay(NULL);<br> Window root = DefaultRootWindow(display);<br> XWindowAttributes attributes = {0};<br> XGetWindowAttributes(display, root, &attributes);<br> int width, height;<br> width = attributes.width;<br> height = attributes.height;<br> XImage* img = XGetImage(display, root, 0, 0 , width, height, AllPlanes, ZPixmap);<br> ...<br> XDestroyImage(img);<br><br>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).<br><br><br>-- <br>Alex Sviridov</BODY></HTML>