diff --git a/repos/gems/src/app/sculpt_manager/main.cc b/repos/gems/src/app/sculpt_manager/main.cc index ba741b840d..487e276926 100644 --- a/repos/gems/src/app/sculpt_manager/main.cc +++ b/repos/gems/src/app/sculpt_manager/main.cc @@ -74,8 +74,6 @@ struct Sculpt::Main : Input_event_handler, _input_filter_config.try_generate_manually_managed(); } - bool _first_hover_report = true; - Attached_rom_dataspace _nitpicker_hover { _env, "nitpicker_hover" }; Signal_handler
_nitpicker_hover_handler { @@ -438,23 +436,24 @@ void Sculpt::Main::_handle_hover() void Sculpt::Main::_handle_nitpicker_hover() { - if (!_first_hover_report) - return; - if (!_storage._discovery_state.discovery_in_progress()) return; + /* check if initial user activity has already been evaluated */ + if (_storage._discovery_state.user_state != Discovery_state::USER_UNKNOWN) + return; + _nitpicker_hover.update(); - Xml_node const hover = _nitpicker_hover.xml(); - if (!hover.has_type("hover")) return; - _first_hover_report = false; + _storage._discovery_state.user_state = hover.attribute_value("active", false) + ? Discovery_state::USER_INTERVENED + : Discovery_state::USER_IDLE; - if (hover.attribute_value("active", false) == true) - _storage._discovery_state.user_intervention = true; + /* trigger re-evaluation of default storage target */ + _storage.handle_storage_devices_update(); } diff --git a/repos/gems/src/app/sculpt_manager/model/discovery_state.h b/repos/gems/src/app/sculpt_manager/model/discovery_state.h index 1a60c6e30f..9619cb7b2a 100644 --- a/repos/gems/src/app/sculpt_manager/model/discovery_state.h +++ b/repos/gems/src/app/sculpt_manager/model/discovery_state.h @@ -26,7 +26,9 @@ namespace Sculpt { struct Discovery_state; } struct Sculpt::Discovery_state { - bool user_intervention = false; + enum User_state { USER_UNKNOWN, USER_IDLE, USER_INTERVENED }; + + User_state user_state { USER_UNKNOWN }; bool _done = false; @@ -39,9 +41,14 @@ struct Sculpt::Discovery_state return Storage_target { }; /* user intervention disarms the built-in selection policy */ - if (user_intervention) + if (user_state == USER_UNKNOWN) return Storage_target { }; + if (user_state == USER_INTERVENED) { + _done = true; + return Storage_target { }; + } + /* defer decision until the low-level device enumeration is complete */ if (!devices.all_devices_enumerated()) return Storage_target { };