gui_session: rename 'view_id' to 'associate'

The view ID is specified as first argument to be consistent with 'view'
and 'child_view'.

Issue #5242
This commit is contained in:
Norman Feske 2024-08-14 14:43:37 +02:00 committed by Christian Helmuth
parent f98c356efd
commit faf90f259c
15 changed files with 51 additions and 51 deletions

View File

@ -130,8 +130,8 @@ struct Gui::Session_component : Rpc_object<Gui::Session>
void destroy_view(View_id view) override {
_gui_session.destroy_view(view); }
View_id_result view_id(View_capability view_cap, View_id id) override {
return _gui_session.view_id(view_cap, id); }
Associate_result associate(View_id id, View_capability view_cap) override {
return _gui_session.associate(id, view_cap); }
View_capability view_capability(View_id view) override {
return _gui_session.view_capability(view); }

View File

@ -191,7 +191,7 @@ class Decorator::Window : public Window_base, public Animator::Item
Gui_view(gui), _remote_gui(remote_gui)
{
remote_gui.view(id(), { });
gui.view_id(remote_gui.view_capability(id()), id());
gui.associate(id(), remote_gui.view_capability(id()));
}
~Remote_view()

View File

@ -135,8 +135,8 @@ struct Sandboxed_runtime::Gui_session : Session_object<Gui::Session>
void destroy_view(View_id view) override {
_gui_session.destroy_view(view); }
View_id_result view_id(View_capability view_cap, View_id id) override {
return _gui_session.view_id(view_cap, id); }
Associate_result associate(View_id id, View_capability view_cap) override {
return _gui_session.associate(id, view_cap); }
View_capability view_capability(View_id view) override {
return _gui_session.view_capability(view); }

View File

@ -366,10 +366,10 @@ class Gui_fader::Gui_session_component
return _gui.destroy_view(id);
}
View_id_result view_id(View_capability view_cap, View_id id) override
Associate_result associate(View_id id, View_capability view_cap) override
{
_gui.view_id(view_cap, id);
return View_id_result::OK;
_gui.associate(id, view_cap);
return Associate_result::OK;
}
View_capability view_capability(View_id id) override

View File

@ -250,15 +250,15 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
Content_view_ref(Window_registry::Id(win_id), _content_view_ids, id);
View_capability view_cap = _content_callback.content_view(win_id);
View_id_result result = _gui.session.view_id(view_cap, id);
if (result != View_id_result::OK)
Associate_result result = _gui.session.associate(id, view_cap);
if (result != Associate_result::OK)
destroy(_heap, &view_ref_ptr);
switch (result) {
case View_id_result::OUT_OF_RAM: return View_result::OUT_OF_RAM;
case View_id_result::OUT_OF_CAPS: return View_result::OUT_OF_CAPS;
case View_id_result::OK: return View_result::OK;
case View_id_result::INVALID: break; /* fall back to regular view */
case Associate_result::OUT_OF_RAM: return View_result::OUT_OF_RAM;
case Associate_result::OUT_OF_CAPS: return View_result::OUT_OF_CAPS;
case Associate_result::OK: return View_result::OK;
case Associate_result::INVALID: break; /* fall back to regular view */
};
}
catch (Genode::Out_of_ram) { return View_result::OUT_OF_RAM; }
@ -293,9 +293,9 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
_gui.session.destroy_view(view);
}
View_id_result view_id(View_capability view_cap, View_id id) override
Associate_result associate(View_id id, View_capability view_cap) override
{
return _gui.session.view_id(view_cap, id);
return _gui.session.associate(id, view_cap);
}
View_capability view_capability(View_id view) override

View File

@ -83,9 +83,9 @@ class Wm::Direct_gui_session : public Genode::Rpc_object<Gui::Session>
_session.destroy_view(view);
}
View_id_result view_id(View_capability view_cap, View_id id) override
Associate_result associate(View_id id, View_capability view_cap) override
{
return _session.view_id(view_cap, id);
return _session.associate(id, view_cap);
}
View_capability view_capability(View_id view) override

