From 8ed87dae71d3618e73ca16e4d64a301c10e5502d Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 25 Oct 2024 18:50:57 +0200 Subject: [PATCH] gui_fb: deliver initial mode signal if pending This patch handles the case where a mode change happens in-between session creation and the registration of the mode-signal handler, which can result in a sporadic loss of response to mode changes. Noticed while working on issue #5286. --- repos/os/src/server/gui_fb/main.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/repos/os/src/server/gui_fb/main.cc b/repos/os/src/server/gui_fb/main.cc index 1675a7265b..6f0565f66e 100644 --- a/repos/os/src/server/gui_fb/main.cc +++ b/repos/os/src/server/gui_fb/main.cc @@ -104,6 +104,8 @@ struct Framebuffer::Session_component : Genode::Rpc_object */ Framebuffer::Mode _next_mode; + bool _mode_sigh_pending = false; + /* * Number of bytes used for backing the current virtual framebuffer at * the GUI server. @@ -168,6 +170,8 @@ struct Framebuffer::Session_component : Genode::Rpc_object if (_mode_sigh.valid()) Signal_transmitter(_mode_sigh).submit(); + else + _mode_sigh_pending = true; } Gui::Area size() const @@ -206,6 +210,12 @@ struct Framebuffer::Session_component : Genode::Rpc_object void mode_sigh(Signal_context_capability sigh) override { _mode_sigh = sigh; + + /* notify mode change that happened just before 'mode_sigh' */ + if (_mode_sigh.valid() && _mode_sigh_pending) { + Signal_transmitter(_mode_sigh).submit(); + _mode_sigh_pending = false; + } } void refresh(Rect rect) override