Search code examples
cclipboardx11xlib

XDeleteProperty returning BadRequest error


I'm coding an x11 clipboard client, and I'm getting hard time with INCR. Basicly, my problem is that when I call XDeleteProperty on to start the INCR transfer, I got an BadRequest error code

here's a snippet :

if (type == ctx->incr_atom)
    {
        ctx->pendingIncr.status = INCR_REQUEST_NEW;

        if(XGetWindowProperty(ctx->display, ctx->window,
                      ctx->property_atom, 0, remaining, FALSE, AnyPropertyType,
                      &type, &format_property, &length, &remaining, &data) == Success)
        {
            fprintf(stderr, "Getting window property : %lu bytes fetched\n", length);
        }
        else
        {
            fprintf(stderr, "Failed getting window property\n");
        }

        error = XDeleteProperty(ctx->display, ctx->window, ctx->property_atom);

        if(error == Success)
        {
            fprintf(stderr, "Entering INCR Protocol!\n");
        }
        else
        {
            fprintf(stderr, "Failed deleting window property : error code %d\n", error);
        }

        XFlush(ctx->display);
        return 1;
    }

Solution

  • I found out looking at the Xlib source code, unless return code 1 is BadRequest exception, the return of XDeleteProperty is ALWAYS 1... good to know !