diff --git a/repos/os/include/nitpicker_session/client.h b/repos/os/include/nitpicker_session/client.h index c5f3032fd3..f569be68a2 100644 --- a/repos/os/include/nitpicker_session/client.h +++ b/repos/os/include/nitpicker_session/client.h @@ -74,6 +74,9 @@ class Nitpicker::Session_client : public Genode::Rpc_client Framebuffer::Mode mode() override { return call(); } + void mode_sigh(Genode::Signal_context_capability sigh) override { + call(sigh); } + void buffer(Framebuffer::Mode mode, bool alpha) override { call(mode, alpha); } diff --git a/repos/os/include/nitpicker_session/nitpicker_session.h b/repos/os/include/nitpicker_session/nitpicker_session.h index 6c8616fc0d..23f99f9c69 100644 --- a/repos/os/include/nitpicker_session/nitpicker_session.h +++ b/repos/os/include/nitpicker_session/nitpicker_session.h @@ -252,6 +252,11 @@ struct Nitpicker::Session : Genode::Session */ virtual Framebuffer::Mode mode() = 0; + /** + * Register signal handler to be notified about mode changes + */ + virtual void mode_sigh(Genode::Signal_context_capability) = 0; + /** * Define dimensions of virtual framebuffer * @@ -304,6 +309,7 @@ struct Nitpicker::Session : Genode::Session GENODE_RPC(Rpc_execute, void, execute); GENODE_RPC(Rpc_background, int, background, View_capability); GENODE_RPC(Rpc_mode, Framebuffer::Mode, mode); + GENODE_RPC(Rpc_mode_sigh, void, mode_sigh, Genode::Signal_context_capability); GENODE_RPC(Rpc_focus, void, focus, Genode::Capability); GENODE_RPC_THROW(Rpc_buffer, void, buffer, GENODE_TYPE_LIST(Out_of_metadata), Framebuffer::Mode, bool); @@ -323,10 +329,11 @@ struct Nitpicker::Session : Genode::Session Type_tuple - > > > > > > > > > > > Rpc_functions; + > > > > > > > > > > > > Rpc_functions; }; #endif /* _INCLUDE__NITPICKER_SESSION__NITPICKER_SESSION_H_ */ diff --git a/repos/os/src/server/nitpicker/main.cc b/repos/os/src/server/nitpicker/main.cc index 6e83cf9998..2f0fd9aaec 100644 --- a/repos/os/src/server/nitpicker/main.cc +++ b/repos/os/src/server/nitpicker/main.cc @@ -420,6 +420,8 @@ class Nitpicker::Session_component : public Genode::Rpc_object, Mode &_mode; + Signal_context_capability _mode_sigh; + View &_pointer_origin; List _view_list; @@ -697,6 +699,15 @@ class Nitpicker::Session_component : public Genode::Rpc_object, _destroy_view(*static_cast(v)); } + /** + * Deliver mode-change signal to client + */ + void notify_mode_change() + { + if (_mode_sigh.valid()) + Signal_transmitter(_mode_sigh).submit(); + } + void upgrade_ram_quota(size_t ram_quota) { _session_alloc.upgrade(ram_quota); } @@ -859,6 +870,11 @@ class Nitpicker::Session_component : public Genode::Rpc_object, _framebuffer.mode().format()); } + void mode_sigh(Signal_context_capability sigh) override + { + _mode_sigh = sigh; + } + void buffer(Framebuffer::Mode mode, bool use_alpha) override { /* check if the session quota suffices for the specified mode */ @@ -1294,6 +1310,13 @@ void Nitpicker::Main::handle_fb_mode(unsigned) /* redraw */ user_state.update_all_views(); + + /* notify clients about the change screen mode */ + for (::Session *s = session_list.first(); s; s = s->next()) { + Session_component *sc = dynamic_cast(s); + if (sc) + sc->notify_mode_change(); + } }