mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-24 10:19:01 +00:00
add AddMousePos func, add listen mouse pos hook
This commit is contained in:
parent
e6fa68d0ff
commit
b37868f1ee
1 changed files with 15 additions and 0 deletions
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 a new issue