mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-09 01:53:56 +00:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
48706562fc | ||
![]() |
023426ab13 | ||
![]() |
d34a1491cb | ||
![]() |
c431c8f974 | ||
![]() |
a183783e9c | ||
![]() |
c1115cebc7 | ||
![]() |
a8c387a070 | ||
![]() |
3eef3b5879 | ||
![]() |
b731094f61 | ||
![]() |
8d4679db07 | ||
![]() |
02c668a946 | ||
![]() |
5c2864485d | ||
![]() |
f101b10497 | ||
![]() |
73c07dc991 | ||
![]() |
fc47bc8216 | ||
![]() |
912ddcbfe4 | ||
![]() |
57b5e5bca2 | ||
![]() |
8031f7f526 | ||
![]() |
36bc85ad19 | ||
![]() |
5fc2bd4c73 |
@ -1,5 +1,5 @@
|
|||||||
# FROM golang:1.10.1
|
# 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
|
# FROM govgo/go:1.11.1
|
||||||
|
|
||||||
RUN apt update && apt install -y --no-install-recommends \
|
RUN apt update && apt install -y --no-install-recommends \
|
||||||
|
4
.github/workflows/go.yml
vendored
4
.github/workflows/go.yml
vendored
@ -10,10 +10,10 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.23.0
|
- name: Set up Go 1.24.0
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.23.0
|
go-version: 1.24.0
|
||||||
id: go
|
id: go
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
|
@ -30,7 +30,6 @@ Before sending code out for review, run all the tests for the whole tree to make
|
|||||||
|
|
||||||
In addition to the owner, Changes to Robotgo must be reviewed before they are accepted, no matter who makes the change even if it is a maintainer. We use GitHub's pull request workflow to do that and we also use [LGTM](http://lgtm.co) to ensure every PR is reviewed by vz or least 2 maintainers.
|
In addition to the owner, Changes to Robotgo must be reviewed before they are accepted, no matter who makes the change even if it is a maintainer. We use GitHub's pull request workflow to do that and we also use [LGTM](http://lgtm.co) to ensure every PR is reviewed by vz or least 2 maintainers.
|
||||||
|
|
||||||
|
|
||||||
## Sign your work
|
## Sign your work
|
||||||
|
|
||||||
The sign-off is a simple line at the end of the explanation for the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch.
|
The sign-off is a simple line at the end of the explanation for the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch.
|
||||||
@ -43,7 +42,6 @@ To make sure every PR is checked, we got team maintainers. A maintainer should b
|
|||||||
|
|
||||||
Since Robotgo is a pure community organization without any company support, Copyright 2016 The go-vgo Project Developers.
|
Since Robotgo is a pure community organization without any company support, Copyright 2016 The go-vgo Project Developers.
|
||||||
|
|
||||||
|
|
||||||
## Versions
|
## Versions
|
||||||
|
|
||||||
Robotgo has the `master` branch as a tip branch and has version branches such as `v0.30.0`. `v0.40.0` is a release branch and we will tag `v0.40.0` for binary download. If `v0.40.0` has bugs, we will accept pull requests on the `v0.40.0` branch and publish a `v0.40.1` tag, after bringing the bug fix also to the master branch.
|
Robotgo has the `master` branch as a tip branch and has version branches such as `v0.30.0`. `v0.40.0` is a release branch and we will tag `v0.40.0` for binary download. If `v0.40.0` has bugs, we will accept pull requests on the `v0.40.0` branch and publish a `v0.40.1` tag, after bringing the bug fix also to the master branch.
|
||||||
@ -60,9 +58,9 @@ Code that you contribute should use the standard copyright header:
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ GCC
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### For MacOS:
|
#### For MacOS:
|
||||||
|
|
||||||
```
|
```
|
||||||
brew install go
|
brew install go
|
||||||
```
|
```
|
||||||
@ -72,6 +73,7 @@ xcode-select --install
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### For Windows:
|
#### For Windows:
|
||||||
|
|
||||||
```
|
```
|
||||||
winget install Golang.go
|
winget install Golang.go
|
||||||
```
|
```
|
||||||
@ -535,6 +537,6 @@ func main() {
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Robotgo is primarily distributed under the terms of "both the MIT license and the Apache License (Version 2.0)", with portions covered by various BSD-like licenses.
|
Robotgo is primarily distributed under the terms of "the Apache License (Version 2.0)", with portions covered by various BSD-like licenses.
|
||||||
|
|
||||||
See [LICENSE-APACHE](http://www.apache.org/licenses/LICENSE-2.0), [LICENSE-MIT](https://github.com/go-vgo/robotgo/blob/master/LICENSE).
|
See [LICENSE-APACHE](http://www.apache.org/licenses/LICENSE-2.0), [LICENSE](https://github.com/go-vgo/robotgo/blob/master/LICENSE).
|
||||||
|
6
doc.go
6
doc.go
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package robotgo
|
package robotgo
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
23
go.mod
23
go.mod
@ -10,30 +10,29 @@ require (
|
|||||||
github.com/robotn/xgb v0.10.0
|
github.com/robotn/xgb v0.10.0
|
||||||
github.com/robotn/xgbutil v0.10.0
|
github.com/robotn/xgbutil v0.10.0
|
||||||
github.com/tailscale/win v0.0.0-20250213223159-5992cb43ca35
|
github.com/tailscale/win v0.0.0-20250213223159-5992cb43ca35
|
||||||
github.com/vcaesar/gops v0.40.0
|
github.com/vcaesar/gops v0.41.0
|
||||||
github.com/vcaesar/imgo v0.40.2
|
github.com/vcaesar/imgo v0.41.0
|
||||||
github.com/vcaesar/keycode v0.10.1
|
github.com/vcaesar/keycode v0.10.1
|
||||||
github.com/vcaesar/tt v0.20.1
|
github.com/vcaesar/tt v0.20.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e // indirect
|
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e // indirect
|
||||||
github.com/ebitengine/purego v0.8.2 // indirect
|
github.com/ebitengine/purego v0.8.3 // indirect
|
||||||
github.com/gen2brain/shm v0.1.1 // indirect
|
github.com/gen2brain/shm v0.1.1 // indirect
|
||||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||||
github.com/jezek/xgb v1.1.1 // 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-20250317134145-8bc96cf8fc35 // indirect
|
||||||
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/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||||
github.com/shirou/gopsutil/v4 v4.25.1 // indirect
|
github.com/shirou/gopsutil/v4 v4.25.4 // indirect
|
||||||
github.com/tklauser/go-sysconf v0.3.14 // indirect
|
github.com/tklauser/go-sysconf v0.3.15 // indirect
|
||||||
github.com/tklauser/numcpus v0.9.0 // indirect
|
github.com/tklauser/numcpus v0.10.0 // indirect
|
||||||
|
github.com/vcaesar/screenshot v0.11.1
|
||||||
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||||
golang.org/x/exp v0.0.0-20250215185904-eff6e970281f // indirect
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
|
||||||
golang.org/x/image v0.24.0 // indirect
|
golang.org/x/image v0.27.0 // indirect
|
||||||
golang.org/x/sys v0.30.0 // indirect
|
golang.org/x/sys v0.33.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
// replace golang.org/x/sys => github.com/golang/sys v0.0.0-20190109145017-48ac38b7c8cb
|
// replace golang.org/x/sys => github.com/golang/sys v0.0.0-20190109145017-48ac38b7c8cb
|
||||||
|
51
go.sum
51
go.sum
@ -4,8 +4,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e h1:L+XrFvD0vBIBm+Wf9sFN6aU395t7JROoai0qXZraA4U=
|
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e h1:L+XrFvD0vBIBm+Wf9sFN6aU395t7JROoai0qXZraA4U=
|
||||||
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e/go.mod h1:SUxUaAK/0UG5lYyZR1L1nC4AaYYvSSYTWQSH3FPcxKU=
|
github.com/dblohm7/wingoes v0.0.0-20240820181039-f2b84150679e/go.mod h1:SUxUaAK/0UG5lYyZR1L1nC4AaYYvSSYTWQSH3FPcxKU=
|
||||||
github.com/ebitengine/purego v0.8.2 h1:jPPGWs2sZ1UgOSgD2bClL0MJIqu58nOmIcBuXr62z1I=
|
github.com/ebitengine/purego v0.8.3 h1:K+0AjQp63JEZTEMZiwsI9g0+hAMNohwUOtY0RPGexmc=
|
||||||
github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
github.com/ebitengine/purego v0.8.3/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||||
github.com/gen2brain/shm v0.1.1 h1:1cTVA5qcsUFixnDHl14TmRoxgfWEEZlTezpUj1vm5uQ=
|
github.com/gen2brain/shm v0.1.1 h1:1cTVA5qcsUFixnDHl14TmRoxgfWEEZlTezpUj1vm5uQ=
|
||||||
github.com/gen2brain/shm v0.1.1/go.mod h1:UgIcVtvmOu+aCJpqJX7GOtiN7X2ct+TKLg4RTxwPIUA=
|
github.com/gen2brain/shm v0.1.1/go.mod h1:UgIcVtvmOu+aCJpqJX7GOtiN7X2ct+TKLg4RTxwPIUA=
|
||||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
@ -13,16 +13,12 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
|||||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||||
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||||
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
|
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
|
||||||
github.com/jezek/xgb v1.1.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
|
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/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 h1:PpXWgLPs+Fqr325bN2FD2ISlRRztXibcX6e8f5FR5Dc=
|
||||||
github.com/kbinani/screenshot v0.0.0-20250118074034-a3924b7bbc8c/go.mod h1:Pmpz2BLf55auQZ67u3rvyI2vAQvNetkK/4zYUmpauZQ=
|
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
|
||||||
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=
|
|
||||||
github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
|
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||||
github.com/otiai10/gosseract/v2 v2.4.1 h1:G8AyBpXEeSlcq8TI85LH/pM5SXk8Djy2GEXisgyblRw=
|
github.com/otiai10/gosseract/v2 v2.4.1 h1:G8AyBpXEeSlcq8TI85LH/pM5SXk8Djy2GEXisgyblRw=
|
||||||
@ -38,37 +34,38 @@ github.com/robotn/xgb v0.10.0 h1:O3kFbIwtwZ3pgLbp1h5slCQ4OpY8BdwugJLrUe6GPIM=
|
|||||||
github.com/robotn/xgb v0.10.0/go.mod h1:SxQhJskUJ4rleVU44YvnrdvxQr0tKy5SRSigBrCgyyQ=
|
github.com/robotn/xgb v0.10.0/go.mod h1:SxQhJskUJ4rleVU44YvnrdvxQr0tKy5SRSigBrCgyyQ=
|
||||||
github.com/robotn/xgbutil v0.10.0 h1:gvf7mGQqCWQ68aHRtCxgdewRk+/KAJui6l3MJQQRCKw=
|
github.com/robotn/xgbutil v0.10.0 h1:gvf7mGQqCWQ68aHRtCxgdewRk+/KAJui6l3MJQQRCKw=
|
||||||
github.com/robotn/xgbutil v0.10.0/go.mod h1:svkDXUDQjUiWzLrA0OZgHc4lbOts3C+uRfP6/yjwYnU=
|
github.com/robotn/xgbutil v0.10.0/go.mod h1:svkDXUDQjUiWzLrA0OZgHc4lbOts3C+uRfP6/yjwYnU=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.1 h1:QSWkTc+fu9LTAWfkZwZ6j8MSUk4A2LV7rbH0ZqmLjXs=
|
github.com/shirou/gopsutil/v4 v4.25.4 h1:cdtFO363VEOOFrUCjZRh4XVJkb548lyF0q0uTeMqYPw=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.1/go.mod h1:RoUCUpndaJFtT+2zsZzzmhvbfGoDCJ7nFXKJf8GqJbI=
|
github.com/shirou/gopsutil/v4 v4.25.4/go.mod h1:xbuxyoZj+UsgnZrENu3lQivsngRR5BdjbJwf2fv4szA=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/tailscale/win v0.0.0-20250213223159-5992cb43ca35 h1:wAZbkTZkqDzWsqxPh2qkBd3KvFU7tcxV0BP0Rnhkxog=
|
github.com/tailscale/win v0.0.0-20250213223159-5992cb43ca35 h1:wAZbkTZkqDzWsqxPh2qkBd3KvFU7tcxV0BP0Rnhkxog=
|
||||||
github.com/tailscale/win v0.0.0-20250213223159-5992cb43ca35/go.mod h1:aMd4yDHLjbOuYP6fMxj1d9ACDQlSWwYztcpybGHCQc8=
|
github.com/tailscale/win v0.0.0-20250213223159-5992cb43ca35/go.mod h1:aMd4yDHLjbOuYP6fMxj1d9ACDQlSWwYztcpybGHCQc8=
|
||||||
github.com/tc-hib/winres v0.2.1 h1:YDE0FiP0VmtRaDn7+aaChp1KiF4owBiJa5l964l5ujA=
|
github.com/tc-hib/winres v0.2.1 h1:YDE0FiP0VmtRaDn7+aaChp1KiF4owBiJa5l964l5ujA=
|
||||||
github.com/tc-hib/winres v0.2.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk=
|
github.com/tc-hib/winres v0.2.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk=
|
||||||
github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU=
|
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
|
||||||
github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY=
|
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
|
||||||
github.com/tklauser/numcpus v0.9.0 h1:lmyCHtANi8aRUgkckBgoDk1nHCux3n2cgkJLXdQGPDo=
|
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
|
||||||
github.com/tklauser/numcpus v0.9.0/go.mod h1:SN6Nq1O3VychhC1npsWostA+oW+VOQTxZrS604NSRyI=
|
github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ=
|
||||||
github.com/vcaesar/gops v0.40.0 h1:I+1RCGiV+LkZJUYNzAd373xs0uM2UyeFdZBmow8HfCM=
|
github.com/vcaesar/gops v0.41.0 h1:FG748Jyw3FOuZnbzSgB+CQSx2e5LbLCPWV2JU1brFdc=
|
||||||
github.com/vcaesar/gops v0.40.0/go.mod h1:3u/USW7JovqUK6i13VOD3qWfvXXd2TIIKE4PYIv4TOM=
|
github.com/vcaesar/gops v0.41.0/go.mod h1:/3048L7Rj7QjQKTSB+kKc7hDm63YhTWy5QJ10TCP37A=
|
||||||
github.com/vcaesar/imgo v0.40.2 h1:5GWScRLdBCMtO1v2I1bs+ZmDLZFINxYSMZ+mtUw5qPM=
|
github.com/vcaesar/imgo v0.41.0 h1:kNLYGrThXhB9Dd6IwFmfPnxq9P6yat2g7dpPjr7OWO8=
|
||||||
github.com/vcaesar/imgo v0.40.2/go.mod h1:MVCl+FxHI2gTgmiHoi0n5xNCbYcfv9SVtdEOUC92+eo=
|
github.com/vcaesar/imgo v0.41.0/go.mod h1:/LGOge8etlzaVu/7l+UfhJxR6QqaoX5yeuzGIMfWb4I=
|
||||||
github.com/vcaesar/keycode v0.10.1 h1:0DesGmMAPWpYTCYddOFiCMKCDKgNnwiQa2QXindVUHw=
|
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/keycode v0.10.1/go.mod h1:JNlY7xbKsh+LAGfY2j4M3znVrGEm5W1R8s/Uv6BJcfQ=
|
||||||
|
github.com/vcaesar/screenshot v0.11.1 h1:GgPuN89XC4Yh38dLx4quPlSo3YiWWhwIria/j3LtrqU=
|
||||||
|
github.com/vcaesar/screenshot v0.11.1/go.mod h1:gJNwHBiP1v1v7i8TQ4yV1XJtcyn2I/OJL7OziVQkwjs=
|
||||||
github.com/vcaesar/tt v0.20.1 h1:D/jUeeVCNbq3ad8M7hhtB3J9x5RZ6I1n1eZ0BJp7M+4=
|
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/vcaesar/tt v0.20.1/go.mod h1:cH2+AwGAJm19Wa6xvEa+0r+sXDJBT0QgNQey6mwqLeU=
|
||||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||||
golang.org/x/exp v0.0.0-20250215185904-eff6e970281f h1:oFMYAjX0867ZD2jcNiLBrI9BdpmEkvPyi5YrBGXbamg=
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI=
|
||||||
golang.org/x/exp v0.0.0-20250215185904-eff6e970281f/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk=
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ=
|
||||||
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=
|
golang.org/x/image v0.27.0 h1:C8gA4oWU/tKkdCfYT6T2u4faJu3MeNS5O8UPWlPF61w=
|
||||||
golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8=
|
golang.org/x/image v0.27.0/go.mod h1:xbdrClrAUway1MUTEZDq9mz/UpRwYAkFFNUslZtcB+g=
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
6
img.go
6
img.go
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package robotgo
|
package robotgo
|
||||||
|
83
key.go
83
key.go
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package robotgo
|
package robotgo
|
||||||
@ -416,7 +416,7 @@ func keyTaps(k string, keyArr []string, pid int) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func keyToggles(k string, keyArr []string, pid int, args ...interface{}) error {
|
func getKeyDown(keyArr []string) (bool, []string) {
|
||||||
if len(keyArr) <= 0 {
|
if len(keyArr) <= 0 {
|
||||||
keyArr = append(keyArr, "down")
|
keyArr = append(keyArr, "down")
|
||||||
}
|
}
|
||||||
@ -429,20 +429,26 @@ func keyToggles(k string, keyArr []string, pid int, args ...interface{}) error {
|
|||||||
if keyArr[0] == "up" || keyArr[0] == "down" {
|
if keyArr[0] == "up" || keyArr[0] == "down" {
|
||||||
keyArr = keyArr[1:]
|
keyArr = keyArr[1:]
|
||||||
}
|
}
|
||||||
flags := getFlagsFromValue(keyArr)
|
return down, keyArr
|
||||||
|
}
|
||||||
|
|
||||||
|
func keyTogglesB(k string, down bool, keyArr []string, pid int) error {
|
||||||
|
flags := getFlagsFromValue(keyArr)
|
||||||
key, err := checkKeyCodes(k)
|
key, err := checkKeyCodes(k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
C.toggleKeyCode(key, C.bool(down), flags, C.uintptr(pid))
|
C.toggleKeyCode(key, C.bool(down), flags, C.uintptr(pid))
|
||||||
if len(args) > 0 {
|
|
||||||
MilliSleep(KeySleep)
|
MilliSleep(KeySleep)
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func keyToggles(k string, keyArr []string, pid int) error {
|
||||||
|
down, keyArr1 := getKeyDown(keyArr)
|
||||||
|
return keyTogglesB(k, down, keyArr1, pid)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
__ ___ ___________ ____ .______ ______ ___ .______ _______
|
__ ___ ___________ ____ .______ ______ ___ .______ _______
|
||||||
| |/ / | ____\ \ / / | _ \ / __ \ / \ | _ \ | \
|
| |/ / | ____\ \ / / | _ \ / __ \ / \ | _ \ | \
|
||||||
@ -480,6 +486,22 @@ func toErr(str *C.char) error {
|
|||||||
return errors.New(gstr)
|
return errors.New(gstr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appendShift(key string, len1 int, args ...interface{}) (string, []interface{}) {
|
||||||
|
if len(key) > 0 && unicode.IsUpper([]rune(key)[0]) {
|
||||||
|
args = append(args, "shift")
|
||||||
|
}
|
||||||
|
|
||||||
|
key = strings.ToLower(key)
|
||||||
|
if _, ok := Special[key]; ok {
|
||||||
|
key = Special[key]
|
||||||
|
if len(args) <= len1 {
|
||||||
|
args = append(args, "shift")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return key, args
|
||||||
|
}
|
||||||
|
|
||||||
// KeyTap taps the keyboard code;
|
// KeyTap taps the keyboard code;
|
||||||
//
|
//
|
||||||
// See keys supported:
|
// See keys supported:
|
||||||
@ -498,18 +520,7 @@ func toErr(str *C.char) error {
|
|||||||
// robotgo.KeyTap("k", pid int)
|
// robotgo.KeyTap("k", pid int)
|
||||||
func KeyTap(key string, args ...interface{}) error {
|
func KeyTap(key string, args ...interface{}) error {
|
||||||
var keyArr []string
|
var keyArr []string
|
||||||
|
key, args = appendShift(key, 0, args...)
|
||||||
if len(key) > 0 && unicode.IsUpper([]rune(key)[0]) {
|
|
||||||
args = append(args, "shift")
|
|
||||||
}
|
|
||||||
|
|
||||||
key = strings.ToLower(key)
|
|
||||||
if _, ok := Special[key]; ok {
|
|
||||||
key = Special[key]
|
|
||||||
if len(args) <= 0 {
|
|
||||||
args = append(args, "shift")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pid := 0
|
pid := 0
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
@ -528,6 +539,16 @@ func KeyTap(key string, args ...interface{}) error {
|
|||||||
return keyTaps(key, keyArr, pid)
|
return keyTaps(key, keyArr, pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getToggleArgs(args ...interface{}) (pid int, keyArr []string) {
|
||||||
|
if len(args) > 0 && reflect.TypeOf(args[0]) == reflect.TypeOf(pid) {
|
||||||
|
pid = args[0].(int)
|
||||||
|
keyArr = ToStrings(args[1:])
|
||||||
|
} else {
|
||||||
|
keyArr = ToStrings(args)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// KeyToggle toggles the keyboard, if there not have args default is "down"
|
// KeyToggle toggles the keyboard, if there not have args default is "down"
|
||||||
//
|
//
|
||||||
// See keys:
|
// See keys:
|
||||||
@ -542,28 +563,8 @@ func KeyTap(key string, args ...interface{}) error {
|
|||||||
// robotgo.KeyToggle("a", "up", "alt", "cmd")
|
// robotgo.KeyToggle("a", "up", "alt", "cmd")
|
||||||
// robotgo.KeyToggle("k", pid int)
|
// robotgo.KeyToggle("k", pid int)
|
||||||
func KeyToggle(key string, args ...interface{}) error {
|
func KeyToggle(key string, args ...interface{}) error {
|
||||||
|
key, args = appendShift(key, 1, args...)
|
||||||
if len(key) > 0 && unicode.IsUpper([]rune(key)[0]) {
|
pid, keyArr := getToggleArgs(args...)
|
||||||
args = append(args, "shift")
|
|
||||||
}
|
|
||||||
|
|
||||||
key = strings.ToLower(key)
|
|
||||||
if _, ok := Special[key]; ok {
|
|
||||||
key = Special[key]
|
|
||||||
if len(args) <= 1 {
|
|
||||||
args = append(args, "shift")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pid := 0
|
|
||||||
var keyArr []string
|
|
||||||
if len(args) > 0 && reflect.TypeOf(args[0]) == reflect.TypeOf(pid) {
|
|
||||||
pid = args[0].(int)
|
|
||||||
keyArr = ToStrings(args[1:])
|
|
||||||
} else {
|
|
||||||
keyArr = ToStrings(args)
|
|
||||||
}
|
|
||||||
|
|
||||||
return keyToggles(key, keyArr, pid)
|
return keyToggles(key, keyArr, pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package key
|
package key
|
||||||
|
@ -90,7 +90,8 @@ MMKeyCode keyCodeForChar(const char c) {
|
|||||||
|
|
||||||
#if defined(IS_MACOSX)
|
#if defined(IS_MACOSX)
|
||||||
CFStringRef createStringForKey(CGKeyCode keyCode){
|
CFStringRef createStringForKey(CGKeyCode keyCode){
|
||||||
TISInputSourceRef currentKeyboard = TISCopyCurrentASCIICapableKeyboardInputSource();
|
// TISInputSourceRef currentKeyboard = TISCopyCurrentASCIICapableKeyboardInputSource();
|
||||||
|
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
CFDataRef layoutData = (CFDataRef) TISGetInputSourceProperty(
|
CFDataRef layoutData = (CFDataRef) TISGetInputSourceProperty(
|
||||||
currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
|
currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#include "../base/deadbeef_rand_c.h"
|
#include "../base/deadbeef_rand_c.h"
|
||||||
@ -58,7 +58,7 @@
|
|||||||
if (pid != 0) {
|
if (pid != 0) {
|
||||||
CGEventPostToPid(pid, event);
|
CGEventPostToPid(pid, event);
|
||||||
} else {
|
} else {
|
||||||
CGEventPost(kCGSessionEventTap, event);
|
CGEventPost(kCGHIDEventTap, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFRelease(event);
|
CFRelease(event);
|
||||||
@ -179,7 +179,8 @@ void toggleKeyCode(MMKeyCode code, const bool down, MMKeyFlags flags, uintptr pi
|
|||||||
NX_SYSDEFINED, loc, &event, kNXEventDataVersion, 0, FALSE);
|
NX_SYSDEFINED, loc, &event, kNXEventDataVersion, 0, FALSE);
|
||||||
assert(KERN_SUCCESS == kr);
|
assert(KERN_SUCCESS == kr);
|
||||||
} else {
|
} else {
|
||||||
CGEventRef keyEvent = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)code, down);
|
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||||
|
CGEventRef keyEvent = CGEventCreateKeyboardEvent(source, (CGKeyCode)code, down);
|
||||||
assert(keyEvent != NULL);
|
assert(keyEvent != NULL);
|
||||||
|
|
||||||
CGEventSetType(keyEvent, down ? kCGEventKeyDown : kCGEventKeyUp);
|
CGEventSetType(keyEvent, down ? kCGEventKeyDown : kCGEventKeyUp);
|
||||||
@ -188,6 +189,7 @@ void toggleKeyCode(MMKeyCode code, const bool down, MMKeyFlags flags, uintptr pi
|
|||||||
}
|
}
|
||||||
|
|
||||||
SendTo(pid, keyEvent);
|
SendTo(pid, keyEvent);
|
||||||
|
CFRelease(source);
|
||||||
}
|
}
|
||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
const DWORD dwFlags = down ? 0 : KEYEVENTF_KEYUP;
|
const DWORD dwFlags = down ? 0 : KEYEVENTF_KEYUP;
|
||||||
@ -273,7 +275,8 @@ void toggleKey(char c, const bool down, MMKeyFlags flags, uintptr pid) {
|
|||||||
convert characters to a keycode, but does not support adding modifier flags.
|
convert characters to a keycode, but does not support adding modifier flags.
|
||||||
It is only used in typeString().
|
It is only used in typeString().
|
||||||
-- if you need modifier keys, use the above functions instead. */
|
-- if you need modifier keys, use the above functions instead. */
|
||||||
CGEventRef keyEvent = CGEventCreateKeyboardEvent(NULL, 0, down);
|
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||||
|
CGEventRef keyEvent = CGEventCreateKeyboardEvent(source, 0, down);
|
||||||
if (keyEvent == NULL) {
|
if (keyEvent == NULL) {
|
||||||
fputs("Could not create keyboard event.\n", stderr);
|
fputs("Could not create keyboard event.\n", stderr);
|
||||||
return;
|
return;
|
||||||
@ -282,6 +285,7 @@ void toggleKey(char c, const bool down, MMKeyFlags flags, uintptr pid) {
|
|||||||
CGEventKeyboardSetUnicodeString(keyEvent, 1, &ch);
|
CGEventKeyboardSetUnicodeString(keyEvent, 1, &ch);
|
||||||
|
|
||||||
SendTo(pid, keyEvent);
|
SendTo(pid, keyEvent);
|
||||||
|
CFRelease(source);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define toggleUniKey(c, down) toggleKey(c, down, MOD_NONE, 0)
|
#define toggleUniKey(c, down) toggleKey(c, down, MOD_NONE, 0)
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package robotgo
|
package robotgo
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package mouse
|
package mouse
|
||||||
|
@ -83,13 +83,15 @@
|
|||||||
/* Move the mouse to a specific point. */
|
/* Move the mouse to a specific point. */
|
||||||
void moveMouse(MMPointInt32 point){
|
void moveMouse(MMPointInt32 point){
|
||||||
#if defined(IS_MACOSX)
|
#if defined(IS_MACOSX)
|
||||||
CGEventRef move = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved,
|
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||||
|
CGEventRef move = CGEventCreateMouseEvent(source, kCGEventMouseMoved,
|
||||||
CGPointFromMMPointInt32(point), kCGMouseButtonLeft);
|
CGPointFromMMPointInt32(point), kCGMouseButtonLeft);
|
||||||
|
|
||||||
calculateDeltas(&move, point);
|
calculateDeltas(&move, point);
|
||||||
|
|
||||||
CGEventPost(kCGSessionEventTap, move);
|
CGEventPost(kCGHIDEventTap, move);
|
||||||
CFRelease(move);
|
CFRelease(move);
|
||||||
|
CFRelease(source);
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
Display *display = XGetMainDisplay();
|
Display *display = XGetMainDisplay();
|
||||||
XWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, point.x, point.y);
|
XWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, point.x, point.y);
|
||||||
@ -103,13 +105,15 @@ void moveMouse(MMPointInt32 point){
|
|||||||
void dragMouse(MMPointInt32 point, const MMMouseButton button){
|
void dragMouse(MMPointInt32 point, const MMMouseButton button){
|
||||||
#if defined(IS_MACOSX)
|
#if defined(IS_MACOSX)
|
||||||
const CGEventType dragType = MMMouseDragToCGEventType(button);
|
const CGEventType dragType = MMMouseDragToCGEventType(button);
|
||||||
CGEventRef drag = CGEventCreateMouseEvent(NULL, dragType,
|
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||||
|
CGEventRef drag = CGEventCreateMouseEvent(source, dragType,
|
||||||
CGPointFromMMPointInt32(point), (CGMouseButton)button);
|
CGPointFromMMPointInt32(point), (CGMouseButton)button);
|
||||||
|
|
||||||
calculateDeltas(&drag, point);
|
calculateDeltas(&drag, point);
|
||||||
|
|
||||||
CGEventPost(kCGSessionEventTap, drag);
|
CGEventPost(kCGHIDEventTap, drag);
|
||||||
CFRelease(drag);
|
CFRelease(drag);
|
||||||
|
CFRelease(source);
|
||||||
#else
|
#else
|
||||||
moveMouse(point);
|
moveMouse(point);
|
||||||
#endif
|
#endif
|
||||||
@ -145,10 +149,12 @@ void toggleMouse(bool down, MMMouseButton button) {
|
|||||||
#if defined(IS_MACOSX)
|
#if defined(IS_MACOSX)
|
||||||
const CGPoint currentPos = CGPointFromMMPointInt32(location());
|
const CGPoint currentPos = CGPointFromMMPointInt32(location());
|
||||||
const CGEventType mouseType = MMMouseToCGEventType(down, button);
|
const CGEventType mouseType = MMMouseToCGEventType(down, button);
|
||||||
CGEventRef event = CGEventCreateMouseEvent(NULL, mouseType, currentPos, (CGMouseButton)button);
|
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||||
|
CGEventRef event = CGEventCreateMouseEvent(source, mouseType, currentPos, (CGMouseButton)button);
|
||||||
|
|
||||||
CGEventPost(kCGSessionEventTap, event);
|
CGEventPost(kCGHIDEventTap, event);
|
||||||
CFRelease(event);
|
CFRelease(event);
|
||||||
|
CFRelease(source);
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
Display *display = XGetMainDisplay();
|
Display *display = XGetMainDisplay();
|
||||||
XTestFakeButtonEvent(display, button, down ? True : False, CurrentTime);
|
XTestFakeButtonEvent(display, button, down ? True : False, CurrentTime);
|
||||||
@ -182,7 +188,8 @@ void doubleClick(MMMouseButton button){
|
|||||||
const CGEventType mouseTypeDown = MMMouseToCGEventType(true, button);
|
const CGEventType mouseTypeDown = MMMouseToCGEventType(true, button);
|
||||||
const CGEventType mouseTypeUP = MMMouseToCGEventType(false, button);
|
const CGEventType mouseTypeUP = MMMouseToCGEventType(false, button);
|
||||||
|
|
||||||
CGEventRef event = CGEventCreateMouseEvent(NULL, mouseTypeDown, currentPos, kCGMouseButtonLeft);
|
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||||
|
CGEventRef event = CGEventCreateMouseEvent(source, mouseTypeDown, currentPos, kCGMouseButtonLeft);
|
||||||
|
|
||||||
/* Set event to double click. */
|
/* Set event to double click. */
|
||||||
CGEventSetIntegerValueField(event, kCGMouseEventClickState, 2);
|
CGEventSetIntegerValueField(event, kCGMouseEventClickState, 2);
|
||||||
@ -192,6 +199,7 @@ void doubleClick(MMMouseButton button){
|
|||||||
CGEventPost(kCGHIDEventTap, event);
|
CGEventPost(kCGHIDEventTap, event);
|
||||||
|
|
||||||
CFRelease(event);
|
CFRelease(event);
|
||||||
|
CFRelease(source);
|
||||||
#else
|
#else
|
||||||
/* Double click for everything else. */
|
/* Double click for everything else. */
|
||||||
clickMouse(button);
|
clickMouse(button);
|
||||||
@ -208,14 +216,13 @@ void scrollMouseXY(int x, int y) {
|
|||||||
INPUT mouseScrollInputV;
|
INPUT mouseScrollInputV;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Direction should only be considered based on the scrollDirection. This Should not interfere. */
|
#if defined(IS_MACOSX)
|
||||||
/* Set up the OS specific solution */
|
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||||
#if defined(__APPLE__)
|
CGEventRef event = CGEventCreateScrollWheelEvent(source, kCGScrollEventUnitPixel, 2, y, x);
|
||||||
CGEventRef event;
|
|
||||||
event = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitPixel, 2, y, x);
|
|
||||||
CGEventPost(kCGHIDEventTap, event);
|
CGEventPost(kCGHIDEventTap, event);
|
||||||
|
|
||||||
CFRelease(event);
|
CFRelease(event);
|
||||||
|
CFRelease(source);
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
int ydir = 4; /* Button 4 is up, 5 is down. */
|
int ydir = 4; /* Button 4 is up, 5 is down. */
|
||||||
int xdir = 6;
|
int xdir = 6;
|
||||||
|
6
ps.go
6
ps.go
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package robotgo
|
package robotgo
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package robotgo_test
|
package robotgo_test
|
||||||
|
14
robotgo.go
14
robotgo.go
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -31,10 +31,10 @@ package robotgo
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo darwin CFLAGS: -x objective-c -Wno-deprecated-declarations
|
#cgo darwin CFLAGS: -x objective-c -Wno-deprecated-declarations
|
||||||
#cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit
|
#cgo darwin LDFLAGS: -framework Cocoa -framework CoreFoundation -framework IOKit
|
||||||
#cgo darwin LDFLAGS: -framework Carbon -framework CoreFoundation
|
#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
|
#cgo darwin LDFLAGS: -framework ScreenCaptureKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ var (
|
|||||||
// MouseSleep set the mouse default millisecond sleep time
|
// MouseSleep set the mouse default millisecond sleep time
|
||||||
MouseSleep = 0
|
MouseSleep = 0
|
||||||
// KeySleep set the key default millisecond sleep time
|
// KeySleep set the key default millisecond sleep time
|
||||||
KeySleep = 0
|
KeySleep = 10
|
||||||
|
|
||||||
// DisplayID set the screen display id
|
// DisplayID set the screen display id
|
||||||
DisplayID = -1
|
DisplayID = -1
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//go:build darwin
|
//go:build darwin
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//go:build !windows
|
//go:build !windows
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//go:build darwin || windows
|
//go:build darwin || windows
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//go:build ocr
|
//go:build ocr
|
||||||
@ -14,7 +14,7 @@
|
|||||||
package robotgo
|
package robotgo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/otiai10/gosseract"
|
"github.com/otiai10/gosseract/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetText get the image text by tesseract ocr
|
// GetText get the image text by tesseract ocr
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//go:build darwin || windows
|
//go:build darwin || windows
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//go:build windows
|
//go:build windows
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//go:build !darwin && !windows
|
//go:build !darwin && !windows
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package robotgo
|
package robotgo
|
||||||
@ -13,7 +13,8 @@ package robotgo
|
|||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
|
|
||||||
"github.com/kbinani/screenshot"
|
// "github.com/kbinani/screenshot"
|
||||||
|
"github.com/vcaesar/screenshot"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetDisplayBounds gets the display screen bounds
|
// GetDisplayBounds gets the display screen bounds
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#include "../base/types.h"
|
#include "../base/types.h"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "screen_c.h"
|
#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) {
|
static CGImageRef capture15(CGDirectDisplayID id, CGRect diIntersectDisplayLocal, CGColorSpaceRef colorSpace) {
|
||||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||||
__block CGImageRef image1 = nil;
|
__block CGImageRef image1 = nil;
|
||||||
@ -76,7 +76,7 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
MMPointInt32 o = rect.origin; MMSizeInt32 s = rect.size;
|
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);
|
CGColorSpaceRef color = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||||
CGImageRef image = capture15(displayID, CGRectMake(o.x, o.y, s.w, s.h), color);
|
CGImageRef image = capture15(displayID, CGRectMake(o.x, o.y, s.w, s.h), color);
|
||||||
CGColorSpaceRelease(color);
|
CGColorSpaceRelease(color);
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#include "alert_c.h"
|
#include "alert_c.h"
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// #include "../base/os.h"
|
// #include "../base/os.h"
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// #if defined(USE_X11)
|
// #if defined(USE_X11)
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
// http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
//
|
||||||
// option. This file may not be copied, modified, or distributed
|
// This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#include "pub.h"
|
#include "pub.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user