mirror of
https://github.com/robotn/gohook.git
synced 2025-01-19 06:06:41 +08:00
update and optimize hook code
This commit is contained in:
parent
a1db03bfdb
commit
80a5bf3c7e
8
hook.go
8
hook.go
@ -102,9 +102,7 @@ var (
|
|||||||
func allPressed(pressed map[uint16]bool, keys ...uint16) bool {
|
func allPressed(pressed map[uint16]bool, keys ...uint16) bool {
|
||||||
for _, i := range keys {
|
for _, i := range keys {
|
||||||
// fmt.Println(i)
|
// fmt.Println(i)
|
||||||
if pressed[i] == false {
|
return !pressed[i]
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -123,7 +121,7 @@ func Register(when uint8, cmds []string, cb func(Event)) {
|
|||||||
keys[key] = tmp
|
keys[key] = tmp
|
||||||
cbs[key] = cb
|
cbs[key] = cb
|
||||||
events[when] = append(events[when], key)
|
events[when] = append(events[when], key)
|
||||||
return
|
// return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process return go hook process
|
// Process return go hook process
|
||||||
@ -152,7 +150,7 @@ func Process(EvChan <-chan Event) (out chan bool) {
|
|||||||
out <- true
|
out <- true
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return out
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// String return hook kind string
|
// String return hook kind string
|
||||||
|
Loading…
Reference in New Issue
Block a user