[Xcb] xcb_composite_redirect_window NEVER replies

Juan Lao Tebar nitzing at gmail.com
Tue Nov 3 15:33:04 PST 2015


Hi,

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.

I attach my code. This my output:

$ g++ test.cpp -lxcb -lxcb-composite && ./a.out
Composite extension found!
Redirecting child 31457352
Waiting for response...

(and it never ends)

Am I doing anything wrong here?

The code:

#include <iostream>
#include <string>

#include <xcb/xcb.h>
#include <xcb/xcbext.h>
#include <xcb/composite.h>

using namespace std;

int main() {
// Connecting to the X server.
xcb_connection_t* c = xcb_connect(NULL, NULL);

// Initializing composite extension
string extensionName = "Composite";
xcb_query_extension_cookie_t extensionCookie = xcb_query_extension(c,
extensionName.length(), extensionName.c_str());
xcb_query_extension_reply_t* extensionReply = xcb_query_extension_reply(c,
extensionCookie, NULL);

if (!extensionReply->present) {
cout << "Error: Composite extension not found." << endl;
}
else {
cout << "Composite extension found!" << endl;
}

// Getting root window.
xcb_window_t root = xcb_setup_roots_iterator(xcb_get_setup(c)).data->root;

// Getting root window children.
xcb_query_tree_cookie_t treeCookie = xcb_query_tree(c, root);
xcb_query_tree_reply_t* treeReply = xcb_query_tree_reply(c, treeCookie,
NULL);

if (xcb_query_tree_children_length(treeReply) == 0) {
cout << "Error: the root window has no children." << endl;
}

xcb_window_t* children = xcb_query_tree_children(treeReply);

// Redirecting the first child.
cout << "Redirecting child " << children[0] << endl;

xcb_void_cookie_t redirectCookie = xcb_composite_redirect_window(c,
children[0], XCB_COMPOSITE_REDIRECT_AUTOMATIC);

cout << "Waiting for response..." << endl;

void* reply = xcb_wait_for_reply(c, redirectCookie.sequence, NULL);
cout << "Finished!" << endl;
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20151104/d5abe1c8/attachment.html>


More information about the Xcb mailing list