Line data Source code
1 :
2 : /* Copyright (c) 2006-2016, Stefan Eilemann <eile@equalizergraphics.com>
3 : * Cedric Stalder <cedric.stalder@gmail.com>
4 : * 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 : #include "eventHandler.h"
21 :
22 : namespace eq
23 : {
24 0 : void EventHandler::_computePointerDelta(const EventType type,
25 : PointerEvent& event)
26 : {
27 0 : switch (type)
28 : {
29 : case EVENT_WINDOW_POINTER_BUTTON_PRESS:
30 : case EVENT_WINDOW_POINTER_BUTTON_RELEASE:
31 0 : if (_lastEventType == EVENT_WINDOW_POINTER_MOTION)
32 : {
33 0 : event.dx = _lastPointerEvent.dx;
34 0 : event.dy = _lastPointerEvent.dy;
35 0 : break;
36 : }
37 : // fall through
38 :
39 : default:
40 0 : event.dx = event.x - _lastPointerEvent.x;
41 0 : event.dy = event.y - _lastPointerEvent.y;
42 : }
43 0 : _lastEventType = type;
44 0 : _lastPointerEvent = event;
45 0 : }
46 30 : }
|