[Xcb] How to properly discard socket-handoff GetInputFocus requests?

Clemens Eisserer linuxhippy at gmail.com
Sun Feb 25 07:05:45 UTC 2018


Hi Uli,

> Uhm. I do not know, looking at the code and what Xlib does ended up
> confusing me some more. Right now I see no reason why
> xcb_discard_reply() would not work, but I haven't really checked this
> properly.

The issue is - I don't know of any way to get the sequence number
using official APIs.
So I can't actually call xcb_discard_reply.

I wonder, would it be sufficient to call
xcb_discard_reply(xcb_get_input_focus(xcbCon).sequence) right before I
take the socket unconditionally and make sure I cause a
socket-revocation (e.g. calling XNoOp()) before approaching the 16-bit
unsigned int sequence number wrap arround?

Or does the xcb code really expect the first request *after* socket
handoff to cause a reply?

> How are you handling other replies that the requests that you send
> generate? Can't you generate the GetInputFocus reply the same way?

I don't generate requests in protocol generated during I own the socket.

> Also, why do you need to take the socket at all? Can't you just use xcb
> "the way it is intended to be used"?

I use socket handoff for batching certain operations of a immediate
rendering API (Java2D).

Socket handoff allows me to control:
* when protocol is submitted to the x-server (whereas when using
native xcb/xlib APIs this is an implementation detail I don't have
control over)
* modification of queued commands right before they are sent

To allow for that batching, I need both features.
So the need to generate protocol myself is actually a side-effect, not
the reason I use it.

Thanks & best regards, Clemens


More information about the Xcb mailing list