]> git.tdb.fi Git - libs/gui.git/blob - source/input/x11/mouse.cpp
Include the matching header first in .cpp files
[libs/gui.git] / source / input / x11 / mouse.cpp
1 #include "mouse.h"
2 #include <msp/graphics/window_private.h>
3 #include "keys.h"
4
5 namespace Msp {
6 namespace Input {
7
8 void Mouse::input_event(const Graphics::Window::Event &event)
9 {
10         switch(event.xevent.type)
11         {
12         case ButtonPress:
13         case ButtonRelease:
14                 set_button_state(event.xevent.xbutton.button, event.xevent.type==ButtonPress, true);
15                 break;
16         case MotionNotify:
17                 set_axis_value(MOUSE_X_AXIS, event.xevent.xmotion.x*2.0/window.get_width()-1.0, true);
18                 set_axis_value(MOUSE_Y_AXIS, 1.0-event.xevent.xmotion.y*2.0/window.get_height(), true);
19                 break;
20         }
21 }
22
23 } // namespace Input
24 } // namepsace Msp