os: add input touch event type

Issue #1444
This commit is contained in:
Alexander Boettcher 2015-03-09 12:42:37 +01:00 committed by Christian Helmuth
parent 684ce272e6
commit 71c3fa53da
2 changed files with 8 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class Input::Event
{
public:
enum Type { INVALID, MOTION, PRESS, RELEASE, WHEEL, FOCUS, LEAVE };
enum Type { INVALID, MOTION, PRESS, RELEASE, WHEEL, FOCUS, LEAVE, TOUCH };
private:
@ -77,6 +77,12 @@ class Input::Event
bool is_absolute_motion() const { return _type == MOTION && !_rx && !_ry; }
bool is_relative_motion() const { return _type == MOTION && (_rx || _ry); }
bool is_touch_release() const { return _type == TOUCH && (_rx == -1) && (_ry == -1); }
static Event create_touch_event(int ax, int ay, int id, bool last = false)
{
return Event(Type::TOUCH, id, ax, ay, last ? -1 : 0, last ? -1 : 0);
}
};
#endif /* _INCLUDE__INPUT__EVENT_H_ */

View File

@ -30,6 +30,7 @@ static char const * ev_type(Input::Event::Type type)
case Input::Event::WHEEL: return "WHEEL ";
case Input::Event::FOCUS: return "FOCUS ";
case Input::Event::LEAVE: return "LEAVE ";
case Input::Event::TOUCH: return "TOUCH ";
}
return "";