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