XDelete 属性返回 Bad Request 错误

XDeleteProperty returning BadRequest error

我正在编写一个 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;
    }

我在查看 Xlib 源代码时发现,除非 return 代码 1 是 BadRequest 异常,否则 XDeleteProperty 的 return 始终为 1...很高兴知道!