loader: allow to set the parent of the subsystem's view

This commit adds a 'parent_view()' function to the loader session, which
allows to set the parent view of the subsystem's Nitpicker view.

If the function is to be used, this must get done before calling
'start()'.

Fixes #1172.
This commit is contained in:
Christian Prochaska 2014-06-04 21:01:18 +02:00 committed by Norman Feske
parent 5ea772d284
commit 64863a4b33
4 changed files with 48 additions and 7 deletions

View File

@ -38,6 +38,9 @@ namespace Loader {
void constrain_geometry(int width, int height) {
call<Rpc_constrain_geometry>(width, height); }
void parent_view(Nitpicker::View_capability view) {
call<Rpc_parent_view>(view); }
void view_ready_sigh(Signal_context_capability sigh) {
call<Rpc_view_ready_sigh>(sigh); }

View File

@ -111,6 +111,14 @@ namespace Loader {
*/
virtual void constrain_geometry(int width, int height) = 0;
/**
* Set the parent view of the subsystem's view.
*
* If 'parent_view' is not called prior calling 'start', the
* subsystem's view will not have a parent view.
*/
virtual void parent_view(Nitpicker::View_capability view) = 0;
/**
* Register signal handler notified at creation time of the first view
*/
@ -165,6 +173,7 @@ namespace Loader {
Name const &);
GENODE_RPC(Rpc_ram_quota, void, ram_quota, size_t);
GENODE_RPC(Rpc_constrain_geometry, void, constrain_geometry, int, int);
GENODE_RPC(Rpc_parent_view, void, parent_view, Nitpicker::View_capability);
GENODE_RPC(Rpc_view_ready_sigh, void, view_ready_sigh, Signal_context_capability);
GENODE_RPC(Rpc_fault_sigh, void, fault_sigh, Signal_context_capability);
GENODE_RPC_THROW(Rpc_start, void, start,
@ -174,10 +183,26 @@ namespace Loader {
GENODE_TYPE_LIST(View_does_not_exist));
GENODE_RPC(Rpc_view_geometry, View_geometry, view_geometry);
GENODE_RPC_INTERFACE(Rpc_alloc_rom_module, Rpc_commit_rom_module,
Rpc_ram_quota, Rpc_constrain_geometry,
Rpc_view_ready_sigh, Rpc_fault_sigh, Rpc_start,
Rpc_view, Rpc_view_geometry);
/*
* 'GENODE_RPC_INTERFACE' declaration done manually
*
* The number of RPC function of this interface exceeds the maximum
* number of elements supported by 'Meta::Type_list'. Therefore, we
* construct the type list by hand using nested type tuples instead
* of employing the convenience macro 'GENODE_RPC_INTERFACE'.
*/
typedef Meta::Type_tuple<Rpc_alloc_rom_module,
Meta::Type_tuple<Rpc_commit_rom_module,
Meta::Type_tuple<Rpc_ram_quota,
Meta::Type_tuple<Rpc_constrain_geometry,
Meta::Type_tuple<Rpc_parent_view,
Meta::Type_tuple<Rpc_view_ready_sigh,
Meta::Type_tuple<Rpc_fault_sigh,
Meta::Type_tuple<Rpc_start,
Meta::Type_tuple<Rpc_view,
Meta::Type_tuple<Rpc_view_geometry,
Meta::Empty>
> > > > > > > > > Rpc_functions;
};
}

View File

@ -176,8 +176,9 @@ namespace Loader {
Rpc_entrypoint &ep;
Allocator &_md_alloc;
int _max_width;
int _max_height;
int _max_width;
int _max_height;
Nitpicker::View_capability _parent_view;
Signal_context_capability view_ready_sigh;
@ -208,6 +209,11 @@ namespace Loader {
_max_width = width, _max_height = height;
}
void parent_view(Nitpicker::View_capability view)
{
_parent_view = view;
}
Genode::Session_capability session(char const *args,
Affinity const &)
{
@ -218,6 +224,7 @@ namespace Loader {
Nitpicker::Session_component(ep,
_max_width,
_max_height,
_parent_view,
view_ready_sigh,
args);
@ -315,6 +322,11 @@ namespace Loader {
_nitpicker_service.constrain_geometry(width, height);
}
void parent_view(Nitpicker::View_capability view)
{
_nitpicker_service.parent_view(view);
}
void view_ready_sigh(Signal_context_capability sigh)
{
_nitpicker_service.view_ready_sigh = sigh;

View File

@ -187,6 +187,7 @@ namespace Nitpicker {
Session_component(Rpc_entrypoint &ep,
int max_width,
int max_height,
Nitpicker::View_capability parent_view,
Signal_context_capability view_ready_sigh,
const char *args)
:
@ -196,7 +197,7 @@ namespace Nitpicker {
_max_height(max_height),
/* create Nitpicker view */
_nitpicker_view(_nitpicker.create_view()),
_nitpicker_view(_nitpicker.create_view(parent_view)),
/* create proxy view component for the child */
_proxy_view(_nitpicker_view, view_ready_sigh),