action: Rename Level to View
This commit is contained in:
@ -6,8 +6,8 @@ use std::ffi::CString;
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct KeySym(pub String);
|
||||
|
||||
/// Use to switch layouts
|
||||
type Level = String;
|
||||
/// Use to switch views
|
||||
type View = String;
|
||||
|
||||
/// Use to send modified keypresses
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
@ -20,12 +20,12 @@ pub enum Modifier {
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Action {
|
||||
/// Switch to this view
|
||||
SetLevel(Level),
|
||||
SetView(View),
|
||||
/// Switch to a view and latch
|
||||
LockLevel {
|
||||
lock: Level,
|
||||
LockView {
|
||||
lock: View,
|
||||
/// When unlocked by pressing it or emitting a key
|
||||
unlock: Level,
|
||||
unlock: View,
|
||||
},
|
||||
/// Set this modifier TODO: release?
|
||||
SetModifier(Modifier),
|
||||
|
||||
@ -522,7 +522,7 @@ fn create_action<H: WarningHandler>(
|
||||
match submission {
|
||||
SubmitData::Action(
|
||||
Action::SetView(view_name)
|
||||
) => ::action::Action::SetLevel(
|
||||
) => ::action::Action::SetView(
|
||||
filter_view_name(
|
||||
name, view_name.clone(), &view_names,
|
||||
warning_handler,
|
||||
@ -530,7 +530,7 @@ fn create_action<H: WarningHandler>(
|
||||
),
|
||||
SubmitData::Action(Action::Locking {
|
||||
lock_view, unlock_view
|
||||
}) => ::action::Action::LockLevel {
|
||||
}) => ::action::Action::LockView {
|
||||
lock: filter_view_name(
|
||||
name,
|
||||
lock_view.clone(),
|
||||
|
||||
@ -698,10 +698,10 @@ impl Layout {
|
||||
// if used like key.borrow() :(
|
||||
let action = RefCell::borrow(key).action.clone();
|
||||
let view_name = match action {
|
||||
Action::SetLevel(name) => {
|
||||
Action::SetView(name) => {
|
||||
Some(name.clone())
|
||||
},
|
||||
Action::LockLevel { lock, unlock } => {
|
||||
Action::LockView { lock, unlock } => {
|
||||
let locked = {
|
||||
let mut key = key.borrow_mut();
|
||||
key.locked ^= true;
|
||||
@ -900,7 +900,7 @@ mod test {
|
||||
pressed: PressType::Released,
|
||||
locked: false,
|
||||
keycodes: Vec::new(),
|
||||
action: Action::SetLevel("default".into()),
|
||||
action: Action::SetView("default".into()),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user