Compare commits

...

8 Commits

Author SHA1 Message Date
Ed Lewis
8f2fc3a286
Merge 401c6cba6c into 57b5e5bca2 2025-04-27 17:38:57 +00:00
Evans
57b5e5bca2
Merge pull request #720 from go-vgo/bitmap-pr
Some checks failed
Go / test (macOS-latest) (push) Has been cancelled
Go / test (windows-latest) (push) Has been cancelled
Update: update import
2025-04-19 12:56:42 -07:00
vcaesar
8031f7f526 Update: update import
Some checks failed
Go / test (macOS-latest) (push) Has been cancelled
Go / test (windows-latest) (push) Has been cancelled
2025-04-19 12:54:47 -07:00
Evans
36bc85ad19
Merge pull request #719 from go-vgo/bitmap-pr
Some checks are pending
Go / test (macOS-latest) (push) Waiting to run
Go / test (windows-latest) (push) Waiting to run
Fix: fixed mac os version min required #698
2025-04-19 10:06:37 -07:00
vcaesar
5fc2bd4c73 Fix: fixed mac os version min required #698
Some checks are pending
Go / test (macOS-latest) (push) Waiting to run
Go / test (windows-latest) (push) Waiting to run
2025-04-19 10:05:01 -07:00
Evans
47abfac5ee
Merge pull request #716 from go-vgo/bitmap-pr
Some checks failed
Go / test (macOS-latest) (push) Has been cancelled
Go / test (windows-latest) (push) Has been cancelled
Fixed: fixed windows Scale #713 and Update readme.md
2025-04-11 14:37:12 -07:00
vcaesar
df0731c4df Fixed: fixed windows Scale #713 and Update readme.md
Some checks failed
Go / test (macOS-latest) (push) Has been cancelled
Go / test (windows-latest) (push) Has been cancelled
2025-04-11 14:34:15 -07:00
Ed Lewis
401c6cba6c Update Fedora requirements in README
Updated readme for Fedora requirements as the package xorg-x11-xkb-utils-devel seems to have moved to xkbcomp-devel in later Fedora versions
2024-01-03 10:36:51 +00:00
7 changed files with 36 additions and 15 deletions

View File

@ -1,5 +1,5 @@
# FROM golang:1.10.1
FROM golang:1.23.2-stretch AS build
FROM golang:1.24.2-stretch AS build
# FROM govgo/go:1.11.1
RUN apt update && apt install -y --no-install-recommends \

View File

