(&mut self, events: &mut Vec<(Event, EventStatus)>, _output: &mut T)
| 23 | |
| 24 | impl<T: USBKeyOut> ProcessKeys<T> for RewriteLayer { |
| 25 | fn process_keys(&mut self, events: &mut Vec<(Event, EventStatus)>, _output: &mut T)->HandlerResult { |
| 26 | for (event, _status) in iter_unhandled_mut(events) { |
| 27 | //events.iter_mut() { |
| 28 | match event { |
| 29 | Event::KeyRelease(kc) => { |
| 30 | for (from, to) in self.rewrites.iter() { |
| 31 | if *from == kc.keycode { |
| 32 | if (kc.flag & 2) == 0 { |
| 33 | kc.keycode = *to; |
| 34 | kc.flag |= 2; |
| 35 | } |
| 36 | break; //only one rewrite per layer |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | Event::KeyPress(kc) => { |
| 41 | for (from, to) in self.rewrites.iter() { |
| 42 | if *from == kc.keycode { |
| 43 | if (kc.flag & 2) == 0 { |
| 44 | kc.keycode = *to; |
| 45 | kc.flag |= 2; |
| 46 | } |
| 47 | break; //only one rewrite per layer |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | Event::TimeOut(_) => {} |
| 52 | } |
| 53 | } |
| 54 | HandlerResult::NoOp |
| 55 | } |
| 56 | fn default_enabled(&self) -> bool { |
| 57 | false |
| 58 | } |
nothing calls this directly
no test coverage detected