Skip to content

Commit fc5dac6

Browse files
authored
Merge pull request #539 from go-vgo/bitmap-pr
Unified name and Update godoc, fixed typo
2 parents 4ad733f + 4bf054f commit fc5dac6

File tree

18 files changed

+108
-76
lines changed

18 files changed

+108
-76
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Golang
5353
GCC
5454
```
5555

56-
#### For Mac OS X:
56+
#### For MacOS:
5757

5858
Xcode Command Line Tools (And Privacy setting: [#277](https://github.com/go-vgo/robotgo/issues/277) )
5959

@@ -163,8 +163,8 @@ import (
163163
func main() {
164164
robotgo.MouseSleep = 100
165165

166-
robotgo.ScrollMouse(10, "up")
167-
robotgo.ScrollMouse(20, "right")
166+
robotgo.ScrollDir(10, "up")
167+
robotgo.ScrollDir(20, "right")
168168

169169
robotgo.Scroll(0, -10)
170170
robotgo.Scroll(100, 0)
@@ -242,7 +242,7 @@ import (
242242
)
243243

244244
func main() {
245-
x, y := robotgo.GetMousePos()
245+
x, y := robotgo.Location()
246246
fmt.Println("pos: ", x, y)
247247

248248
color := robotgo.GetPixelColor(100, 200)
@@ -455,7 +455,7 @@ func main() {
455455
robotgo.KeyToggle("a", fpid[0])
456456
robotgo.KeyToggle("a", fpid[0], "up")
457457

458-
robotgo.ActivePID(fpid[0])
458+
robotgo.ActivePid(fpid[0])
459459

460460
robotgo.Kill(fpid[0])
461461
}
@@ -519,9 +519,9 @@ Some discussions and questions, please see [issues/228](https://github.com/go-vg
519519
## Plans
520520
- Refactor some C code to Go (such as x11, windows)
521521
- Better multiscreen support
522-
- Waylad supports
522+
- Wayland support
523523
- Update Window Handle
524-
- Try support Android and IOS
524+
- Try to support Android and IOS
525525

526526
## Contributors
527527

README_zh.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Robotgo
22

3+
## !!! Warning: this page not updated !!!
4+
35
[![Build Status](https://github.com/go-vgo/robotgo/workflows/Go/badge.svg)](https://github.com/go-vgo/robotgo/commits/master)
46
[![CircleCI Status](https://circleci.com/gh/go-vgo/robotgo.svg?style=shield)](https://circleci.com/gh/go-vgo/robotgo)
57
[![Build Status](https://travis-ci.org/go-vgo/robotgo.svg)](https://travis-ci.org/go-vgo/robotgo)
@@ -67,7 +69,7 @@ xcode-select --install
6769

6870
```
6971
Or the other GCC (But you should compile the "libpng" with yourself.
70-
Or you can removed the bitmap.go )
72+
Or you can removed the bitmap.go.)
7173
```
7274

7375
#### For everything else (Linux 等其他系统):

base/pubs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
return TRUE;
2323
}
2424

25-
HWND GetHwndByPId(DWORD dwProcessId) {
25+
HWND GetHwndByPid(DWORD dwProcessId) {
2626
WNDINFO info = {0};
2727
info.hWnd = NULL;
2828
info.dwPid = dwProcessId;
2929
EnumWindows(EnumWindowsProc, (LPARAM)&info);
30-
// printf("%d\n", info.hWnd);
30+
3131
return info.hWnd;
3232
}
3333
#endif

examples/mouse/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func click() {
5555

5656
func get() {
5757
// gets the mouse coordinates
58-
x, y := robotgo.GetMousePos()
58+
x, y := robotgo.Location()
5959
fmt.Println("pos:", x, y)
6060
if x == 456 && y == 586 {
6161
fmt.Println("mouse...", "586")
@@ -66,8 +66,8 @@ func get() {
6666

6767
func toggleAndScroll() {
6868
// scrolls the mouse either up
69-
robotgo.ScrollMouse(10, "up")
70-
robotgo.ScrollMouse(10, "right")
69+
robotgo.ScrollDir(10, "up")
70+
robotgo.ScrollDir(10, "right")
7171

7272
robotgo.Scroll(100, 10)
7373
robotgo.Scroll(0, -10)

examples/window/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func alert() {
2828

2929
func get() {
3030
// get the current process id
31-
pid := robotgo.GetPID()
31+
pid := robotgo.GetPid()
3232
fmt.Println("pid----", pid)
3333

3434
// get current Window Active
@@ -64,7 +64,7 @@ func findIds() {
6464

6565
fmt.Println("pids...", fpid)
6666
if len(fpid) > 0 {
67-
err = robotgo.ActivePID(fpid[0])
67+
err = robotgo.ActivePid(fpid[0])
6868
if err != nil {
6969
fmt.Println(err)
7070
}
@@ -87,7 +87,7 @@ func findIds() {
8787
}
8888

8989
func active() {
90-
robotgo.ActivePID(100)
90+
robotgo.ActivePid(100)
9191
// robotgo.Sleep(2)
9292
robotgo.ActiveName("code")
9393
robotgo.Sleep(1)

key.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const (
201201
LightsKbdDown = "lights_kbd_down"
202202
)
203203

204-
// keyNames define MMKeyCode map
204+
// keyNames define a map of key names to MMKeyCode
205205
var keyNames = map[string]C.MMKeyCode{
206206
"backspace": C.K_BACKSPACE,
207207
"delete": C.K_DELETE,
@@ -441,7 +441,7 @@ func keyToggles(k string, keyArr []string, pid int) error {
441441
442442
*/
443443

444-
// ToInterfaces []string to []interface{}
444+
// ToInterfaces convert []string to []interface{}
445445
func ToInterfaces(fields []string) []interface{} {
446446
res := make([]interface{}, 0, len(fields))
447447
for _, s := range fields {
@@ -450,7 +450,7 @@ func ToInterfaces(fields []string) []interface{} {
450450
return res
451451
}
452452

453-
// ToStrings []interface{} to []string
453+
// ToStrings convert []interface{} to []string
454454
func ToStrings(fields []interface{}) []string {
455455
res := make([]string, 0, len(fields))
456456
for _, s := range fields {
@@ -467,19 +467,20 @@ func toErr(str *C.char) error {
467467
return errors.New(gstr)
468468
}
469469

470-
// KeyTap tap the keyboard code;
470+
// KeyTap taps the keyboard code;
471471
//
472472
// See keys:
473+
//
473474
// https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
474475
//
475476
// Examples:
477+
//
476478
// robotgo.KeySleep = 100 // 100 millisecond
477479
// robotgo.KeyTap("a")
478480
// robotgo.KeyTap("i", "alt", "command")
479481
//
480482
// arr := []string{"alt", "command"}
481483
// robotgo.KeyTap("i", arr)
482-
//
483484
func KeyTap(key string, args ...interface{}) error {
484485
var keyArr []string
485486

@@ -512,17 +513,18 @@ func KeyTap(key string, args ...interface{}) error {
512513
return keyTaps(key, keyArr, pid)
513514
}
514515

515-
// KeyToggle toggle the keyboard, if there not have args default is "down"
516+
// KeyToggle toggles the keyboard, if there not have args default is "down"
516517
//
517518
// See keys:
519+
//
518520
// https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
519521
//
520522
// Examples:
523+
//
521524
// robotgo.KeyToggle("a")
522525
// robotgo.KeyToggle("a", "up")
523526
//
524527
// robotgo.KeyToggle("a", "up", "alt", "cmd")
525-
//
526528
func KeyToggle(key string, args ...interface{}) error {
527529

528530
if len(key) > 0 && unicode.IsUpper([]rune(key)[0]) {
@@ -633,13 +635,13 @@ func inputUTF(str string) {
633635
C.free(unsafe.Pointer(cstr))
634636
}
635637

636-
// TypeStr send a string, supported UTF-8
638+
// TypeStr send a string (supported UTF-8)
637639
//
638640
// robotgo.TypeStr(string: "The string to send", int: pid, "milli_sleep time", "x11 option")
639641
//
640642
// Examples:
641-
// robotgo.TypeStr("abc@123, Hi galaxy, こんにちは")
642643
//
644+
// robotgo.TypeStr("abc@123, Hi galaxy, こんにちは")
643645
func TypeStr(str string, args ...int) {
644646
var tm, tm1 = 0, 7
645647

@@ -681,7 +683,7 @@ func TypeStr(str string, args ...int) {
681683
MilliSleep(KeySleep)
682684
}
683685

684-
// PasteStr paste a string, support UTF-8,
686+
// PasteStr paste a string (support UTF-8),
685687
// write the string to clipboard and tap `cmd + v`
686688
func PasteStr(str string) error {
687689
err := clipboard.WriteAll(str)
@@ -696,23 +698,23 @@ func PasteStr(str string) error {
696698
return KeyTap("v", "control")
697699
}
698700

699-
// TypeStrDelay type string delayed
701+
// TypeStrDelay type string with delayed
700702
func TypeStrDelay(str string, delay int) {
701703
TypeStr(str)
702704
MilliSleep(delay)
703705
}
704706

705707
// Deprecated: use the TypeStr(),
706708
//
707-
// TypeStringDelayed type string delayed, Wno-deprecated
709+
// # TypeStringDelayed type string delayed, Wno-deprecated
708710
//
709711
// This function will be removed in version v1.0.0
710712
func TypeStringDelayed(str string, delay int) {
711713
tt.Drop("TypeStringDelayed", "TypeStrDelay")
712714
TypeStrDelay(str, delay)
713715
}
714716

715-
// SetDelay set the key and mouse delay
717+
// SetDelay sets the key and mouse delay
716718
func SetDelay(d ...int) {
717719
v := 10
718720
if len(d) > 0 {

mouse/mouse_c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ void clickMouse(MMMouseButton button){
192192
toggleMouse(false, button);
193193
}
194194

195-
/* Special function for sending double clicks, needed for Mac OS X. */
195+
/* Special function for sending double clicks, needed for MacOS. */
196196
void doubleClick(MMMouseButton button){
197197
#if defined(IS_MACOSX)
198198
/* Double click for Mac. */

robot_info_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ func TestGetScreenSize(t *testing.T) {
3333

3434
rect := robotgo.GetScreenRect()
3535
fmt.Println("Get screen rect: ", rect)
36+
37+
x, y = robotgo.Location()
38+
fmt.Println("Get location: ", x, y)
3639
}
3740

3841
func TestGetSysScale(t *testing.T) {

0 commit comments

Comments
 (0)