[comp.windows.x] Could someone explain what the serial field of an XAnyEvent structure is?

John.Kochmar@SEI.CMU.EDU (03/29/89)

I'm trying to understand what the serial field from an XAnyEvent structure
is supposed to represent, and I am getting quite lost.  The O'Reilly books
say it "identifies the last protocol request processed by the server", and
the Gettys/Newman/Scheifler book says it "is set from the serial number
reported in the protocol but expanded from the 16-bit least-significant bits
to a full 32-bit value".  It goes on to say how this is the last known
request to have been processed by the server.

What I am confused about is:

	1) There are holes in the numbering.  Does this mean that I am not
	selecting for all possible events, or that some events are being sent
	to other clients, or am I just way out in left field?

	2) There are more serial fields with the same number than I would have
	expected.  The documentation led me to believe that each time the 
	server processed an event, it would increment the serial field, but it
	doesn't appear to work this way.

Any help would be appreciated.  I went into the code to look for the answer, 
but I just got even more confused than when I started.  If it helps, I am on
an ULTRIX 3.0 system, and I have tried playing with this under both DECwindows
and the MIT R3 distribution.

Thanks
John Kochmar
kochmar@sei.cmu.edu

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (03/29/89)

Each protocol request issued by a client is assigned a serial number.
The serial number in an event, reply, or error indicates the last request
executed (or executing) by the client.  By the time the client receives
the event, reply, or error, there is no guarantee that no additional
requests have been executed, hence it is the "last known" request (as
far as Xlib has ascertained) to have been executed by the server.

	1) There are holes in the numbering.  Does this mean that I am not
	selecting for all possible events, or that some events are being sent
	to other clients, or am I just way out in left field?

Events aren't numbered, requests are.  You shouldn't expect "by 1"
increments.

	2) There are more serial fields with the same number than I would have
	expected.  The documentation led me to believe that each time the 
	server processed an event, it would increment the serial field, but it
	doesn't appear to work this way.

No, each time it processes a request.  If a request generates multiple events,
all of them will have the same serial number.  If multiple events are generated
between two requests by a client, all of the events to that client will have
the same serial number.