Merge branch 'text_input_enable' into 'master'

Submit and delete strings via text_input

See merge request Librem5/squeekboard!304
This commit is contained in:
Dorota Czaplejewicz
2020-02-03 15:06:25 +00:00
21 changed files with 258 additions and 50 deletions

View File

@ -15,6 +15,7 @@ use std::vec::Vec;
use xkbcommon::xkb;
use ::action;
use ::keyboard::{
KeyState, PressType,
generate_keymap, generate_keycodes, FormattingError
@ -264,6 +265,9 @@ enum Action {
SetView(String),
#[serde(rename="show_prefs")]
ShowPrefs,
/// Remove last character
#[serde(rename="erase")]
Erase,
}
#[derive(Debug, Clone, Deserialize, PartialEq)]
@ -386,6 +390,10 @@ impl Layout {
)
}).collect()
},
action::Action::Erase => vec![
*keymap.get("BackSpace")
.expect(&format!("BackSpace missing from keymap")),
],
_ => Vec::new(),
};
(
@ -558,6 +566,7 @@ fn create_action<H: logging::Handler>(
SubmitData::Action(
Action::ShowPrefs
) => ::action::Action::ShowPreferences,
SubmitData::Action(Action::Erase) => action::Action::Erase,
SubmitData::Keysym(keysym) => ::action::Action::Submit {
text: None,
keys: vec!(::action::KeySym(
@ -589,7 +598,7 @@ fn create_action<H: logging::Handler>(
false => format!("U{:04X}", codepoint as u32),
})
}).collect(),
}
},
}
}