nitpicker: forward touch events

Issue #1444
This commit is contained in:
Alexander Boettcher 2015-03-11 14:05:48 +01:00 committed by Christian Helmuth
parent cd764a6aa6
commit c745f9b48c
3 changed files with 23 additions and 9 deletions

View File

@ -481,6 +481,7 @@ class Wm::Nitpicker::Session_component : public Genode::Rpc_object<Session>,
abs_pos.x(), abs_pos.y(), 0, 0); abs_pos.x(), abs_pos.y(), 0, 0);
} }
case Input::Event::TOUCH:
case Input::Event::WHEEL: case Input::Event::WHEEL:
{ {
Point abs_pos = Point(ev.ax(), ev.ay()) + input_origin; Point abs_pos = Point(ev.ax(), ev.ay()) + input_origin;

View File

@ -65,15 +65,23 @@ static Input::Event translate_event(Input::Event const ev,
case Input::Event::RELEASE: case Input::Event::RELEASE:
case Input::Event::FOCUS: case Input::Event::FOCUS:
case Input::Event::LEAVE: case Input::Event::LEAVE:
case Input::Event::TOUCH:
{ {
Nit_fb::Point abs_pos = Nit_fb::Point(ev.ax(), ev.ay()) - input_origin; Nit_fb::Point abs_pos = Nit_fb::Point(ev.ax(), ev.ay()) -
input_origin;
using namespace Genode; using Genode::min;
using Genode::max;
using Input::Event;
return Input::Event(ev.type(), ev.code(), int const ax = min((int)boundary.w() - 1, max(0, abs_pos.x()));
min((int)boundary.w() - 1, max(0, abs_pos.x())), int const ay = min((int)boundary.h() - 1, max(0, abs_pos.y()));
min((int)boundary.h() - 1, max(0, abs_pos.y())),
0, 0); if (ev.type() == Event::TOUCH)
return Event::create_touch_event(ax, ay, ev.code(),
ev.is_touch_release());
return Event(ev.type(), ev.code(), ax, ay, 0, 0);
} }
case Input::Event::INVALID: case Input::Event::INVALID:

View File

@ -75,8 +75,13 @@ void User_state::handle_event(Input::Event ev)
ry = ev.ry(); ry = ev.ry();
} }
/* create the mangled event */ if (type == Event::TOUCH) {
ev = Input::Event(type, keycode, ax, ay, rx, ry); ax = ev.ax();
ay = ev.ay();
ev = Input::Event::create_touch_event(ax, ay, ev.code(),
ev.is_touch_release());
} else
ev = Input::Event(type, keycode, ax, ay, rx, ry);
_pointer_pos = Point(ax, ay); _pointer_pos = Point(ax, ay);
@ -204,7 +209,7 @@ void User_state::handle_event(Input::Event ev)
*/ */
if (kill()) return; if (kill()) return;
if (type == Event::MOTION || type == Event::WHEEL) { if (type == Event::MOTION || type == Event::WHEEL || type == Event::TOUCH) {
if (Mode::has_key_cnt(0)) { if (Mode::has_key_cnt(0)) {