In the Genode framework (outside of Sculpt OS), is there a way for one module to transfer ownership of receiving keyboard events to another module? Specifically, can a module that normally handles keyboard input hand over control so that another module directly receives and processes those events, without manually forwarding each key press?
The GUI session interface features the focus RPC function for this purpose. However, this RPC function does not accept arbitrary client labels as argument but a GUI-session capability. So a GUI client can yield the focus only to sessions that are under its control. The window manager uses this facility to switch the keyboard focus among its clients. Note that the window manager is in the possession of all the application’s session capabilities because it sits in between the application and the nitpicker GUI server. So it naturally has the authority needed to yields its focus to any of its clients.
For scenarios less sophisticated than Sculpt OS, nitpicker allows for defining the focused client via a focus ROM that specifies the focused client’s label. This ROM can be updated dynamically. So a special focus-managing component may drive this ROM (via the report-rom server). For an example, you may have a look at the nit_focus component, which implements the focus-follows-mouse policy for the demo.run scenario.
BTW, Sculpt actually employs both mechanisms. Whereas the keyboard focus of the runtime is managed by the wm, the hard switch between the administrative user interface and the runtime (via F12) is implemented via the focus ROM.
Thanks, that explanation made it clear and helped me resolve my problem.