add a handler, return a HandlerID which you may use with keyboard.output.state().enable_handler / disable_handler / toggle_handler / is_handler_enabled by default, most handlers start in the enabled state (with the notable exception of Layers).
(&mut self, handler: Box<dyn ProcessKeys<T> + Send + 'a>)
| 123 | /// |
| 124 | /// by default, most handlers start in the enabled state (with the notable exception of Layers). |
| 125 | pub fn add_handler(&mut self, handler: Box<dyn ProcessKeys<T> + Send + 'a>) -> HandlerID { |
| 126 | self.output |
| 127 | .state() |
| 128 | .modifiers_and_enabled_handlers |
| 129 | .push(handler.default_enabled()); |
| 130 | self.handlers.push(handler); |
| 131 | return self.output.state().modifiers_and_enabled_handlers.len() - 1; |
| 132 | } |
| 133 | |
| 134 | /// predict the next or further out hander_ids returned by add_handler |
| 135 | /// Needed to add space cadets before the layers they toggle. |