seoul: PS2 mouse wheel support

fixes #3234
This commit is contained in:
Sebastian Sumpf 2019-03-18 14:58:05 +01:00 committed by Norman Feske
parent 9f50b8897a
commit 1705aab290
4 changed files with 16 additions and 4 deletions

View File

@ -1 +1 @@
a0d13a5e10a8d7ac752de722e156695982d8d07d
4f2b4e390088d7ad3ba10767feaaaa4c7a06a407

View File

@ -2,9 +2,9 @@ LICENSE := GPLv2
VERSION := git
DOWNLOADS := seoul.git
URL(seoul) := https://github.com/ehmry/seoul.git
URL(seoul) := https://github.com/alex-ab/seoul.git
# branch PARAM
REV(seoul) := f9b1d0a699971cf55d9e974a3caf77ef86cd6c0b
REV(seoul) := ca77327faaed6f15c8660f24dd9f7b805dae107e
DIR(seoul) := src/app/seoul
#

View File

@ -80,6 +80,7 @@ static bool mouse_event(Input::Event const &ev)
result |= mouse_button(key); });
result |= ev.absolute_motion() || ev.relative_motion();
result |= ev.wheel();
return result;
}
@ -113,6 +114,7 @@ unsigned Seoul::Console::_input_to_ps2mouse(Input::Event const &ev)
ev.handle_relative_motion([&] (int x, int y) { rx = x; ry = y; });
/* clamp relative motion vector to bounds */
int const boundary = 200;
rx = Genode::min(boundary, Genode::max(-boundary, rx));
@ -133,6 +135,15 @@ unsigned Seoul::Console::_input_to_ps2mouse(Input::Event const &ev)
}
unsigned Seoul::Console::_input_to_ps2wheel(Input::Event const &ev)
{
int rz = 0;
ev.handle_wheel([&](int x, int y) { rz = y; });
return (unsigned)rz;
}
/* bus callbacks */
bool Seoul::Console::receive(MessageConsole &msg)
@ -316,7 +327,7 @@ void Seoul::Console::_handle_input()
/* update mouse model (PS2) */
if (mouse_event(ev)) {
MessageInput msg(0x10001, _input_to_ps2mouse(ev));
MessageInput msg(0x10001, _input_to_ps2mouse(ev), _input_to_ps2wheel(ev));
_motherboard()->bus_input.send(msg);
}

View File

@ -66,6 +66,7 @@ class Seoul::Console : public StaticReceiver<Seoul::Console>
unsigned _timer { 0 };
unsigned _input_to_ps2mouse(Input::Event const &);
unsigned _input_to_ps2wheel(Input::Event const &);
Genode::Signal_handler<Console> _signal_input
= { _env.ep(), *this, &Console::_handle_input };