Equalizer  1.9.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 EQFABRIC_EVENT_H
21 #define EQFABRIC_EVENT_H
22 
23 #include <eq/fabric/api.h>
24 #include <eq/fabric/types.h>
25 #include <eq/fabric/renderContext.h> // member
26 #include <eq/fabric/statistic.h> // member
27 
28 
29 namespace eq
30 {
31 namespace fabric
32 {
33 
39 {
40  int32_t x;
41  int32_t y;
42  int32_t w;
43  int32_t h;
44  float dw;
45  float dh;
46 };
47 
50 {
51  int32_t x;
52  int32_t y;
53  int32_t dx;
54  int32_t dy;
55  uint32_t buttons;
56  uint32_t button;
57  int32_t xAxis;
58  int32_t yAxis;
59 };
60 
62 struct KeyEvent
63 {
64  uint32_t key;
65  // TODO modifier state
66 };
67 
73 {
74  uint32_t button;
75  uint32_t buttons;
76  int16_t xAxis;
77  int16_t yAxis;
78  int16_t zAxis;
79  int16_t xRotation;
80  int16_t yRotation;
81  int16_t zRotation;
82 };
83 
84 # define EQ_USER_EVENT_SIZE 128
85 
91 struct UserEvent
92 {
93  char data[ EQ_USER_EVENT_SIZE ];
94 };
95 
105 struct Event
106 {
108  EQFABRIC_API Event();
109 
111  enum Type // Also update string table in event.cpp
112  {
119 #ifdef EQ_USE_DEPRECATED
120  POINTER_MOTION,
121 
122  POINTER_BUTTON_PRESS,
124  POINTER_BUTTON_RELEASE,
125  POINTER_WHEEL,
126  CHANNEL_POINTER_MOTION = POINTER_MOTION,
129  CHANNEL_POINTER_BUTTON_PRESS = POINTER_BUTTON_PRESS,
131  CHANNEL_POINTER_BUTTON_RELEASE = POINTER_BUTTON_RELEASE,
133  WINDOW_POINTER_WHEEL = POINTER_WHEEL,
134 #else
135  CHANNEL_POINTER_MOTION,
145 #endif
146  WINDOW_POINTER_MOTION,
156 
166 
173 
184 
186 
187  USER = UNKNOWN + 5, // some buffer for binary-compatible patches
188  ALL // must be last
189  };
190 
191  uint32_t type;
192 
193  // keep before 'uint128_t originator' for alignment
194  uint32_t serial;
195 
197  int64_t time;
198 
200  uint128_t originator;
201 
203  union
204  {
208 
214 
218 
221 
223  };
224 
227 };
228 
230 EQFABRIC_API std::ostream& operator << ( std::ostream&, const Event& );
232 EQFABRIC_API std::ostream& operator << ( std::ostream&, const Event::Type& );
234 EQFABRIC_API std::ostream& operator << ( std::ostream&, const ResizeEvent& );
236 EQFABRIC_API std::ostream& operator << ( std::ostream&, const PointerEvent& );
238 EQFABRIC_API std::ostream& operator << ( std::ostream&, const KeyEvent& );
240 EQFABRIC_API std::ostream& operator << ( std::ostream&, const MagellanEvent& );
241 }
242 }
243 
244 namespace lunchbox
245 {
246 template<> inline void byteswap( eq::fabric::Event& value )
247 {
248  byteswap( value.type );
249  byteswap( value.serial );
250  byteswap( value.time );
251  byteswap( value.originator );
252  // #145 Todo byteswap union
253  //byteswap( value.union );
254  byteswap( value.context );
255 }
256 }
257 
258 #endif // EQFABRIC_EVENT_H
A window is shown.
Definition: event.h:117
Channel pointer button release data in pointerButtonRelease.
Definition: event.h:140
uint32_t buttons
current state of all buttons
Definition: event.h:55
Type
The type of the event.
Definition: event.h:111
int16_t yAxis
Y translation.
Definition: event.h:77
int32_t yAxis
y wheel rotation
Definition: event.h:58
int32_t y
Y position relative to entity (0 is on top)
Definition: event.h:52
UserEvent user
User-defined event data.
Definition: event.h:222
int32_t y
new Y position, relative to parent
Definition: event.h:41
Event structure to report window system and other events.
Definition: event.h:105
Node error event.
Definition: event.h:180
uint32_t button
fired button
Definition: event.h:74
Channel error event.
Definition: event.h:183
PointerEvent pointerWheel
Mouse wheel motion data.
Definition: event.h:213
uint32_t key
KeyCode for special keys, ascii code otherwise.
Definition: event.h:64
PointerEvent pointerMotion
Pointer motion data.
Definition: event.h:210
Event type not known by the event handler.
Definition: event.h:185
uint32_t buttons
current state of all buttons
Definition: event.h:75
User-defined event.
Definition: event.h:91
Window error event.
Definition: event.h:182
int16_t xAxis
X translation.
Definition: event.h:76
MagellanEvent magellan
SpaceMouse data.
Definition: event.h:220
ResizeEvent resize
Resize event data.
Definition: event.h:205
Channel resize data in resize.
Definition: event.h:159
ResizeEvent hide
Window hide event data.
Definition: event.h:207
Event for a pointer (mouse) motion or click.
Definition: event.h:49
SpaceMouse movement data in magellan.
Definition: event.h:163
Window pointer button press data in pointerButtonPress.
Definition: event.h:149
ResizeEvent show
Window show event data.
Definition: event.h:206
int16_t xRotation
X rotation.
Definition: event.h:79
uint32_t serial
server-unique originator serial number
Definition: event.h:194
Window pointer grabbed by system window.
Definition: event.h:153
KeyEvent keyRelease
Key release event data.
Definition: event.h:217
Window pointer movement data in pointerMotion.
Definition: event.h:144
uint32_t type
The event type.
Definition: event.h:191
Exit request due to runtime error.
Definition: event.h:162
Key release data in keyRelease.
Definition: event.h:158
Window resize data in resize.
Definition: event.h:114
PointerEvent pointer
Pointer event data.
Definition: event.h:209
int16_t yRotation
Y rotation.
Definition: event.h:80
int16_t zAxis
Z translation.
Definition: event.h:78
int16_t zRotation
Z rotation.
Definition: event.h:81
KeyEvent key
Key event data.
Definition: event.h:215
Event for a key press or release.
Definition: event.h:62
int32_t dy
Y position change since last event.
Definition: event.h:54
PointerEvent pointerButtonPress
Mouse button press data.
Definition: event.h:211
A window is dirty.
Definition: event.h:113
Statistic event in statistic.
Definition: event.h:160
int32_t xAxis
x wheel rotation
Definition: event.h:57
Channel pointer button press data in pointerButtonPress.
Definition: event.h:138
Window pointer Mouse wheel data in wheel.
Definition: event.h:142
SpaceMouse button data in magellan.
Definition: event.h:164
Statistic statistic
Statistic event.
Definition: event.h:219
float dw
view only: new width relative to initial width
Definition: event.h:44
Observer moved (head tracking update).
Definition: event.h:172
Window pointer to be released by system window.
Definition: event.h:155
RenderContext context
The last rendering context for the pointer position.
Definition: event.h:226
int64_t time
The config time when the event was created.
Definition: event.h:197
Node has timed out.
Definition: event.h:165
Pipe error event.
Definition: event.h:181
Window pointer button release data in pointerButtonRelease.
Definition: event.h:151
A window is hidden.
Definition: event.h:116
EQFABRIC_API Event()
Construct a new event.
Event for a size or position change on a Window, Channel or View.
Definition: event.h:38
User-defined events have to be of this type or higher.
Definition: event.h:187
Event for a SpaceMouse movement or click.
Definition: event.h:72
int32_t x
X position relative to entity.
Definition: event.h:51
uint128_t originator
The identifier of the entity emitting the event.
Definition: event.h:200
char data[EQ_USER_EVENT_SIZE]
Application-specific data.
Definition: event.h:93
int32_t dx
X position change since last event.
Definition: event.h:53
A statistics event.
Definition: statistic.h:39
int32_t h
new height
Definition: event.h:43
int32_t x
new X position, relative to parent
Definition: event.h:40
uint32_t button
fired button
Definition: event.h:56
View resize data in resize.
Definition: event.h:161
KeyEvent keyPress
Key press event data.
Definition: event.h:216
PointerEvent pointerButtonRelease
Mouse button release data.
Definition: event.h:212
Key press data in keyPress.
Definition: event.h:157
The context applied to a channel during rendering operations.
Definition: renderContext.h:38
float dh
view only: new height relative to initial height
Definition: event.h:45
A window screensaver request (Win32 only)
Definition: event.h:118
A window has been closed.
Definition: event.h:115
Config error event.
Definition: event.h:179
int32_t w
new width
Definition: event.h:42