From 80a5bf3c7e38bbbcdfe44a6082451daf970daa0a Mon Sep 17 00:00:00 2001 From: vcaesar Date: Sun, 9 Aug 2020 08:38:35 -0400 Subject: [PATCH] update and optimize hook code --- hook.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hook.go b/hook.go index 9a8d107..15b4563 100644 --- a/hook.go +++ b/hook.go @@ -102,9 +102,7 @@ var ( func allPressed(pressed map[uint16]bool, keys ...uint16) bool { for _, i := range keys { // fmt.Println(i) - if pressed[i] == false { - return false - } + return !pressed[i] } return true @@ -123,7 +121,7 @@ func Register(when uint8, cmds []string, cb func(Event)) { keys[key] = tmp cbs[key] = cb events[when] = append(events[when], key) - return + // return } // Process return go hook process @@ -152,7 +150,7 @@ func Process(EvChan <-chan Event) (out chan bool) { out <- true }() - return out + return } // String return hook kind string