Equalizer  2.1.0
Parallel Rendering Framework
pointerEvent.h
1 
2 /* Copyright (c) 2016-2017, 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()
32  : x(0)
33  , y(0)
34  , dx(0)
35  , dy(0)
36  , buttons(0)
37  , button(0)
38  , xAxis(0)
39  , yAxis(0)
40  {
41  }
42 
43  int32_t x;
44  int32_t y;
45  int32_t dx;
46  int32_t dy;
47  uint32_t buttons;
48  uint32_t button;
49  KeyModifier modifiers;
50  float xAxis;
51  float yAxis;
53 };
54 
56 inline std::ostream& operator<<(std::ostream& os, const PointerEvent& event)
57 {
58  os << static_cast<const Event&>(event) << " [" << event.x << "], ["
59  << event.y << "] d(" << event.dx << ", " << event.dy << ')' << " wheel "
60  << '[' << event.xAxis << ", " << event.yAxis << "] buttons ";
61 
62  if (event.buttons == PTR_BUTTON_NONE)
63  os << "none";
64  if (event.buttons & PTR_BUTTON1)
65  os << "1";
66  if (event.buttons & PTR_BUTTON2)
67  os << "2";
68  if (event.buttons & PTR_BUTTON3)
69  os << "3";
70  if (event.buttons & PTR_BUTTON4)
71  os << "4";
72  if (event.buttons & PTR_BUTTON5)
73  os << "5";
74 
75  os << event.modifiers << " fired ";
76  if (event.button == PTR_BUTTON_NONE)
77  os << "none";
78  if (event.button & PTR_BUTTON1)
79  os << "1";
80  if (event.button & PTR_BUTTON2)
81  os << "2";
82  if (event.button & PTR_BUTTON3)
83  os << "3";
84  if (event.button & PTR_BUTTON4)
85  os << "4";
86  if (event.button & PTR_BUTTON5)
87  os << "5";
88 
89  return os << " context " << event.context;
90 }
91 }
92 }
93 
94 #endif // EQFABRIC_EVENT_H
uint32_t buttons
current state of all buttons
Definition: pointerEvent.h:47
int32_t y
Y position relative to entity (0 is on top)
Definition: pointerEvent.h:44
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:52
Event for a pointer (mouse) motion or click.
Definition: pointerEvent.h:29
KeyModifier modifiers
state of modifier keys
Definition: pointerEvent.h:49
float yAxis
y wheel rotation in clicks
Definition: pointerEvent.h:51
int32_t dy
Y position change since last event.
Definition: pointerEvent.h:46
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:49
float xAxis
x wheel rotation in clicks
Definition: pointerEvent.h:50
int32_t x
X position relative to entity.
Definition: pointerEvent.h:43
int32_t dx
X position change since last event.
Definition: pointerEvent.h:45
uint32_t button
fired button
Definition: pointerEvent.h:48
The context applied to a channel during rendering operations.
Definition: renderContext.h:37