base: handle input overflow exception

Fixes #1348
This commit is contained in:
Alexander Boettcher 2015-01-08 20:59:30 +01:00 committed by Christian Helmuth
parent 1a26f33469
commit 0f18ecc142
3 changed files with 17 additions and 23 deletions

View File

@ -65,13 +65,9 @@ static void input_callback(enum input_event_type type,
case EVENT_TYPE_WHEEL: t = Input::Event::WHEEL; break; case EVENT_TYPE_WHEEL: t = Input::Event::WHEEL; break;
} }
try {
input_session().submit(Input::Event(t, code, input_session().submit(Input::Event(t, code,
absolute_x, absolute_y, absolute_x, absolute_y,
relative_x, relative_y)); relative_x, relative_y));
} catch (Input::Event_queue::Overflow) {
PWRN("input ring buffer overflow");
}
} }

View File

@ -501,7 +501,6 @@ class Wm::Nitpicker::Session_component : public Genode::Rpc_object<Session>,
Input::Event const * const events = Input::Event const * const events =
_nitpicker_input_ds.local_addr<Input::Event>(); _nitpicker_input_ds.local_addr<Input::Event>();
try {
while (_nitpicker_input.is_pending()) { while (_nitpicker_input.is_pending()) {
size_t const num_events = _nitpicker_input.flush(); size_t const num_events = _nitpicker_input.flush();
@ -511,13 +510,6 @@ class Wm::Nitpicker::Session_component : public Genode::Rpc_object<Session>,
for (size_t i = 0; i < num_events; i++) for (size_t i = 0; i < num_events; i++)
_input_session.submit(_translate_event(events[i], input_origin)); _input_session.submit(_translate_event(events[i], input_origin));
} }
} catch (Input::Event_queue::Overflow) {
PWRN("client \"%s\" does not respond to user input",
_session_label.string());
_input_session.event_queue().reset();
}
} }
View &_create_view_object(View_handle parent_handle) View &_create_view_object(View_handle parent_handle)

View File

@ -43,10 +43,16 @@ class Input::Session_component : public Genode::Rpc_object<Input::Session>
/** /**
* Submit input event to event queue * Submit input event to event queue
*
* \throw Input::Event_queue::Overflow
*/ */
void submit(Input::Event event) { _event_queue.add(event); } void submit(Input::Event event)
{
try {
_event_queue.add(event);
} catch (Input::Event_queue::Overflow) {
PWRN("input overflow - resetting queue");
_event_queue.reset();
}
}
/****************************** /******************************