Equalizer  1.6.1
event.h
1 
2 /* Copyright (c) 2006-2013, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2011, Cedric Stalder <cedric.stalder@gmail.com>
4  * 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef EQ_EVENT_H
21 #define EQ_EVENT_H
22 
23 #include <eq/client/api.h>
24 #include <eq/client/statistic.h> // member
25 #include <eq/client/types.h>
26 #include <eq/fabric/renderContext.h> // member
27 
28 
29 namespace eq
30 {
36 enum KeyCode
37 {
38  KC_ESCAPE = 256,
39  KC_BACKSPACE,
40  KC_RETURN,
41  KC_TAB,
42  KC_HOME,
43  KC_LEFT,
44  KC_UP,
45  KC_RIGHT,
46  KC_DOWN,
47  KC_PAGE_UP,
48  KC_PAGE_DOWN,
49  KC_END,
50  KC_F1,
51  KC_F2,
52  KC_F3,
53  KC_F4,
54  KC_F5,
55  KC_F6,
56  KC_F7,
57  KC_F8,
58  KC_F9,
59  KC_F10,
60  KC_F11,
61  KC_F12,
62  KC_F13,
63  KC_F14,
64  KC_F15,
65  KC_F16,
66  KC_F17,
67  KC_F18,
68  KC_F19,
69  KC_F20,
70  KC_F21,
71  KC_F22,
72  KC_F23,
73  KC_F24,
74  KC_SHIFT_L,
75  KC_SHIFT_R,
76  KC_CONTROL_L,
77  KC_CONTROL_R,
78  KC_ALT_L,
79  KC_ALT_R,
80  KC_VOID = 0xFFFFFF /* == XK_VoidSymbol */
81 };
82 
89 {
90  PTR_BUTTON_NONE = LB_BIT_NONE,
91  PTR_BUTTON1 = LB_BIT1,
92  PTR_BUTTON2 = LB_BIT2,
93  PTR_BUTTON3 = LB_BIT3,
94  PTR_BUTTON4 = LB_BIT4,
95  PTR_BUTTON5 = LB_BIT5,
96  PTR_BUTTON6 = LB_BIT6,
97  PTR_BUTTON7 = LB_BIT7
98 };
99 
105 {
106  int32_t x;
107  int32_t y;
108  int32_t w;
109  int32_t h;
110  float dw;
111  float dh;
112 };
113 
116 {
117  int32_t x;
118  int32_t y;
119  int32_t dx;
120  int32_t dy;
121  uint32_t buttons;
122  uint32_t button;
123  int32_t xAxis;
124  int32_t yAxis;
125 };
126 
128 struct KeyEvent
129 {
130  uint32_t key;
131  // TODO modifier state
132 };
133 
139 {
140  uint32_t button;
141  uint32_t buttons;
142  int16_t xAxis;
143  int16_t yAxis;
144  int16_t zAxis;
145  int16_t xRotation;
146  int16_t yRotation;
147  int16_t zRotation;
148 };
149 
150 # define EQ_USER_EVENT_SIZE 128
151 
157 struct UserEvent
158 {
159  char data[ EQ_USER_EVENT_SIZE ];
160 };
161 
171 struct Event
172 {
174  EQ_API Event();
175 
177  enum Type // Also update string table in event.cpp
178  {
185 #ifdef EQ_USE_DEPRECATED
186  POINTER_MOTION,
187 
188  POINTER_BUTTON_PRESS,
190  POINTER_BUTTON_RELEASE,
191  POINTER_WHEEL,
192  CHANNEL_POINTER_MOTION = POINTER_MOTION,
195  CHANNEL_POINTER_BUTTON_PRESS = POINTER_BUTTON_PRESS,
197  CHANNEL_POINTER_BUTTON_RELEASE = POINTER_BUTTON_RELEASE,
199  WINDOW_POINTER_WHEEL = POINTER_WHEEL,
200 #else
201  CHANNEL_POINTER_MOTION,
211 #endif
212  WINDOW_POINTER_MOTION,
222 
232 
239 
241 
242  USER = UNKNOWN + 5, // some buffer for binary-compatible patches
243  ALL // must be last
244  };
245 
246  uint32_t type;
247 
248  // keep before 'uint128_t originator' for alignment
249  uint32_t serial;
250 
252  int64_t time;
253 
255  uint128_t originator;
256 
258  union
259  {
263 
269 
273 
276 
278  };
279 
281  RenderContext context;
282 };
283 
285 EQ_API std::ostream& operator << ( std::ostream&, const Event& );
287 EQ_API std::ostream& operator << ( std::ostream&, const Event::Type& );
289 EQ_API std::ostream& operator << ( std::ostream&, const ResizeEvent& );
291 EQ_API std::ostream& operator << ( std::ostream&, const PointerEvent& );
293 EQ_API std::ostream& operator << ( std::ostream&, const KeyEvent& );
295 EQ_API std::ostream& operator << ( std::ostream&, const MagellanEvent& );
296 }
297 
298 namespace lunchbox
299 {
300 template<> inline void byteswap( eq::Event& value )
301 {
302  byteswap( value.type );
303  byteswap( value.serial );
304  byteswap( value.time );
305  byteswap( value.originator );
306  // #145 Todo byteswap union
307  //byteswap( value.union );
308  byteswap( value.context );
309 }
310 }
311 
312 #endif // EQ_EVENT_H
int32_t x
new X position, relative to parent
Definition: event.h:106
SpaceMouse button data in magellan.
Definition: event.h:230
Event structure to report window system and other events.
Definition: event.h:171
A window screensaver request (Win32 only)
Definition: event.h:184
int32_t dx
X position change since last event.
Definition: event.h:119
Event for a SpaceMouse movement or click.
Definition: event.h:138
int32_t y
new Y position, relative to parent
Definition: event.h:107
UserEvent user
User-defined event data.
Definition: event.h:277
Event()
Construct a new event.
Event for a pointer (mouse) motion or click.
Definition: event.h:115
A window has been closed.
Definition: event.h:181
Node has timed out.
Definition: event.h:231
int32_t xAxis
x wheel rotation
Definition: event.h:123
int32_t yAxis
y wheel rotation
Definition: event.h:124
Window resize data in resize.
Definition: event.h:180
int64_t time
The config time when the event was created.
Definition: event.h:252
float dw
view only: new width relative to initial width
Definition: event.h:110
Window pointer Mouse wheel data in wheel.
Definition: event.h:208
uint32_t button
fired button
Definition: event.h:140
Type
The type of the event.
Definition: event.h:177
int16_t yRotation
Y rotation.
Definition: event.h:146
int32_t dy
Y position change since last event.
Definition: event.h:120
float dh
view only: new height relative to initial height
Definition: event.h:111
View resize data in resize.
Definition: event.h:227
RenderContext context
The last rendering context for the pointer position.
Definition: event.h:281
std::ostream & operator<<(std::ostream &os, const ConfigEvent *event)
Print the config event to the given output stream.
int32_t x
X position relative to entity.
Definition: event.h:117
ResizeEvent resize
Resize event data.
Definition: event.h:260
Event for a size or position change on a Window, Channel or View.
Definition: event.h:104
int32_t w
new width
Definition: event.h:108
uint128_t originator
The identifier of the entity emitting the event.
Definition: event.h:255
Key press data in keyPress.
Definition: event.h:223
Statistic statistic
Statistic event.
Definition: event.h:274
int16_t xRotation
X rotation.
Definition: event.h:145
A window is dirty.
Definition: event.h:179
Key release data in keyRelease.
Definition: event.h:224
Statistic event in statistic.
Definition: event.h:226
PointerEvent pointer
Pointer event data.
Definition: event.h:264
PointerEvent pointerButtonPress
Mouse button press data.
Definition: event.h:266
uint32_t buttons
current state of all buttons
Definition: event.h:141
PointerEvent pointerWheel
Mouse wheel motion data.
Definition: event.h:268
Window pointer button press data in pointerButtonPress.
Definition: event.h:215
ResizeEvent show
Window show event data.
Definition: event.h:261
uint32_t buttons
current state of all buttons
Definition: event.h:121
Window pointer to be released by system window.
Definition: event.h:221
int16_t xAxis
X translation.
Definition: event.h:142
Window pointer grabbed by system window.
Definition: event.h:219
KeyEvent key
Key event data.
Definition: event.h:270
Channel pointer button press data in pointerButtonPress.
Definition: event.h:204
uint32_t type
The event type.
Definition: event.h:246
A statistics event.
Definition: statistic.h:36
Event type not known by the event handler.
Definition: event.h:240
int16_t zAxis
Z translation.
Definition: event.h:144
KeyEvent keyPress
Key press event data.
Definition: event.h:271
User-defined events have to be of this type or higher.
Definition: event.h:242
A window is shown.
Definition: event.h:183
KeyEvent keyRelease
Key release event data.
Definition: event.h:272
Exit request due to runtime error.
Definition: event.h:228
MagellanEvent magellan
SpaceMouse data.
Definition: event.h:275
uint32_t button
fired button
Definition: event.h:122
Channel resize data in resize.
Definition: event.h:225
Channel pointer button release data in pointerButtonRelease.
Definition: event.h:206
PointerEvent pointerMotion
Pointer motion data.
Definition: event.h:265
KeyCode
Yet another key code table to report keys in a window system independent way.
Definition: event.h:36
SpaceMouse movement data in magellan.
Definition: event.h:229
PointerEvent pointerButtonRelease
Mouse button release data.
Definition: event.h:267
int32_t h
new height
Definition: event.h:109
Window pointer button release data in pointerButtonRelease.
Definition: event.h:217
int16_t zRotation
Z rotation.
Definition: event.h:147
int32_t y
Y position relative to entity (0 is on top)
Definition: event.h:118
A window is hidden.
Definition: event.h:182
int16_t yAxis
Y translation.
Definition: event.h:143
Observer moved (head tracking update).
Definition: event.h:238
Event for a key press or release.
Definition: event.h:128
User-defined event.
Definition: event.h:157
uint32_t key
KeyCode for special keys, ascii code otherwise.
Definition: event.h:130
Window pointer movement data in pointerMotion.
Definition: event.h:210
uint32_t serial
server-unique originator serial number
Definition: event.h:249
PointerButton
Mouse pointer button definition.
Definition: event.h:88
ResizeEvent hide
Window hide event data.
Definition: event.h:262