<div dir="ltr"><div><div><div>Hi everybody,<br><br></div>I successfully wrote a program using xcb that runs in the background and launches my program when the machine becomes idle. This covers my personal use case, however, I would also like to be able to launch existing xscreensaver programs with my xcb program. This requires me to create a virtual root window.<br>
<br></div>From what I understand, there are two different ways to do this, an "official" way, and the common way. The official way it to set _NET_VIRTUAL_ROOTS and _NET_CURRENT_DESKTOP on the real root window, and the common way it to set __SWM_VROOT on the new virtual root window (to what? my own XID?). This common way seems to be what xscreensaver expects as well as passing the XID in an environment variable. In addition, for the common way to work, it seems the new vroot needs to be a direct child of the root window.<br>
<br></div><div>In any case, this requires me to do an xcb_change_property on either the root window or the created window. I have seen code on how to do this in xlib, but in XCB I can't figure it out for the life of me, but I gather that it involves internal atoms. <br>
</div><div>My current code looks like this:<br><br> atom_cookie = xcb_intern_atom (conn, 0, strlen("__SWM_VROOT"),<br> "__SWM_VROOT");<br> atom_reply = xcb_intern_atom_reply (conn, atom_cookie, NULL);<br>
if (atom_reply)<br> {<br> atom = atom_reply->atom;<br> free (atom_reply);<br> }<br> if (!atom)<br> printf("didnt get atom\n");<br>// return;<br><br> xcb_reparent_window(conn,win,screen->root,0,0);<br>
xcb_change_property(conn,XCB_PROP_MODE_REPLACE,win,atom,XCB_ATOM_WINDOW,0,sizeof(win),&win);<br><br></div><div>This code compiles fine, but always gives me an error on execution (in xtrace) looking like this:<br>000:>:0018:Error 2=Value: major=18, minor=0, bad=0<br>
<br></div><div>Now, I can't figure out what I am doing wrong, it seems totally legit to me. Anybody have any vroot insight?<br><br></div><div>Regards and my utmost thanks,<br></div><div>--Philip<br></div></div>