2016-08-01 64 views
0

我正在编写一个x11剪贴板客户端,而且我正在用INCR很难。基本上,我的问题是,当我打电话XDeleteProperty以启动INCR传递,我得到了一个错误请求错误代码XDeleteProperty返回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; 
    } 
+0

根据我的经验,BadRequest与“未实施”相同。根据我的理解,您可以在XGetWindowProperty中将属性设置delete参数删除为true,bytes_after_return为0。这可以解释为什么XDeleteProperty可能不会被实现。通过在您的案例中设置delete和bytes_after_return参数是一个可行的操作过程来删除?你能否“改善”你的问题,以便更清楚你对答案的期望? http://linux.die.net/man/3/xgetwindowproperty – Andreas

+0

它可能是X中的一个错误。该属性是否实际上被删除? –

回答

0

我发现看的Xlib源代码,除非回报代码1是BadRequest异常,XDeleteProperty的返回始终是1 ...很好知道!