wm: revoke curr focus if new focus is undefined

This allows the window layouter to ensure that input entered after
switching to an empty screen won't be routed to the old focused but
no longer visible window.

Issue #5390
This commit is contained in:
Norman Feske
2024-12-05 15:56:52 +01:00
parent 38d99c6dd1
commit 5eba0d68e0

View File

@@ -79,10 +79,14 @@ struct Wm::Main : Pointer::Tracker, Gui::Session_component::Action
{
_gui_root.revoke_exclusive_input();
_focus_rom.update();
bool defined = false;
_focus_rom.xml().with_optional_sub_node("window", [&] (Xml_node const &window) {
_with_win_id_from_xml(window, [&] (Window_registry::Id id) {
_gui_root.with_gui_session(id, [&] (Capability<Gui::Session> cap) {
_focus_gui_session.focus(cap); }); }); });
_focus_gui_session.focus(cap);
defined = true; }); }); });
if (!defined)
_focus_gui_session.focus({ });
}
Signal_handler<Main> _focus_handler {