VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.9.0/eventstr.h@ 61386

最後變更 在這個檔案從61386是 32163,由 vboxsync 提交於 14 年 前

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

  • 屬性 svn:eol-style 設為 native
檔案大小: 8.7 KB
 
1/*
2 * Copyright © 2009 Red Hat, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 */
24
25#ifndef EVENTSTR_H
26#define EVENTSTR_H
27
28#include <events.h>
29/**
30 * @file events.h
31 * This file describes the event structures used internally by the X
32 * server during event generation and event processing.
33 *
34 * When are internal events used?
35 * Events from input devices are stored as internal events in the EQ and
36 * processed as internal events until late in the processing cycle. Only then
37 * do they switch to their respective wire events.
38 */
39
40/**
41 * Event types. Used exclusively internal to the server, not visible on the
42 * protocol.
43 *
44 * Note: Keep KeyPress to Motion aligned with the core events.
45 * Keep ET_Raw* in the same order as KeyPress - Motion
46 */
47enum EventType {
48 ET_KeyPress = 2,
49 ET_KeyRelease,
50 ET_ButtonPress,
51 ET_ButtonRelease,
52 ET_Motion,
53 ET_Enter,
54 ET_Leave,
55 ET_FocusIn,
56 ET_FocusOut,
57 ET_ProximityIn,
58 ET_ProximityOut,
59 ET_DeviceChanged,
60 ET_Hierarchy,
61 ET_DGAEvent,
62 ET_RawKeyPress,
63 ET_RawKeyRelease,
64 ET_RawButtonPress,
65 ET_RawButtonRelease,
66 ET_RawMotion,
67 ET_XQuartz,
68 ET_Internal = 0xFF /* First byte */
69};
70
71#define CHECKEVENT(ev) if (ev && ((InternalEvent*)(ev))->any.header != 0xFF) \
72 FatalError("Wrong event type %d.\n", \
73 ((InternalEvent*)(ev))->any.header);
74
75/**
76 * Used for ALL input device events internal in the server until
77 * copied into the matching protocol event.
78 *
79 * Note: We only use the device id because the DeviceIntPtr may become invalid while
80 * the event is in the EQ.
81 */
82struct _DeviceEvent
83{
84 unsigned char header; /**< Always ET_Internal */
85 enum EventType type; /**< One of EventType */
86 int length; /**< Length in bytes */
87 Time time; /**< Time in ms */
88 int deviceid; /**< Device to post this event for */
89 int sourceid; /**< The physical source device */
90 union {
91 uint32_t button; /**< Button number */
92 uint32_t key; /**< Key code */
93 } detail;
94 int16_t root_x; /**< Pos relative to root window in integral data */
95 float root_x_frac; /**< Pos relative to root window in frac part */
96 int16_t root_y; /**< Pos relative to root window in integral part */
97 float root_y_frac; /**< Pos relative to root window in frac part */
98 uint8_t buttons[(MAX_BUTTONS + 7)/8]; /**< Button mask */
99 struct {
100 uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
101 uint8_t mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/
102 uint32_t data[MAX_VALUATORS]; /**< Valuator data */
103 int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */
104 } valuators;
105 struct {
106 uint32_t base; /**< XKB base modifiers */
107 uint32_t latched; /**< XKB latched modifiers */
108 uint32_t locked; /**< XKB locked modifiers */
109 uint32_t effective;/**< XKB effective modifiers */
110 } mods;
111 struct {
112 uint8_t base; /**< XKB base group */
113 uint8_t latched; /**< XKB latched group */
114 uint8_t locked; /**< XKB locked group */
115 uint8_t effective;/**< XKB effective group */
116 } group;
117 Window root; /**< Root window of the event */
118 int corestate; /**< Core key/button state BEFORE the event */
119 int key_repeat; /**< Internally-generated key repeat event */
120};
121
122
123/* Flags used in DeviceChangedEvent to signal if the slave has changed */
124#define DEVCHANGE_SLAVE_SWITCH 0x2
125/* Flags used in DeviceChangedEvent to signal whether the event was a
126 * pointer event or a keyboard event */
127#define DEVCHANGE_POINTER_EVENT 0x4
128#define DEVCHANGE_KEYBOARD_EVENT 0x8
129/* device capabilities changed */
130#define DEVCHANGE_DEVICE_CHANGE 0x10
131
132/**
133 * Sent whenever a device's capabilities have changed.
134 */
135struct _DeviceChangedEvent
136{
137 unsigned char header; /**< Always ET_Internal */
138 enum EventType type; /**< ET_DeviceChanged */
139 int length; /**< Length in bytes */
140 Time time; /**< Time in ms */
141 int deviceid; /**< Device whose capabilities have changed */
142 int flags; /**< Mask of ::HAS_NEW_SLAVE,
143 ::POINTER_EVENT, ::KEYBOARD_EVENT */
144 int masterid; /**< MD when event was generated */
145 int sourceid; /**< The device that caused the change */
146
147 struct {
148 int num_buttons; /**< Number of buttons */
149 Atom names[MAX_BUTTONS];/**< Button names */
150 } buttons;
151
152 int num_valuators; /**< Number of axes */
153 struct {
154 uint32_t min; /**< Minimum value */
155 uint32_t max; /**< Maximum value */
156 /* FIXME: frac parts of min/max */
157 uint32_t resolution; /**< Resolution counts/m */
158 uint8_t mode; /**< Relative or Absolute */
159 Atom name; /**< Axis name */
160 } valuators[MAX_VALUATORS];
161
162 struct {
163 int min_keycode;
164 int max_keycode;
165 } keys;
166};
167
168#if XFreeXDGA
169/**
170 * DGAEvent, used by DGA to intercept and emulate input events.
171 */
172struct _DGAEvent
173{
174 unsigned char header; /**< Always ET_Internal */
175 enum EventType type; /**< ET_DGAEvent */
176 int length; /**< Length in bytes */
177 Time time; /**< Time in ms */
178 int subtype; /**< KeyPress, KeyRelease, ButtonPress,
179 ButtonRelease, MotionNotify */
180 int detail; /**< Relative x coordinate */
181 int dx; /**< Relative x coordinate */
182 int dy; /**< Relative y coordinate */
183 int screen; /**< Screen number this event applies to */
184 uint16_t state; /**< Core modifier/button state */
185};
186#endif
187
188/**
189 * Raw event, contains the data as posted by the device.
190 */
191struct _RawDeviceEvent
192{
193 unsigned char header; /**< Always ET_Internal */
194 enum EventType type; /**< ET_Raw */
195 int length; /**< Length in bytes */
196 Time time; /**< Time in ms */
197 int deviceid; /**< Device to post this event for */
198 int sourceid; /**< The physical source device */
199 union {
200 uint32_t button; /**< Button number */
201 uint32_t key; /**< Key code */
202 } detail;
203 struct {
204 uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
205 int32_t data[MAX_VALUATORS]; /**< Valuator data */
206 int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */
207 int32_t data_raw[MAX_VALUATORS]; /**< Valuator data as posted */
208 int32_t data_raw_frac[MAX_VALUATORS];/**< Fractional part for data_raw */
209 } valuators;
210};
211
212#ifdef XQUARTZ
213#define XQUARTZ_EVENT_MAXARGS 5
214struct _XQuartzEvent {
215 unsigned char header; /**< Always ET_Internal */
216 enum EventType type; /**< Always ET_XQuartz */
217 int length; /**< Length in bytes */
218 Time time; /**< Time in ms. */
219 int subtype; /**< Subtype defined by XQuartz DDX */
220 uint32_t data[XQUARTZ_EVENT_MAXARGS]; /**< Up to 5 32bit values passed to handler */
221};
222#endif
223
224/**
225 * Event type used inside the X server for input event
226 * processing.
227 */
228union _InternalEvent {
229 struct {
230 unsigned char header; /**< Always ET_Internal */
231 enum EventType type; /**< One of ET_* */
232 int length; /**< Length in bytes */
233 Time time; /**< Time in ms. */
234 } any;
235 DeviceEvent device_event;
236 DeviceChangedEvent changed_event;
237#if XFreeXDGA
238 DGAEvent dga_event;
239#endif
240 RawDeviceEvent raw_event;
241#ifdef XQUARTZ
242 XQuartzEvent xquartz_event;
243#endif
244};
245
246#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette