Use signals for delivering input events
This patch changes both the Input::Session interface and the skeleton
for the server-side implementation of this interface
('input/component.h').
The Input::Session interface offers a new 'sigh' function, which can be
called be the client to register a signal handler. The signal handler
gets notified on the arrival of new input. This alleviates the need to
poll for input events at the client side.
The server-side skeleton for implementing input services underwent a
redesign to make it more modular and robust. I.e., there are no
global functions needed at the server side and the event-queue
enable/disable mechanism is implemented at a central place (in the root
component) rather than inside each driver.
Fixes #46
This commit is contained in:
committed by
Christian Helmuth
parent
6c10bfe049
commit
0ed68a56b7
@@ -110,6 +110,14 @@ namespace Input {
|
||||
* Flush input events
|
||||
*/
|
||||
Genode::size_t flush() { return _client.flush(); }
|
||||
|
||||
/**
|
||||
* Register signal handler for input notifications
|
||||
*/
|
||||
void sigh(Genode::Signal_context_capability sigh)
|
||||
{
|
||||
_client.sigh(sigh);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -183,6 +191,12 @@ namespace Input {
|
||||
}
|
||||
return dst_count;
|
||||
}
|
||||
|
||||
void sigh(Genode::Signal_context_capability sigh)
|
||||
{
|
||||
for (Source *e = _sources.first(); e; e = e->next())
|
||||
e->sigh(sigh);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -214,18 +228,23 @@ namespace Input {
|
||||
** Input-session interface **
|
||||
*****************************/
|
||||
|
||||
Genode::Dataspace_capability dataspace() { return _ev_ds.cap(); }
|
||||
Genode::Dataspace_capability dataspace() override { return _ev_ds.cap(); }
|
||||
|
||||
bool is_pending() const
|
||||
bool is_pending() const override
|
||||
{
|
||||
return _source_registry.any_source_has_pending_input();
|
||||
}
|
||||
|
||||
int flush()
|
||||
int flush() override
|
||||
{
|
||||
return _source_registry.flush_sources(_ev_ds.local_addr<Event>(),
|
||||
MAX_EVENTS);
|
||||
}
|
||||
|
||||
void sigh(Genode::Signal_context_capability sigh) override
|
||||
{
|
||||
_source_registry.sigh(sigh);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user