()
| 52 | } |
| 53 | |
| 54 | func (km *KeyManager) update() { |
| 55 | km.mutex.Lock() |
| 56 | |
| 57 | // Update the state on all the dirty keys |
| 58 | for _, key := range km.dirtmap { |
| 59 | delete(km.dirtmap, key) |
| 60 | |
| 61 | state := km.mapper[key] |
| 62 | state.set(state.currentState) |
| 63 | km.mapper[key] = state |
| 64 | } |
| 65 | |
| 66 | km.mutex.Unlock() |
| 67 | } |
| 68 | |
| 69 | // KeyState is used for detecting the state of a key press. |
| 70 | type KeyState struct { |