View File

@ -127,13 +127,13 @@ class Wm::Gui::View : private Genode::Weak_object<View>,
Gui::View_ref ref { };
Gui::View_ids::Element tmp { ref, _real_gui.view_ids };
switch (_real_gui.session.view_id(cap, tmp.id())) {
case Gui::Session::View_id_result::OUT_OF_RAM:
case Gui::Session::View_id_result::OUT_OF_CAPS:
case Gui::Session::View_id_result::INVALID:
switch (_real_gui.session.associate(tmp.id(), cap)) {
case Gui::Session::Associate_result::OUT_OF_RAM:
case Gui::Session::Associate_result::OUT_OF_CAPS:
case Gui::Session::Associate_result::INVALID:
warning("unable to obtain view ID for given view capability");
return;
case Gui::Session::View_id_result::OK:
case Gui::Session::Associate_result::OK:
break;
}
fn(tmp.id());
@ -1050,21 +1050,21 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
release_view_id(id);
}
View_id_result view_id(View_capability view_cap, View_id id) override
Associate_result associate(View_id id, View_capability view_cap) override
{
/* prevent ID conflict in 'View_ids::Element' constructor */
release_view_id(id);
return _env.ep().rpc_ep().apply(view_cap,
[&] (View *view_ptr) -> View_id_result {
[&] (View *view_ptr) -> Associate_result {
if (!view_ptr)
return View_id_result::INVALID;
return Associate_result::INVALID;
try {
new (_view_ref_alloc) View_ref(view_ptr->weak_ptr(), _view_ids, id);
return View_id_result::OK;
return Associate_result::OK;
}
catch (Out_of_ram) { return View_id_result::OUT_OF_RAM; }
catch (Out_of_caps) { return View_id_result::OUT_OF_CAPS; }
catch (Out_of_ram) { return Associate_result::OUT_OF_RAM; }
catch (Out_of_caps) { return Associate_result::OUT_OF_CAPS; }
});
}

View File

@ -74,9 +74,9 @@ struct Wm::Layouter_gui_session : Genode::Rpc_object<Gui::Session>
void destroy_view(View_id) override { }
View_id_result view_id(View_capability, View_id) override
Associate_result associate(View_id, View_capability) override
{
return View_id_result::OK;
return Associate_result::OK;
}
View_capability view_capability(View_id) override

View File

@ -224,7 +224,7 @@ void QGenodeViewWidget::paintEvent(QPaintEvent *event)
Gui::View_ref tmp_view_ref { };
Gui::View_ids::Element neighbor_id { tmp_view_ref, gui->view_ids };
gui->view_id(platform_window->view_cap(), neighbor_id.id());
gui->associate(neighbor_id.id(), platform_window->view_cap());
gui->enqueue<Command::Front_of>(view_id, neighbor_id.id());
gui->execute();

View File

@ -39,8 +39,8 @@ struct Gui::Session_client : Rpc_client<Session>
void destroy_view(View_id view) override {
call<Rpc_destroy_view>(view); }
View_id_result view_id(View_capability view, View_id id) override {
return call<Rpc_view_id>(view, id); }
Associate_result associate(View_id id, View_capability view) override {
return call<Rpc_associate>(id, view); }
View_capability view_capability(View_id id) override {
return call<Rpc_view_capability>(id); }

View File

@ -113,11 +113,11 @@ class Gui::Connection : private Genode::Connection<Session>
return _client.view_capability(id);
}
void view_id(View_capability view, View_id id)
void associate(View_id id, View_capability view)
{
using Result = Session::View_id_result;
using Result = Session::Associate_result;
for (;;) {
switch (_client.view_id(view, id)) {
switch (_client.associate(id, view)) {
case Result::OUT_OF_RAM: upgrade_ram(8*1024); break;
case Result::OUT_OF_CAPS: upgrade_caps(2); break;
case Result::OK: return;

View File

@ -200,12 +200,12 @@ struct Gui::Session : Genode::Session
*/
virtual void destroy_view(View_id) = 0;
enum class View_id_result { OK, OUT_OF_RAM, OUT_OF_CAPS, INVALID };
enum class Associate_result { OK, OUT_OF_RAM, OUT_OF_CAPS, INVALID };
/**
* Associate view with the specified ID
* Associate existing view with the specified ID
*/
virtual View_id_result view_id(View_capability, View_id) = 0;
virtual Associate_result associate(View_id, View_capability) = 0;
/**
* Request view capability for a given ID
@ -284,7 +284,7 @@ struct Gui::Session : Genode::Session
GENODE_RPC(Rpc_view, View_result, view, View_id, View_attr const &);
GENODE_RPC(Rpc_child_view, Child_view_result, child_view, View_id, View_id, View_attr const &);
GENODE_RPC(Rpc_destroy_view, void, destroy_view, View_id);
GENODE_RPC(Rpc_view_id, View_id_result, view_id, View_capability, View_id);
GENODE_RPC(Rpc_associate, Associate_result, associate, View_id, View_capability);
GENODE_RPC(Rpc_view_capability, View_capability, view_capability, View_id);
GENODE_RPC(Rpc_release_view_id, void, release_view_id, View_id);
GENODE_RPC(Rpc_command_dataspace, Dataspace_capability, command_dataspace);
@ -296,7 +296,7 @@ struct Gui::Session : Genode::Session
GENODE_RPC(Rpc_buffer, Buffer_result, buffer, Framebuffer::Mode, bool);
GENODE_RPC_INTERFACE(Rpc_framebuffer, Rpc_input,
Rpc_view, Rpc_child_view, Rpc_destroy_view, Rpc_view_id,
Rpc_view, Rpc_child_view, Rpc_destroy_view, Rpc_associate,
Rpc_view_capability, Rpc_release_view_id,
Rpc_command_dataspace, Rpc_execute, Rpc_mode,
Rpc_mode_sigh, Rpc_buffer, Rpc_focus);

View File

@ -319,22 +319,22 @@ void Gui_session::destroy_view(View_id const id)
}
Gui_session::View_id_result
Gui_session::view_id(View_capability view_cap, View_id id)
Gui_session::Associate_result
Gui_session::associate(View_id id, View_capability view_cap)
{
/* prevent ID conflict in 'View_ids::Element' constructor */
release_view_id(id);
return _env.ep().rpc_ep().apply(view_cap,
[&] (View *view_ptr) -> View_id_result {
[&] (View *view_ptr) -> Associate_result {
if (!view_ptr)
return View_id_result::INVALID;
return Associate_result::INVALID;
try {
new (_view_ref_alloc) View_ref(view_ptr->weak_ptr(), _view_ids, id);
return View_id_result::OK;
return Associate_result::OK;
}
catch (Out_of_ram) { return View_id_result::OUT_OF_RAM; }
catch (Out_of_caps) { return View_id_result::OUT_OF_CAPS; }
catch (Out_of_ram) { return Associate_result::OUT_OF_RAM; }
catch (Out_of_caps) { return Associate_result::OUT_OF_CAPS; }
});
}

View File

@ -390,7 +390,7 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
void destroy_view(View_id) override;
View_id_result view_id(View_capability, View_id) override;
Associate_result associate(View_id, View_capability) override;
View_capability view_capability(View_id) override;

View File

@ -102,7 +102,7 @@ struct Test::Child_view : View
View(gui, id, attr), _parent(parent)
{
Gui::View_id const parent_id { 0 }; /* temporary */
gui.view_id(parent.view_cap(), parent_id);
gui.associate(parent_id, parent.view_cap());
gui.child_view(id, parent_id, attr);
gui.release_view_id(parent_id);
}