XDeleteProperty返回BadRequest错误

时间:2016-08-01 15:24:04

标签: c clipboard x11 xlib

我正在编写一个x11剪贴板客户端,而且我很难使用INCR。基本上,我的问题是,当我调用XDeleteProperty启动INCR传输时,我收到了BadRequest错误代码

这是一个片段:

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

1 个答案:

答案 0 :(得分:0)

我发现查看Xlib源代码,除非返回代码1是BadRequest异常,否则XDeleteProperty的返回总是1 ...很高兴知道!