@ -61,6 +61,9 @@ GCC
```
#### For MacOS:
```
brew install go
```
Xcode Command Line Tools (And Privacy setting: [#277](https://github.com/go-vgo/robotgo/issues/277))
@ -69,8 +72,15 @@ xcode-select --install
```
#### For Windows:
```
winget install Golang.go
```
[MinGW-w64](https://sourceforge.net/projects/mingw-w64/files) (Use recommended) or others Mingw [llvm-mingw](https://github.com/mstorsjo/llvm-mingw);
```
winget install MartinStorsjo.LLVM-MinGW.UCRT
```
Or [MinGW-w64](https://sourceforge.net/projects/mingw-w64/files) (Use recommended) or others Mingw [llvm-mingw](https://github.com/mstorsjo/llvm-mingw);
Download the Mingw, then set system environment variables `C:\mingw64\bin` to the Path.
[Set environment variables to run GCC from command line](https://www.youtube.com/results?search_query=Set+environment+variables+to+run+GCC+from+command+line).
@ -96,6 +106,9 @@ X11 with the XTest extension (the Xtst library)
##### Ubuntu:
```yml
# sudo apt install golang
sudo snap install go --classic
# gcc
sudo apt install gcc libc6-dev
@ -128,7 +141,7 @@ sudo dnf install xsel xclip
sudo dnf install libpng-devel
# GoHook
sudo dnf install libxkbcommon-devel libxkbcommon-x11-devel xorg-x11-xkb-utils-devel
sudo dnf install libxkbcommon-devel libxkbcommon-x11-devel xkbcomp-devel
```
@ -165,11 +178,18 @@ Note go1.10.x C file compilation cache problem, [golang #24355](https://github.c
package main
import (
"fmt"
"github.com/go-vgo/robotgo"
)
func main() {
robotgo.MouseSleep = 100
robotgo.MouseSleep = 300
robotgo.Move(100, 100)
fmt.Println(robotgo.Location())
robotgo.Move(100, -200) // multi screen supported
robotgo.MoveSmooth(120, -150)
fmt.Println(robotgo.Location())
robotgo.ScrollDir(10, "up")
robotgo.ScrollDir(20, "right")

2
go.mod
View File

@ -23,13 +23,13 @@ require (
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/jezek/xgb v1.1.1 // indirect
github.com/kbinani/screenshot v0.0.0-20250118074034-a3924b7bbc8c
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
github.com/lxn/win v0.0.0-20210218163916-a377121e959e // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/shirou/gopsutil/v4 v4.25.1 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.9.0 // indirect
github.com/vcaesar/screenshot v0.11.0
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/exp v0.0.0-20250215185904-eff6e970281f // indirect
golang.org/x/image v0.24.0 // indirect

4
go.sum
View File

@ -17,8 +17,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
github.com/jezek/xgb v1.1.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
github.com/kbinani/screenshot v0.0.0-20250118074034-a3924b7bbc8c h1:1IlzDla/ZATV/FsRn1ETf7ir91PHS2mrd4VMunEtd9k=
github.com/kbinani/screenshot v0.0.0-20250118074034-a3924b7bbc8c/go.mod h1:Pmpz2BLf55auQZ67u3rvyI2vAQvNetkK/4zYUmpauZQ=
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 h1:7UMa6KCCMjZEMDtTVdcGu0B1GmmC7QJKiCCjyTAWQy0=
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k=
github.com/lxn/win v0.0.0-20210218163916-a377121e959e h1:H+t6A/QJMbhCSEH5rAuRxh+CtW96g0Or0Fxa9IKr4uc=
@ -56,6 +54,8 @@ github.com/vcaesar/imgo v0.40.2 h1:5GWScRLdBCMtO1v2I1bs+ZmDLZFINxYSMZ+mtUw5qPM=
github.com/vcaesar/imgo v0.40.2/go.mod h1:MVCl+FxHI2gTgmiHoi0n5xNCbYcfv9SVtdEOUC92+eo=
github.com/vcaesar/keycode v0.10.1 h1:0DesGmMAPWpYTCYddOFiCMKCDKgNnwiQa2QXindVUHw=
github.com/vcaesar/keycode v0.10.1/go.mod h1:JNlY7xbKsh+LAGfY2j4M3znVrGEm5W1R8s/Uv6BJcfQ=
github.com/vcaesar/screenshot v0.11.0 h1:ULNC6tTye6oNzleuqskzTMSjH8xonmuUIYfYjlYAM3g=
github.com/vcaesar/screenshot v0.11.0/go.mod h1:wixTD3T2Sz3Oi6Hfl33CMcBffd3mLbT7WavfK2UrQcI=
github.com/vcaesar/tt v0.20.1 h1:D/jUeeVCNbq3ad8M7hhtB3J9x5RZ6I1n1eZ0BJp7M+4=
github.com/vcaesar/tt v0.20.1/go.mod h1:cH2+AwGAJm19Wa6xvEa+0r+sXDJBT0QgNQey6mwqLeU=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=

View File

@ -31,10 +31,10 @@ package robotgo
/*
#cgo darwin CFLAGS: -x objective-c -Wno-deprecated-declarations
#cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit
#cgo darwin LDFLAGS: -framework Carbon -framework CoreFoundation
#cgo darwin LDFLAGS: -framework Cocoa -framework CoreFoundation -framework IOKit
#cgo darwin LDFLAGS: -framework Carbon -framework OpenGL
//
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > MAC_OS_VERSION_14_4
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 140400
#cgo darwin LDFLAGS: -framework ScreenCaptureKit
#endif
@ -506,7 +506,7 @@ func CheckMouse(btn string) C.MMMouseButton {
// MoveScale calculate the os scale factor x, y
func MoveScale(x, y int, displayId ...int) (int, int) {
if Scale && runtime.GOOS == "windows" {
if Scale || runtime.GOOS == "windows" {
f := ScaleF()
x, y = Scaled1(x, f), Scaled1(y, f)
}
@ -630,7 +630,7 @@ func Location() (int, int) {
x := int(pos.x)
y := int(pos.y)
if runtime.GOOS == "windows" {
if Scale || runtime.GOOS == "windows" {
f := ScaleF()
x, y = Scaled0(x, f), Scaled0(y, f)
}

View File

@ -13,7 +13,8 @@ package robotgo
import (
"image"
"github.com/kbinani/screenshot"
// "github.com/kbinani/screenshot"
"github.com/vcaesar/screenshot"
)
// GetDisplayBounds gets the display screen bounds

View File

@ -15,7 +15,7 @@
#endif
#include "screen_c.h"
#if defined(IS_MACOSX) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > MAC_OS_VERSION_14_4
#if defined(IS_MACOSX) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 140400
static CGImageRef capture15(CGDirectDisplayID id, CGRect diIntersectDisplayLocal, CGColorSpaceRef colorSpace) {
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
__block CGImageRef image1 = nil;
@ -76,7 +76,7 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id,
}
MMPointInt32 o = rect.origin; MMSizeInt32 s = rect.size;
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > MAC_OS_VERSION_14_4
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 140400
CGColorSpaceRef color = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
CGImageRef image = capture15(displayID, CGRectMake(o.x, o.y, s.w, s.h), color);
CGColorSpaceRelease(color);