add AddMousePos func, add listen mouse pos hook

This commit is contained in:
vcaesar 2019-03-08 14:17:51 -04:00
parent e6fa68d0ff
commit b37868f1ee

View File

@ -1311,6 +1311,21 @@ func AddMouse(btn string, x ...int16) bool {
return true
}
// AddMousePos add listen mouse event pos hook
func AddMousePos(x, y int16) bool {
s := hook.Start()
for {
e := <-s
if e.Kind == hook.MouseMove && e.X == x && e.Y == y {
hook.End()
break
}
}
return true
}
/*
____ __ ____ __ .__ __. _______ ______ ____ __ ____
\ \ / \ / / | | | \ | | | \ / __ \ \ \ / \ / /