1ea1d6981Smrg<?xml version="1.0" encoding="UTF-8"?> 2ea1d6981Smrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 3ea1d6981Smrg"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 4ea1d6981Smrg[ 5ea1d6981Smrg<!ENTITY % defs SYSTEM "defs.ent"> %defs; 6ea1d6981Smrg]> 7ea1d6981Smrg<book> 8ea1d6981Smrg <bookinfo> 9ea1d6981Smrg <title>X Generic Event Extension</title> 10ea1d6981Smrg <author> 11ea1d6981Smrg <firstname>Peter</firstname> 12ea1d6981Smrg <surname>Hutterer</surname> 13ea1d6981Smrg <email>peter.hutterer@who-t.net</email> 14ea1d6981Smrg </author> 15ea1d6981Smrg <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 16ea1d6981Smrg <releaseinfo>Version 1.0</releaseinfo> 17ea1d6981Smrg <copyright><year>2007</year><holder>Peter Hutterer</holder></copyright> 18ea1d6981Smrg 19ea1d6981Smrg <legalnotice> 20ea1d6981Smrg <para> 21ea1d6981Smrg Permission is hereby granted, free of charge, to any person obtaining a 22ea1d6981Smrg copy of this software and associated documentation files (the "Software"), 23ea1d6981Smrg to deal in the Software without restriction, including without limitation 24ea1d6981Smrg the rights to use, copy, modify, merge, publish, distribute, sublicense, 25ea1d6981Smrg and/or sell copies of the Software, and to permit persons to whom the 26ea1d6981Smrg Software is furnished to do so, subject to the following conditions: 27ea1d6981Smrg </para> 28ea1d6981Smrg 29ea1d6981Smrg <para> 30ea1d6981Smrg The above copyright notice and this permission notice (including the next 31ea1d6981Smrg paragraph) shall be included in all copies or substantial portions of the 32ea1d6981Smrg Software. 33ea1d6981Smrg </para> 34ea1d6981Smrg 35ea1d6981Smrg <para> 36ea1d6981Smrg THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 37ea1d6981Smrg IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 38ea1d6981Smrg FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 39ea1d6981Smrg AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 40ea1d6981Smrg LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 41ea1d6981Smrg FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 42ea1d6981Smrg DEALINGS IN THE SOFTWARE. 43ea1d6981Smrg </para> 44ea1d6981Smrg </legalnotice> 45ea1d6981Smrg 46ea1d6981Smrg </bookinfo> 47ea1d6981Smrg 48ea1d6981Smrg <chapter> 49ea1d6981Smrg <title>Introduction</title> 50ea1d6981Smrg 51ea1d6981Smrg <para>X was designed to provide 64 event opcodes for all extensions. These 52ea1d6981Smrg events are limited to 32 bytes.</para> 53ea1d6981Smrg 54ea1d6981Smrg <para>The Generic Event Extension provides a template event for extensions 55ea1d6981Smrg to re-use a single event opcode. GE only provide headers and the most 56ea1d6981Smrg basic functionality, leaving the extensions to interpret the events in 57ea1d6981Smrg their specific context.</para> 58ea1d6981Smrg 59ea1d6981Smrg <para>GenericEvents may be longer than 32 bytes. If so, the number of 4 60ea1d6981Smrg byte units following the initial 32 bytes must be specified in the length 61ea1d6981Smrg field of the event.</para> 62ea1d6981Smrg </chapter> 63ea1d6981Smrg 64ea1d6981Smrg <chapter> 65ea1d6981Smrg <title>Extension Initialization</title> 66ea1d6981Smrg 67ea1d6981Smrg <para>The name of this extension is "Generic Event Extension"</para> 68ea1d6981Smrg 69ea1d6981Smrg <programlisting>GEQueryVersion 70ea1d6981Smrg client-major-version: CARD16 71ea1d6981Smrg client-minor-version: CARD16 72ea1d6981Smrg==> 73ea1d6981Smrg major-version: CARD16 74ea1d6981Smrg minor-version: CARD16</programlisting> 75ea1d6981Smrg 76ea1d6981Smrg <para>The client sends the highest supported version to the server and the 77ea1d6981Smrg server sends the highest version it supports, but no higher than the 78ea1d6981Smrg requested version. Major versions changes can introduce incompatibilities 79ea1d6981Smrg in existing functionality, minor version changes introduce only backward 80ea1d6981Smrg compatible changes. It is the clients responsibility to ensure that the 81ea1d6981Smrg server supports a version which is compatible with its 82ea1d6981Smrg expectations.</para> 83ea1d6981Smrg 84ea1d6981Smrg <para>As of version 1.0, no other requests are provided by this extension. 85ea1d6981Smrg </para> 86ea1d6981Smrg </chapter> 87ea1d6981Smrg 88ea1d6981Smrg <chapter> 89ea1d6981Smrg <title>Events</title> 90ea1d6981Smrg 91ea1d6981Smrg <para>GE defines a single event, to be used by all extensions. The event's 92ea1d6981Smrg structure is similar to a reply. This is a core protocol event, ID 35, and 93ea1d6981Smrg is not itself an extension event.</para> 94ea1d6981Smrg 95ea1d6981Smrg <programlisting>GenericEvent 96ea1d6981Smrg type: BYTE always GenericEvent (35) 97ea1d6981Smrg extension: CARD8 extension offset 98ea1d6981Smrg sequenceNumber: CARD16 low 16 bits of request seq. number 99ea1d6981Smrg length: CARD32 length 100ea1d6981Smrg evtype: CARD16 event type</programlisting> 101ea1d6981Smrg 102ea1d6981Smrg <para>The field 'extension' is to be set to the major opcode of the 103ea1d6981Smrg extension. The 'evtype' field is the actual opcode of the event. The 104ea1d6981Smrg length field specifies the number of 4-byte blocks after the initial 32 105ea1d6981Smrg bytes. If length is 0, the event is 32 bytes long.</para> 106ea1d6981Smrg </chapter> 107ea1d6981Smrg 108ea1d6981Smrg <chapter> 109ea1d6981Smrg <title>Notes</title> 110ea1d6981Smrg 111ea1d6981Smrg <para>Although the wire event is of arbitrary length, the actual size of 112ea1d6981Smrg an XEvent is restricted to sizeof(XEvent) [96 bytes, see Xlib.h]. If an 113ea1d6981Smrg extension converts a wire event to an XEvent > 96 bytes, it will 114ea1d6981Smrg overwrite the space allocated for the event. See struct _XSQEvent in 115ea1d6981Smrg Xlibint.h for details.</para> 116ea1d6981Smrg 117ea1d6981Smrg <para>Extensions need to malloc additional data and fill the XEvent 118ea1d6981Smrg structure with pointers to the malloc'd data. The client then needs to 119ea1d6981Smrg free the data, only the XEvent structure will be released by Xlib.</para> 120ea1d6981Smrg 121ea1d6981Smrg <para>The server must not send GenericEvents longer than 32 bytes until it 122ea1d6981Smrg has verified that the client is able to interpret these events. If a long 123ea1d6981Smrg event is sent to a client unable to process GenericEvents, future 124ea1d6981Smrg interpretation of replies and events by this client will fail.</para> 125ea1d6981Smrg </chapter> 126ea1d6981Smrg</book> 127