mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +00:00
add AddMousePos func, add listen mouse pos hook
This commit is contained in:
parent
e6fa68d0ff
commit
b37868f1ee
15
robotgo.go
15
robotgo.go
@ -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
|
||||
}
|
||||
|
||||
/*
|
||||
____ __ ____ __ .__ __. _______ ______ ____ __ ____
|
||||
\ \ / \ / / | | | \ | | | \ / __ \ \ \ / \ / /
|
||||
|
Loading…
Reference in New Issue
Block a user