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