<div dir="ltr">Hi,<div><br></div><div>I'm trying to redirect the first child of the root window, but it seems that the X server never replies after calling xcb_composite_redirect_window.</div><div><br></div><div>I attach my code. This my output:</div><div><br></div><div><div>$ g++ test.cpp -lxcb -lxcb-composite && ./a.out </div><div>Composite extension found!</div><div>Redirecting child 31457352</div><div>Waiting for response...</div></div><div><br></div><div>(and it never ends)</div><div><br></div><div>Am I doing anything wrong here?</div><div><br></div><div>The code:</div><div><br></div><div><div>#include <iostream></div><div>#include <string></div><div><br></div><div>#include <xcb/xcb.h></div><div>#include <xcb/xcbext.h></div><div>#include <xcb/composite.h></div><div><br></div><div>using namespace std;</div><div><br></div><div>int main() {</div><div><span class="" style="white-space:pre">      </span>// Connecting to the X server.</div><div><span class="" style="white-space:pre">     </span>xcb_connection_t* c = xcb_connect(NULL, NULL);</div><div><br></div><div><span class="" style="white-space:pre">    </span>// Initializing composite extension</div><div><span class="" style="white-space:pre">        </span>string extensionName = "Composite";</div><div><span class="" style="white-space:pre">      </span>xcb_query_extension_cookie_t extensionCookie = xcb_query_extension(c, extensionName.length(), extensionName.c_str());</div><div><span class="" style="white-space:pre">      </span>xcb_query_extension_reply_t* extensionReply = xcb_query_extension_reply(c, extensionCookie, NULL);</div><div><br></div><div><span class="" style="white-space:pre">        </span>if (!extensionReply->present) {</div><div><span class="" style="white-space:pre">         </span>cout << "Error: Composite extension not found." << endl;</div><div><span class="" style="white-space:pre">     </span>}</div><div><span class="" style="white-space:pre">  </span>else {</div><div><span class="" style="white-space:pre">             </span>cout << "Composite extension found!" << endl;</div><div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>// Getting root window.</div><div><span class="" style="white-space:pre">    </span>xcb_window_t root = xcb_setup_roots_iterator(xcb_get_setup(c)).data->root;</div><div><br></div><div><span class="" style="white-space:pre">     </span>// Getting root window children.</div><div><span class="" style="white-space:pre">   </span>xcb_query_tree_cookie_t treeCookie = xcb_query_tree(c, root);</div><div><span class="" style="white-space:pre">      </span>xcb_query_tree_reply_t* treeReply = xcb_query_tree_reply(c, treeCookie, NULL);</div><div><br></div><div><span class="" style="white-space:pre">    </span>if (xcb_query_tree_children_length(treeReply) == 0) {</div><div><span class="" style="white-space:pre">              </span>cout << "Error: the root window has no children." << endl;</div><div><span class="" style="white-space:pre">   </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>xcb_window_t* children = xcb_query_tree_children(treeReply);</div><div><br></div><div><span class="" style="white-space:pre">      </span>// Redirecting the first child.</div><div><span class="" style="white-space:pre">    </span>cout << "Redirecting child " << children[0] << endl;</div><div><br></div><div><span class="" style="white-space:pre">  </span>xcb_void_cookie_t redirectCookie = xcb_composite_redirect_window(c, children[0], XCB_COMPOSITE_REDIRECT_AUTOMATIC);</div><div><br></div><div><span class="" style="white-space:pre">       </span>cout << "Waiting for response..." << endl;</div><div><br></div><div><span class="" style="white-space:pre">  </span>void* reply = xcb_wait_for_reply(c, redirectCookie.sequence, NULL);</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">   </span>cout << "Finished!" << endl;</div><div><span class="" style="white-space:pre"> </span>return 0;</div><div>}</div></div></div>