[Xcb] xcb_composite_redirect_window NEVER replies

Juan Lao Tebar nitzing at gmail.com
Wed Nov 4 11:39:19 PST 2015


2015-11-04 4:05 GMT+01:00 Peter Harris <peter at harr.ca>:
>
> You're waiting for a reply to a request that doesn't actually have a
> reply. See http://cgit.freedesktop.org/xorg/proto/compositeproto/tree/compositeproto.txt
> (the requests with a reply have a -> delimiter between the request
> structure and the reply structure).

Perfect! Thanks for the link, it will help me a lot with other things!

The only thing that I don't understand is why xcb_wait_for_reply
returns NULL and does NOT return an error when the window id is
incorrect.

When I try to redirect an unexisting window, this is my output:
$ g++ test.cpp -lxcb -lxcb-composite && ./a.out
Composite extension found!
Redirecting window 666 (it does not exist)
Waiting for response...
Reply: 0
Error: 0
Finished!

When I perform a redirect, is there any way to check if there was any error?

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;
    }

    // Redirecting unexisting window.
    cout << "Redirecting window 666 (it does not exist)" << endl;

    xcb_void_cookie_t redirectCookie =
xcb_composite_redirect_window(c, 666,
XCB_COMPOSITE_REDIRECT_AUTOMATIC);

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

    xcb_generic_error_t* error = NULL;
    void* reply = xcb_wait_for_reply(c, redirectCookie.sequence, &error);

    cout << "Reply: " << reply << endl;
    cout << "Error: " << error << endl;
    cout << "Finished!" << endl;
    return 0;
}


More information about the Xcb mailing list