Line data Source code
1 :
2 : /* Copyright (c) 2006-2009, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2011, Cedric Stalder <cedric.stalder@gmail.com>
4 : * 2014, 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 :
25 0 : void EventHandler::_computePointerDelta( Event& event )
26 : {
27 0 : switch( event.type )
28 : {
29 : case Event::WINDOW_POINTER_BUTTON_PRESS:
30 : case Event::WINDOW_POINTER_BUTTON_RELEASE:
31 0 : if( _lastPointerEvent.type == Event::WINDOW_POINTER_MOTION )
32 : {
33 0 : event.pointer.dx = _lastPointerEvent.pointer.dx;
34 0 : event.pointer.dy = _lastPointerEvent.pointer.dy;
35 0 : break;
36 : }
37 : // fall through
38 :
39 : default:
40 0 : event.pointer.dx = event.pointer.x - _lastPointerEvent.pointer.x;
41 0 : event.pointer.dy = event.pointer.y - _lastPointerEvent.pointer.y;
42 : }
43 0 : _lastPointerEvent = event;
44 0 : }
45 :
46 36 : }
|