Equalizer  2.0.0
Parallel Rendering Framework
pointerEvent.h
1 
2 /* Copyright (c) 2016, Stefan.Eilemann@epfl.ch
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQFABRIC_POINTEREVENT_H
19 #define EQFABRIC_POINTEREVENT_H
20 
21 #include <eq/fabric/event.h>
22 #include <eq/fabric/renderContext.h> // member
23 
24 namespace eq
25 {
26 namespace fabric
27 {
29 struct PointerEvent : public Event
30 {
31  PointerEvent() : x(0), y(0), dx(0), dy(0), buttons(0), button(0), xAxis(0)
32  , yAxis(0) {}
33 
34  int32_t x;
35  int32_t y;
36  int32_t dx;
37  int32_t dy;
38  uint32_t buttons;
39  uint32_t button;
40  KeyModifier modifiers;
41  float xAxis;
42  float yAxis;
44 };
45 
47 inline std::ostream& operator << ( std::ostream& os, const PointerEvent& event )
48 {
49  os << static_cast< const Event& >( event ) << " [" << event.x << "], ["
50  << event.y << "] d(" << event.dx << ", " << event.dy << ')' << " wheel "
51  << '[' << event.xAxis << ", " << event.yAxis << "] buttons ";
52 
53  if( event.buttons == PTR_BUTTON_NONE ) os << "none";
54  if( event.buttons & PTR_BUTTON1 ) os << "1";
55  if( event.buttons & PTR_BUTTON2 ) os << "2";
56  if( event.buttons & PTR_BUTTON3 ) os << "3";
57  if( event.buttons & PTR_BUTTON4 ) os << "4";
58  if( event.buttons & PTR_BUTTON5 ) os << "5";
59 
60  os << event.modifiers << " fired ";
61  if( event.button == PTR_BUTTON_NONE ) os << "none";
62  if( event.button & PTR_BUTTON1 ) os << "1";
63  if( event.button & PTR_BUTTON2 ) os << "2";
64  if( event.button & PTR_BUTTON3 ) os << "3";
65  if( event.button & PTR_BUTTON4 ) os << "4";
66  if( event.button & PTR_BUTTON5 ) os << "5";
67 
68  return os << " context " << event.context;
69 }
70 }
71 }
72 
73 namespace lunchbox
74 {
75 template<> inline void byteswap( eq::fabric::PointerEvent& value )
76 {
77  byteswap( static_cast< eq::fabric::Event& >( value ));
78  byteswap( value.x );
79  byteswap( value.y );
80  byteswap( value.dx );
81  byteswap( value.dy );
82  byteswap( value.buttons );
83  byteswap( value.button );
84  byteswap( value.modifiers );
85  byteswap( value.xAxis );
86  byteswap( value.yAxis );
87  byteswap( value.context );
88 }
89 }
90 
91 #endif // EQFABRIC_EVENT_H
uint32_t buttons
current state of all buttons
Definition: pointerEvent.h:38
int32_t y
Y position relative to entity (0 is on top)
Definition: pointerEvent.h:35
Base event structure to report window system and other events.
Definition: event.h:36
RenderContext context
The last rendering context at position.
Definition: pointerEvent.h:43
Event for a pointer (mouse) motion or click.
Definition: pointerEvent.h:29
KeyModifier modifiers
state of modifier keys
Definition: pointerEvent.h:40
float yAxis
y wheel rotation in clicks
Definition: pointerEvent.h:42
int32_t dy
Y position change since last event.
Definition: pointerEvent.h:37
The Equalizer client library.
Definition: eq/agl/types.h:23
std::ostream & operator<<(std::ostream &os, const AxisEvent &event)
Print the axis event to the given output stream.
Definition: axisEvent.h:42
float xAxis
x wheel rotation in clicks
Definition: pointerEvent.h:41
int32_t x
X position relative to entity.
Definition: pointerEvent.h:34
int32_t dx
X position change since last event.
Definition: pointerEvent.h:36
uint32_t button
fired button
Definition: pointerEvent.h:39
The context applied to a channel during rendering operations.
Definition: renderContext.h:37