Skip to content

GetBounds returns wrong values #210

Closed
@elonzh

Description

@elonzh
  • Robotgo version (or commit ref): v0.80.0.845, Sierra Nevada!
  • Go version:
$go version  
go version go1.12 darwin/amd64
  • Gcc version:
$gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.3)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
  • Operating system and bit: macOS Mojave x64
  • Resolution: 2880 x 1800
  • Can you reproduce the bug at Examples:
    • Yes (provide example code)
    • No
    • Not relevant
  • Provide example code:
package main

import (
	"fmt"
	"strings"

	"github.com/go-vgo/robotgo"
)

func main() {
	fmt.Println("Version:", robotgo.Version)
	process, _ := robotgo.Process()
	for _, p := range process {
		if strings.Contains(strings.ToLower(p.Name), "macpass") {
			mx, my := robotgo.GetMousePos()
			x, y, w, h := robotgo.GetBounds(p.Pid)
			robotgo.SetActive(robotgo.GetHandPid(p.Pid))
			fmt.Println("Bounds:", robotgo.IsValid(), x, y, w, h)
			fmt.Println("MousePos:", mx, my)
			bitmap := robotgo.CaptureScreen()
			defer robotgo.FreeBitmap(bitmap)
			robotgo.SaveBitmap(bitmap, "test.png")
		}
	}
}
  • Log gist:
$go run main.go                                                                       
Version: v0.80.0.845, Sierra Nevada!
Bounds: true 974848 512 -1 197
MousePos: 509 650

Description

test

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions