Equalizer  1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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 
250 
252 
253  USER = UNKNOWN + 5, // some buffer for binary-compatible patches
254  ALL // must be last
255  };
256 
257  uint32_t type;
258 
259  // keep before 'uint128_t originator' for alignment
260  uint32_t serial;
261 
263  int64_t time;
264 
266  uint128_t originator;
267 
269  union
270  {
274 
280 
284 
287 
289  };
290 
292  RenderContext context;
293 };
294 
296 EQ_API std::ostream& operator << ( std::ostream&, const Event& );
298 EQ_API std::ostream& operator << ( std::ostream&, const Event::Type& );
300 EQ_API std::ostream& operator << ( std::ostream&, const ResizeEvent& );
302 EQ_API std::ostream& operator << ( std::ostream&, const PointerEvent& );
304 EQ_API std::ostream& operator << ( std::ostream&, const KeyEvent& );
306 EQ_API std::ostream& operator << ( std::ostream&, const MagellanEvent& );
307 }
308 
309 namespace lunchbox
310 {
311 template<> inline void byteswap( eq::Event& value )
312 {
313  byteswap( value.type );
314  byteswap( value.serial );
315  byteswap( value.time );
316  byteswap( value.originator );
317  // #145 Todo byteswap union
318  //byteswap( value.union );
319  byteswap( value.context );
320 }
321 }
322 
323 #endif // EQ_EVENT_H
int32_t xAxis
x wheel rotation
Definition: event.h:123
A statistics event.
Definition: statistic.h:36
float dh
view only: new height relative to initial height
Definition: event.h:111
UserEvent user
User-defined event data.
Definition: event.h:288
Window error event.
Definition: event.h:248
KeyEvent key
Key event data.
Definition: event.h:281
Channel pointer button release data in pointerButtonRelease.
Definition: event.h:206
Observer moved (head tracking update).
Definition: event.h:238
User-defined event.
Definition: event.h:157
ResizeEvent hide
Window hide event data.
Definition: event.h:273
PointerEvent pointerMotion
Pointer motion data.
Definition: event.h:276
Window pointer movement data in pointerMotion.
Definition: event.h:210
int32_t dy
Y position change since last event.
Definition: event.h:120
A window is hidden.
Definition: event.h:182
Channel resize data in resize.
Definition: event.h:225
ResizeEvent show
Window show event data.
Definition: event.h:272
PointerEvent pointer
Pointer event data.
Definition: event.h:275
int32_t h
new height
Definition: event.h:109
EQ_API std::ostream & operator<<(std::ostream &os, const ConfigEvent *event)
Print the config event to the given output stream.
Channel error event.
Definition: event.h:249
int32_t x
new X position, relative to parent
Definition: event.h:106
int32_t x
X position relative to entity.
Definition: event.h:117
Window pointer button press data in pointerButtonPress.
Definition: event.h:215
Statistic statistic
Statistic event.
Definition: event.h:285
PointerEvent pointerButtonRelease
Mouse button release data.
Definition: event.h:278
int16_t zAxis
Z translation.
Definition: event.h:144
int32_t dx
X position change since last event.
Definition: event.h:119
int16_t xAxis
X translation.
Definition: event.h:142
SpaceMouse button data in magellan.
Definition: event.h:230
Event type not known by the event handler.
Definition: event.h:251
int32_t yAxis
y wheel rotation
Definition: event.h:124
int32_t y
new Y position, relative to parent
Definition: event.h:107
Channel pointer button press data in pointerButtonPress.
Definition: event.h:204
int32_t w
new width
Definition: event.h:108
PointerEvent pointerButtonPress
Mouse button press data.
Definition: event.h:277
int32_t y
Y position relative to entity (0 is on top)
Definition: event.h:118
uint32_t key
KeyCode for special keys, ascii code otherwise.
Definition: event.h:130
SpaceMouse movement data in magellan.
Definition: event.h:229
uint32_t buttons
current state of all buttons
Definition: event.h:121
KeyEvent keyPress
Key press event data.
Definition: event.h:282
Type
The type of the event.
Definition: event.h:177
ResizeEvent resize
Resize event data.
Definition: event.h:271
Exit request due to runtime error.
Definition: event.h:228
Event for a SpaceMouse movement or click.
Definition: event.h:138
uint32_t type
The event type.
Definition: event.h:257
int16_t xRotation
X rotation.
Definition: event.h:145
RenderContext context
The last rendering context for the pointer position.
Definition: event.h:292
Key press data in keyPress.
Definition: event.h:223
Key release data in keyRelease.
Definition: event.h:224
uint128_t originator
The identifier of the entity emitting the event.
Definition: event.h:266
EQ_API Event()
Construct a new event.
Window pointer Mouse wheel data in wheel.
Definition: event.h:208
Event for a size or position change on a Window, Channel or View.
Definition: event.h:104
A window is dirty.
Definition: event.h:179
Node error event.
Definition: event.h:246
int16_t yAxis
Y translation.
Definition: event.h:143
uint32_t button
fired button
Definition: event.h:122
User-defined events have to be of this type or higher.
Definition: event.h:253
MagellanEvent magellan
SpaceMouse data.
Definition: event.h:286
A window screensaver request (Win32 only)
Definition: event.h:184
A window is shown.
Definition: event.h:183
uint32_t serial
server-unique originator serial number
Definition: event.h:260
int16_t yRotation
Y rotation.
Definition: event.h:146
KeyCode
Yet another key code table to report keys in a window system independent way.
Definition: event.h:36
float dw
view only: new width relative to initial width
Definition: event.h:110
Window resize data in resize.
Definition: event.h:180
Event for a key press or release.
Definition: event.h:128
PointerEvent pointerWheel
Mouse wheel motion data.
Definition: event.h:279
KeyEvent keyRelease
Key release event data.
Definition: event.h:283
Pipe error event.
Definition: event.h:247
uint32_t buttons
current state of all buttons
Definition: event.h:141
Event structure to report window system and other events.
Definition: event.h:171
View resize data in resize.
Definition: event.h:227
Event for a pointer (mouse) motion or click.
Definition: event.h:115
Statistic event in statistic.
Definition: event.h:226
A window has been closed.
Definition: event.h:181
Node has timed out.
Definition: event.h:231
Window pointer grabbed by system window.
Definition: event.h:219
Config error event.
Definition: event.h:245
uint32_t button
fired button
Definition: event.h:140
int64_t time
The config time when the event was created.
Definition: event.h:263
PointerButton
Mouse pointer button definition.
Definition: event.h:88
Window pointer to be released by system window.
Definition: event.h:221
Window pointer button release data in pointerButtonRelease.
Definition: event.h:217
int16_t zRotation
Z rotation.
Definition: event.h:147