From faf90f259c653dc011fd98e5127902944fc7bff2 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 14 Aug 2024 14:43:37 +0200 Subject: [PATCH] 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 --- repos/gems/src/app/sculpt_manager/gui.cc | 4 ++-- repos/gems/src/app/themed_decorator/window.h | 2 +- .../gems/src/lib/dialog/sandboxed_runtime.cc | 4 ++-- repos/gems/src/server/gui_fader/main.cc | 6 ++--- repos/gems/src/server/wm/decorator_gui.h | 16 +++++++------- repos/gems/src/server/wm/direct_gui.h | 4 ++-- repos/gems/src/server/wm/gui.h | 22 +++++++++---------- repos/gems/src/server/wm/layouter_gui.h | 4 ++-- .../qgenodeviewwidget/qgenodeviewwidget.cpp | 2 +- repos/os/include/gui_session/client.h | 4 ++-- repos/os/include/gui_session/connection.h | 6 ++--- repos/os/include/gui_session/gui_session.h | 10 ++++----- repos/os/src/server/nitpicker/gui_session.cc | 14 ++++++------ repos/os/src/server/nitpicker/gui_session.h | 2 +- repos/os/src/test/nitpicker/main.cc | 2 +- 15 files changed, 51 insertions(+), 51 deletions(-) diff --git a/repos/gems/src/app/sculpt_manager/gui.cc b/repos/gems/src/app/sculpt_manager/gui.cc index 0de28cf592..1372fdd33b 100644 --- a/repos/gems/src/app/sculpt_manager/gui.cc +++ b/repos/gems/src/app/sculpt_manager/gui.cc @@ -130,8 +130,8 @@ struct Gui::Session_component : Rpc_object 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); } diff --git a/repos/gems/src/app/themed_decorator/window.h b/repos/gems/src/app/themed_decorator/window.h index 902b6c8524..3c35413546 100644 --- a/repos/gems/src/app/themed_decorator/window.h +++ b/repos/gems/src/app/themed_decorator/window.h @@ -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() diff --git a/repos/gems/src/lib/dialog/sandboxed_runtime.cc b/repos/gems/src/lib/dialog/sandboxed_runtime.cc index 46089510c0..46d222dc97 100644 --- a/repos/gems/src/lib/dialog/sandboxed_runtime.cc +++ b/repos/gems/src/lib/dialog/sandboxed_runtime.cc @@ -135,8 +135,8 @@ struct Sandboxed_runtime::Gui_session : Session_object 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); } diff --git a/repos/gems/src/server/gui_fader/main.cc b/repos/gems/src/server/gui_fader/main.cc index 62ff1bd123..5edcac3d81 100644 --- a/repos/gems/src/server/gui_fader/main.cc +++ b/repos/gems/src/server/gui_fader/main.cc @@ -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 diff --git a/repos/gems/src/server/wm/decorator_gui.h b/repos/gems/src/server/wm/decorator_gui.h index 39982fbb47..097f4341bb 100644 --- a/repos/gems/src/server/wm/decorator_gui.h +++ b/repos/gems/src/server/wm/decorator_gui.h @@ -250,15 +250,15 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object, 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.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 diff --git a/repos/gems/src/server/wm/direct_gui.h b/repos/gems/src/server/wm/direct_gui.h index e79a7c1b10..d55a33c411 100644 --- a/repos/gems/src/server/wm/direct_gui.h +++ b/repos/gems/src/server/wm/direct_gui.h @@ -83,9 +83,9 @@ class Wm::Direct_gui_session : public Genode::Rpc_object _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 diff --git a/repos/gems/src/server/wm/gui.h b/repos/gems/src/server/wm/gui.h index 0babf8ffc5..dd05381914 100644 --- a/repos/gems/src/server/wm/gui.h +++ b/repos/gems/src/server/wm/gui.h @@ -127,13 +127,13 @@ class Wm::Gui::View : private Genode::Weak_object, 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, 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; } }); } diff --git a/repos/gems/src/server/wm/layouter_gui.h b/repos/gems/src/server/wm/layouter_gui.h index 833de80511..d89ada1000 100644 --- a/repos/gems/src/server/wm/layouter_gui.h +++ b/repos/gems/src/server/wm/layouter_gui.h @@ -74,9 +74,9 @@ struct Wm::Layouter_gui_session : Genode::Rpc_object 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 diff --git a/repos/libports/src/lib/qgenodeviewwidget/qgenodeviewwidget.cpp b/repos/libports/src/lib/qgenodeviewwidget/qgenodeviewwidget.cpp index a60ccc03a3..691665f399 100644 --- a/repos/libports/src/lib/qgenodeviewwidget/qgenodeviewwidget.cpp +++ b/repos/libports/src/lib/qgenodeviewwidget/qgenodeviewwidget.cpp @@ -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(view_id, neighbor_id.id()); gui->execute(); diff --git a/repos/os/include/gui_session/client.h b/repos/os/include/gui_session/client.h index a28776f9fc..ec8abd9495 100644 --- a/repos/os/include/gui_session/client.h +++ b/repos/os/include/gui_session/client.h @@ -39,8 +39,8 @@ struct Gui::Session_client : Rpc_client void destroy_view(View_id view) override { call(view); } - View_id_result view_id(View_capability view, View_id id) override { - return call(view, id); } + Associate_result associate(View_id id, View_capability view) override { + return call(id, view); } View_capability view_capability(View_id id) override { return call(id); } diff --git a/repos/os/include/gui_session/connection.h b/repos/os/include/gui_session/connection.h index 07d1710fca..bcaf749c82 100644 --- a/repos/os/include/gui_session/connection.h +++ b/repos/os/include/gui_session/connection.h @@ -113,11 +113,11 @@ class Gui::Connection : private Genode::Connection 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; diff --git a/repos/os/include/gui_session/gui_session.h b/repos/os/include/gui_session/gui_session.h index e631beef44..90bd45920d 100644 --- a/repos/os/include/gui_session/gui_session.h +++ b/repos/os/include/gui_session/gui_session.h @@ -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); diff --git a/repos/os/src/server/nitpicker/gui_session.cc b/repos/os/src/server/nitpicker/gui_session.cc index 38b9ec8ecb..08825e82f9 100644 --- a/repos/os/src/server/nitpicker/gui_session.cc +++ b/repos/os/src/server/nitpicker/gui_session.cc @@ -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; } }); } diff --git a/repos/os/src/server/nitpicker/gui_session.h b/repos/os/src/server/nitpicker/gui_session.h index 0129a2b05b..8315166a4f 100644 --- a/repos/os/src/server/nitpicker/gui_session.h +++ b/repos/os/src/server/nitpicker/gui_session.h @@ -390,7 +390,7 @@ class Nitpicker::Gui_session : public Session_object, 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; diff --git a/repos/os/src/test/nitpicker/main.cc b/repos/os/src/test/nitpicker/main.cc index b64911fb54..49156c8234 100644 --- a/repos/os/src/test/nitpicker/main.cc +++ b/repos/os/src/test/nitpicker/main.cc @@ -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); }