mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 09:15:36 +00:00
nitpicker: Nitpicker::Session::mode_sigh function
The new 'mode_sigh' functions allows a client to register a signal handler that is notified each time when nitpicker's screen properties change.
This commit is contained in:
@ -420,6 +420,8 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
|
||||
|
||||
Mode &_mode;
|
||||
|
||||
Signal_context_capability _mode_sigh;
|
||||
|
||||
View &_pointer_origin;
|
||||
|
||||
List<Session_view_list_elem> _view_list;
|
||||
@ -697,6 +699,15 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
|
||||
_destroy_view(*static_cast<View *>(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<Session>,
|
||||
_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<Session_component *>(s);
|
||||
if (sc)
|
||||
sc->notify_mode_change();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user