Skip to content

robotgo.Move moves cursor to invalid position on multi-monitor setup #479

Open
@SirRFI

Description

  • Robotgo version (or commit ref): v1.0.0-beta5
  • Go version: go version go1.17.6 windows/amd64
  • Gcc version: gcc.exe (x86_64-win32-seh-rev0, Built by MinGW-W64 project) 8.1.0 (recommended by README)
  • Operating system and bit: Windows 10 64bit
  • Resolution: 1920x1080 x3 - 3 monitors with same resolution, middle one set a primary/main
  • Provide example code:
package main

import (
	"fmt"
	"github.com/go-vgo/robotgo"
)

func main() {
	robotgo.Move(10, 100)
	robotgo.MilliSleep(1) // optional
	x, y := robotgo.GetMousePos()
	fmt.Println(x, y) // outputs -1910 99
}

Description

robotgo.Move moves cursor to absolute X, Y position that is passed to the function. robotgo.GetMousePos returns position of the cursor, which used immediately after robotgo.Move should be exactly the same, assuming no user input.

Since robotgo.Move moves cursor to invalid location since [email protected], at least on multi-monitor setup like my own - 3 monitors with 1920x1080 resolution, middle one being set as primary/main, therefore starting with X 0, Y 0, and the left one has negative X positions.

Same code tested with other versions:

go get github.com/go-vgo/[email protected] | go run .
10 100

go get github.com/go-vgo/[email protected] | go run .
-1910 99

go get github.com/go-vgo/[email protected] | go run .
-1910 99

Aside from X being affected, you can see that Y is off by one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions