seoul: transform absolute events to relative (PS2)

Fixes #1346
This commit is contained in:
Alexander Boettcher 2014-12-16 08:57:53 +01:00 committed by Christian Helmuth
parent be7d5b4827
commit 91daf433c5
1 changed files with 15 additions and 2 deletions

View File

@ -93,10 +93,23 @@ unsigned Vancouver_console::_input_to_ps2mouse(Input::Event const *ev)
if (ev->code() == Input::BTN_RIGHT) _right = pressed;
}
int rx;
int ry;
if (ev->is_absolute_motion()) {
static Input::Event last_event;
rx = ev->ax() - last_event.ax();
ry = ev->ay() - last_event.ay();
last_event = *ev;
} else {
rx = ev->rx();
ry = ev->ry();
}
/* clamp relative motion vector to bounds */
int const boundary = 200;
int const rx = Genode::min(boundary, Genode::max(-boundary, ev->rx()));
int const ry = -Genode::min(boundary, Genode::max(-boundary, ev->ry()));
rx = Genode::min(boundary, Genode::max(-boundary, rx));
ry = -Genode::min(boundary, Genode::max(-boundary, ry));
/* assemble PS/2 packet */
Ps2_mouse_packet::access_t packet = 0;