1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
X Generic Event Extension
Peter Hutterer
peter@cs.unisa.edu.au
1. Introduction
2. Requests
3. Events
4. Usage from other extensions - server side
5. Usage from other extensions - client side
6. Notes
_____________________________________________________________________________
1. Introduction
X was designed to provide 64 event opcodes for all extensions. With the
increasing number of extensions, event opcodes are running out and future
extensions will not be able to send events to the client.
The Generic Event Extension is a template for future extensions to re-use a
single opcode. GE does not actually do much but provide headers and a few API
calls. The majority of the work is still to be done in the extensions.
Standard X events are limited to 32 bytes. GenericEvents have the same size
restrictions as requests, with a minimum of 32 bytes, followed by an arbitrary
amount of data specified in the length field (see Section 3.)
_____________________________________________________________________________
2. Requests
GEQueryVersion:
CARD8 reqType
CARD8 ReqType X_GEQueryVersion
CARD16 length
CARD32 majorVersion
CARD32 minorVersion
GEQueryVersion reply:
CARD8 repType
CARD8 RepType X_GEQueryVersion
CARD16 sequenceNumber
CARD32 length
CARD16 major_version
CARD16 minor_version
_____________________________________________________________________________
3. Events
GE defines a single event, to be used by all extensions. The event's structure
is similar to a request.
GenericEvent
BYTE type
CARD8 extension
CARD16 sequenceNumber
CARD32 length;
CARD16 evtype;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
The field 'extension' is to be set to the major opcode of the extension.
The 'evtype' field is the actual opcode of the event.
This event is to be type-cast by an extension to it's real format.
The length field specifies the number of 4-byte blocks after the initial 32
bytes.
_____________________________________________________________________________
4. Usage from other extensions - server side
GERegisterExtension(major_opcode, swap)
An extension needs to register at the GE. This should be done after
calling AddExtension().
major_opcode is the major opcode for all extension requests.
The swap function will be called when an event has to be converted for a
client with different byte ordering.
_____________________________________________________________________________
5. Usage from other extensions - client side
None. The event conversion rules of the extension however should be able to
handle events of type GenericEvent as well.
Internally, when an extension is initialized, it needs to call XExtAddDisplay
and provide a set of hooks that are to be called for events conversion and
other stuff. XGE hooks into XExtAddDisplay and stores the hooks provided by
the extension. Should a GenericEvent come along, XGE receives it but relays
the call to the real extension to handle it.
_____________________________________________________________________________
6. Notes
Although the wire event is of arbitrary length, the actual size of an XEvent
is restricted to sizeof(XEvent) [96 bytes, see Xlib.h]. If an extension
converts a wire event to an XEvent > 96 bytes, it will overwrite the space
acllocated for the event. See struct _XSQEvent in Xlibint.h for details.
Extensions need to malloc additional data and fill the XEvent structure with
pointers to the malloc'd data. The client then needs to free the data, only
the XEvent structure will be released by Xlib.
|