layout: Put all button state into active_buttons

Ths gets rid of Rc<RefCell<>> sharing of state, which can be hard to keep track of.
In addition, there's no longer any duplication of button state.
This commit is contained in:
Dorota Czaplejewicz
2022-10-01 12:48:52 +00:00
parent 74c5ef4a51
commit 952ec805ed
4 changed files with 188 additions and 218 deletions

View File

@ -4,12 +4,10 @@
/*! Parsing of the data files containing layouts */
use std::cell::RefCell;
use std::collections::{ HashMap, HashSet };
use std::ffi::CString;
use std::fs;
use std::path::PathBuf;
use std::rc::Rc;
use std::vec::Vec;
use xkbcommon::xkb;
@ -18,8 +16,7 @@ use super::{ Error, LoadError };
use ::action;
use crate::keyboard::{
Key, KeyState, PressType,
generate_keymaps, generate_keycodes, KeyCode, FormattingError
Key, generate_keymaps, generate_keycodes, KeyCode, FormattingError
};
use ::layout;
use ::logging;
@ -517,9 +514,6 @@ fn create_button<H: logging::Handler>(
label: label,
action: data.action,
keycodes: data.keycodes,
state: Rc::new(
RefCell::new(KeyState { pressed: PressType::Released })
),
}
}