mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 19:52:22 +00:00
fix(boot): make the graphical menu mouse opt-in
Add menu-styles.graphical.enable-mouse, which is off by default. Without it, or without a pointing device, the cursor is not drawn and the hint only mentions the keyboard.
This commit is contained in:
1 parent
ffbfcbc1f0
commit
9ac55ada50
5 files changed
+74
-10
No files matched your search
@@ -38,6 +38,9 @@ pub struct RootConfiguration {
|
||||
/// Default options for Sprout.
|
||||
#[serde(default)]
|
||||
pub options: OptionsConfiguration,
|
||||
/// Settings for each style of boot menu.
|
||||
#[serde(rename = "menu-styles", default)]
|
||||
pub menu_styles: MenuStylesConfiguration,
|
||||
/// Values to be inserted into the root sprout context.
|
||||
#[serde(default)]
|
||||
pub values: BTreeMap<String, String>,
|
||||
@@ -99,12 +102,30 @@ pub struct OptionsConfiguration {
|
||||
pub bls_strict_mode: bool,
|
||||
}
|
||||
|
||||
/// Settings for each style of boot menu.
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
pub struct MenuStylesConfiguration {
|
||||
/// Settings for the graphical boot menu.
|
||||
#[serde(default)]
|
||||
pub graphical: GraphicalMenuConfiguration,
|
||||
}
|
||||
|
||||
/// Settings for the graphical boot menu.
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
pub struct GraphicalMenuConfiguration {
|
||||
/// Enables selecting entries with the mouse, and shows the cursor. When disabled, or when
|
||||
/// the firmware has no pointing device, entries are selected with the keyboard only.
|
||||
#[serde(rename = "enable-mouse", default)]
|
||||
pub enable_mouse: bool,
|
||||
}
|
||||
|
||||
/// The default configuration, which matches an empty configuration file.
|
||||
impl Default for RootConfiguration {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
version: latest_version(),
|
||||
options: Default::default(),
|
||||
menu_styles: Default::default(),
|
||||
values: Default::default(),
|
||||
drivers: Default::default(),
|
||||
extractors: Default::default(),
|
||||
@@ -171,6 +192,17 @@ mod tests {
|
||||
assert_eq!(default.options.autoconfigure, empty.options.autoconfigure);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn graphical_mouse_is_off_by_default() {
|
||||
assert!(
|
||||
!RootConfiguration::default()
|
||||
.menu_styles
|
||||
.graphical
|
||||
.enable_mouse
|
||||
);
|
||||
assert!(!empty().menu_styles.graphical.enable_mouse);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bls_strict_mode_is_off_by_default() {
|
||||
assert!(!RootConfiguration::default().options.bls_strict_mode);
|
||||
|
||||
Reference in new issue
Block a user