diff --git a/repos/gems/src/server/wm/decorator_gui.h b/repos/gems/src/server/wm/decorator_gui.h index 394b289392..6941181810 100644 --- a/repos/gems/src/server/wm/decorator_gui.h +++ b/repos/gems/src/server/wm/decorator_gui.h @@ -58,7 +58,7 @@ struct Wm::Decorator_content_callback : Interface }; -struct Wm::Decorator_gui_session : Genode::Rpc_object, +struct Wm::Decorator_gui_session : Genode::Session_object, private List::Element { friend class List; @@ -119,18 +119,17 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object, return { value }; } - /** - * Constructor - * - * \param ep entrypoint used for dispatching signals - */ - Decorator_gui_session(Genode::Env &env, - Genode::Ram_allocator &ram, - Allocator &md_alloc, - Pointer::Tracker &pointer_tracker, - Input::Session_component &window_layouter_input, + Decorator_gui_session(Genode::Env &env, + Genode::Ram_allocator &ram, + Resources const &resources, + Label const &label, + Diag const &diag, + Allocator &md_alloc, + Pointer::Tracker &pointer_tracker, + Input::Session_component &window_layouter_input, Decorator_content_callback &content_callback) : + Session_object(env.ep(), resources, label, diag), _env(env), _ram(ram), _pointer_state(pointer_tracker), diff --git a/repos/gems/src/server/wm/direct_gui.h b/repos/gems/src/server/wm/direct_gui.h index d1080a126b..4a41519672 100644 --- a/repos/gems/src/server/wm/direct_gui.h +++ b/repos/gems/src/server/wm/direct_gui.h @@ -21,14 +21,12 @@ namespace Wm { class Direct_gui_session; } -class Wm::Direct_gui_session : public Genode::Rpc_object +class Wm::Direct_gui_session : public Genode::Session_object { private: Genode::Env &_env; - Genode::Session_label _label; - Genode::Connection _connection { _env, _label, Genode::Ram_quota { 36*1024 }, /* Args */ { } }; @@ -39,12 +37,10 @@ class Wm::Direct_gui_session : public Genode::Rpc_object public: - /** - * Constructor - */ - Direct_gui_session(Genode::Env &env, Genode::Session_label const &label) + Direct_gui_session(Genode::Env &env, auto &&... args) : - _env(env), _label(label) + Session_object(env.ep(), args...), + _env(env) { } void upgrade(char const *args) diff --git a/repos/gems/src/server/wm/gui.h b/repos/gems/src/server/wm/gui.h index cd7f101b36..a6055e05d3 100644 --- a/repos/gems/src/server/wm/gui.h +++ b/repos/gems/src/server/wm/gui.h @@ -17,6 +17,7 @@ /* Genode includes */ #include #include +#include #include #include #include @@ -471,7 +472,7 @@ class Wm::Gui::Child_view : public View, private List::Element }; -class Wm::Gui::Session_component : public Rpc_object, +class Wm::Gui::Session_component : public Session_object, private List::Element, private Input_origin_changed_handler { @@ -512,9 +513,8 @@ class Wm::Gui::Session_component : public Rpc_object, Genode::Env &_env; - Session_label _session_label; Genode::Ram_allocator &_ram; - Real_gui _real_gui { _env, _session_label }; + Real_gui _real_gui { _env, _label }; Window_registry &_window_registry; Tslab _top_level_view_alloc; Tslab _child_view_alloc; @@ -782,21 +782,18 @@ class Wm::Gui::Session_component : public Rpc_object, public: - /** - * Constructor - * - * \param ep entrypoint used for managing the views - */ - Session_component(Genode::Env &env, + Session_component(Genode::Env &env, Genode::Ram_allocator &ram, + Resources const &resources, + Label const &label, + Diag const diag, Window_registry &window_registry, Allocator &session_alloc, - Session_label const &session_label, Pointer::Tracker &pointer_tracker, Click_handler &click_handler) : + Session_object(env.ep(), resources, label, diag), _env(env), - _session_label(session_label), _ram(ram), _window_registry(window_registry), _top_level_view_alloc(&session_alloc), @@ -881,8 +878,6 @@ class Wm::Gui::Session_component : public Rpc_object, return false; } - Session_label session_label() const { return _session_label; } - bool matches_session_label(char const *selector) const { using namespace Genode; @@ -893,7 +888,7 @@ class Wm::Gui::Session_component : public Rpc_object, * * The code snippet originates from nitpicker's 'gui_session.h'. */ - String const label(_session_label, " ->"); + String const label(_label, " ->"); return strcmp(label.string(), selector, strlen(selector)) == 0; } @@ -1273,8 +1268,9 @@ class Wm::Gui::Root : public Genode::Rpc_object Genode::Session_capability session(Session_args const &args, Affinity const &) override { - Genode::Session_label const session_label = - Genode::label_from_args(args.string()); + Genode::Session::Label const label = Genode::label_from_args(args.string()); + Genode::Session::Resources const resources = Genode::session_resources_from_args(args.string()); + Genode::Session::Diag const diag = Genode::session_diag_from_args(args.string()); enum Role { ROLE_DECORATOR, ROLE_LAYOUTER, ROLE_REGULAR, ROLE_DIRECT }; Role role = ROLE_REGULAR; @@ -1284,7 +1280,7 @@ class Wm::Gui::Root : public Genode::Rpc_object */ try { Genode::Xml_node policy = - Genode::Session_policy(session_label, _config.xml()); + Genode::Session_policy(label, _config.xml()); auto const value = policy.attribute_value("role", String<16>()); @@ -1298,40 +1294,42 @@ class Wm::Gui::Root : public Genode::Rpc_object case ROLE_REGULAR: { - auto session = new (_md_alloc) - Session_component(_env, _ram, _window_registry, - _md_alloc, session_label, + Session_component &session = *new (_md_alloc) + Session_component(_env, _ram, resources, label, diag, + _window_registry, _md_alloc, _pointer_tracker, _click_handler); - _sessions.insert(session); - return _env.ep().manage(*session); + _sessions.insert(&session); + return session.cap(); } case ROLE_DECORATOR: { - auto session = new (_md_alloc) - Decorator_gui_session(_env, _ram, _md_alloc, + Decorator_gui_session &session = *new (_md_alloc) + Decorator_gui_session(_env, _ram, resources, label, diag, + _md_alloc, _pointer_tracker, _window_layouter_input, *this); - _decorator_sessions.insert(session); - return _env.ep().manage(*session); + _decorator_sessions.insert(&session); + return session.cap(); } case ROLE_LAYOUTER: { _layouter_session = new (_md_alloc) - Layouter_gui_session(_env, _window_layouter_input_cap); + Layouter_gui_session(_env, resources, label, diag, + _window_layouter_input_cap); - return _env.ep().manage(*_layouter_session); + return _layouter_session->cap(); } case ROLE_DIRECT: { - Direct_gui_session *session = new (_md_alloc) - Direct_gui_session(_env, session_label); + Direct_gui_session &session = *new (_md_alloc) + Direct_gui_session(_env, resources, label, diag); - return _env.ep().manage(*session); + return session.cap(); } } @@ -1375,10 +1373,8 @@ class Wm::Gui::Root : public Genode::Rpc_object Session_component *regular_session = ep.apply(session_cap, [this] (Session_component *session) { - if (session) { + if (session) _sessions.remove(session); - _env.ep().dissolve(*session); - } return session; }); if (regular_session) { @@ -1388,9 +1384,6 @@ class Wm::Gui::Root : public Genode::Rpc_object Direct_gui_session *direct_session = ep.apply(session_cap, [this] (Direct_gui_session *session) { - if (session) { - _env.ep().dissolve(*session); - } return session; }); if (direct_session) { @@ -1400,10 +1393,8 @@ class Wm::Gui::Root : public Genode::Rpc_object Decorator_gui_session *decorator_session = ep.apply(session_cap, [this] (Decorator_gui_session *session) { - if (session) { + if (session) _decorator_sessions.remove(session); - _env.ep().dissolve(*session); - } return session; }); if (decorator_session) { @@ -1412,7 +1403,6 @@ class Wm::Gui::Root : public Genode::Rpc_object } auto layouter_lambda = [this] (Layouter_gui_session *session) { - this->_env.ep().dissolve(*_layouter_session); _layouter_session = nullptr; return session; }; diff --git a/repos/gems/src/server/wm/layouter_gui.h b/repos/gems/src/server/wm/layouter_gui.h index 4878a56a23..e09cfb2160 100644 --- a/repos/gems/src/server/wm/layouter_gui.h +++ b/repos/gems/src/server/wm/layouter_gui.h @@ -24,7 +24,7 @@ namespace Wm { } -struct Wm::Layouter_gui_session : Genode::Rpc_object +struct Wm::Layouter_gui_session : Genode::Session_object { using View_capability = Gui::View_capability; using View_id = Gui::View_id; @@ -40,9 +40,13 @@ struct Wm::Layouter_gui_session : Genode::Rpc_object Attached_ram_dataspace _command_ds; - Layouter_gui_session(Genode::Env &env, + Layouter_gui_session(Genode::Env &env, + Resources const &resources, + Label const &label, + Diag const &diag, Input::Session_capability input_session_cap) : + Session_object(env.ep(), resources, label, diag), _input_session_cap(input_session_cap), _mode_sigh_gui(env), _command_ds(env.ram(), env.rm(), 4096) { }