VirtualBox

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

Last change on this file was 38824, checked in by vboxsync, 13 years ago

Additions/x11: header files for building X.Org Server 1.11 modules

  • Property svn:eol-style set to native
File size: 8.5 KB
Line 
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/**
72 * Used for ALL input device events internal in the server until
73 * copied into the matching protocol event.
74 *
75 * Note: We only use the device id because the DeviceIntPtr may become invalid while
76 * the event is in the EQ.
77 */
78struct _DeviceEvent
79{
80 unsigned char header; /**< Always ET_Internal */
81 enum EventType type; /**< One of EventType */
82 int length; /**< Length in bytes */
83 Time time; /**< Time in ms */
84 int deviceid; /**< Device to post this event for */
85 int sourceid; /**< The physical source device */
86 union {
87 uint32_t button; /**< Button number */
88 uint32_t key; /**< Key code */
89 } detail;
90 int16_t root_x; /**< Pos relative to root window in integral data */
91 float root_x_frac; /**< Pos relative to root window in frac part */
92 int16_t root_y; /**< Pos relative to root window in integral part */
93 float root_y_frac; /**< Pos relative to root window in frac part */
94 uint8_t buttons[(MAX_BUTTONS + 7)/8]; /**< Button mask */
95 struct {
96 uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
97 uint8_t mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/
98 int32_t data[MAX_VALUATORS]; /**< Valuator data */
99 int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */
100 } valuators;
101 struct {
102 uint32_t base; /**< XKB base modifiers */
103 uint32_t latched; /**< XKB latched modifiers */
104 uint32_t locked; /**< XKB locked modifiers */
105 uint32_t effective;/**< XKB effective modifiers */
106 } mods;
107 struct {
108 uint8_t base; /**< XKB base group */
109 uint8_t latched; /**< XKB latched group */
110 uint8_t locked; /**< XKB locked group */
111 uint8_t effective;/**< XKB effective group */
112 } group;
113 Window root; /**< Root window of the event */
114 int corestate; /**< Core key/button state BEFORE the event */
115 int key_repeat; /**< Internally-generated key repeat event */
116};
117
118
119/* Flags used in DeviceChangedEvent to signal if the slave has changed */
120#define DEVCHANGE_SLAVE_SWITCH 0x2
121/* Flags used in DeviceChangedEvent to signal whether the event was a
122 * pointer event or a keyboard event */
123#define DEVCHANGE_POINTER_EVENT 0x4
124#define DEVCHANGE_KEYBOARD_EVENT 0x8
125/* device capabilities changed */
126#define DEVCHANGE_DEVICE_CHANGE 0x10
127
128/**
129 * Sent whenever a device's capabilities have changed.
130 */
131struct _DeviceChangedEvent
132{
133 unsigned char header; /**< Always ET_Internal */
134 enum EventType type; /**< ET_DeviceChanged */
135 int length; /**< Length in bytes */
136 Time time; /**< Time in ms */
137 int deviceid; /**< Device whose capabilities have changed */
138 int flags; /**< Mask of ::HAS_NEW_SLAVE,
139 ::POINTER_EVENT, ::KEYBOARD_EVENT */
140 int masterid; /**< MD when event was generated */
141 int sourceid; /**< The device that caused the change */
142
143 struct {
144 int num_buttons; /**< Number of buttons */
145 Atom names[MAX_BUTTONS];/**< Button names */
146 } buttons;
147
148 int num_valuators; /**< Number of axes */
149 struct {
150 uint32_t min; /**< Minimum value */
151 uint32_t max; /**< Maximum value */
152 /* FIXME: frac parts of min/max */
153 uint32_t resolution; /**< Resolution counts/m */
154 uint8_t mode; /**< Relative or Absolute */
155 Atom name; /**< Axis name */
156 } valuators[MAX_VALUATORS];
157
158 struct {
159 int min_keycode;
160 int max_keycode;
161 } keys;
162};
163
164#if XFreeXDGA
165/**
166 * DGAEvent, used by DGA to intercept and emulate input events.
167 */
168struct _DGAEvent
169{
170 unsigned char header; /**< Always ET_Internal */
171 enum EventType type; /**< ET_DGAEvent */
172 int length; /**< Length in bytes */
173 Time time; /**< Time in ms */
174 int subtype; /**< KeyPress, KeyRelease, ButtonPress,
175 ButtonRelease, MotionNotify */
176 int detail; /**< Button number or key code */
177 int dx; /**< Relative x coordinate */
178 int dy; /**< Relative y coordinate */
179 int screen; /**< Screen number this event applies to */
180 uint16_t state; /**< Core modifier/button state */
181};
182#endif
183
184/**
185 * Raw event, contains the data as posted by the device.
186 */
187struct _RawDeviceEvent
188{
189 unsigned char header; /**< Always ET_Internal */
190 enum EventType type; /**< ET_Raw */
191 int length; /**< Length in bytes */
192 Time time; /**< Time in ms */
193 int deviceid; /**< Device to post this event for */
194 int sourceid; /**< The physical source device */
195 union {
196 uint32_t button; /**< Button number */
197 uint32_t key; /**< Key code */
198 } detail;
199 struct {
200 uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
201 int32_t data[MAX_VALUATORS]; /**< Valuator data */
202 int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */
203 int32_t data_raw[MAX_VALUATORS]; /**< Valuator data as posted */
204 int32_t data_raw_frac[MAX_VALUATORS];/**< Fractional part for data_raw */
205 } valuators;
206};
207
208#ifdef XQUARTZ
209#define XQUARTZ_EVENT_MAXARGS 5
210struct _XQuartzEvent {
211 unsigned char header; /**< Always ET_Internal */
212 enum EventType type; /**< Always ET_XQuartz */
213 int length; /**< Length in bytes */
214 Time time; /**< Time in ms. */
215 int subtype; /**< Subtype defined by XQuartz DDX */
216 uint32_t data[XQUARTZ_EVENT_MAXARGS]; /**< Up to 5 32bit values passed to handler */
217};
218#endif
219
220/**
221 * Event type used inside the X server for input event
222 * processing.
223 */
224union _InternalEvent {
225 struct {
226 unsigned char header; /**< Always ET_Internal */
227 enum EventType type; /**< One of ET_* */
228 int length; /**< Length in bytes */
229 Time time; /**< Time in ms. */
230 } any;
231 DeviceEvent device_event;
232 DeviceChangedEvent changed_event;
233#if XFreeXDGA
234 DGAEvent dga_event;
235#endif
236 RawDeviceEvent raw_event;
237#ifdef XQUARTZ
238 XQuartzEvent xquartz_event;
239#endif
240};
241
242#endif
Note: See TracBrowser for help on using the repository browser.

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