mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
fix mouse type and sreen
This commit is contained in:
parent
6d3a330d9b
commit
dc6366ede5
48
robotgo.go
48
robotgo.go
@ -6,13 +6,16 @@ package robotgo
|
|||||||
#cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit -framework Carbon -framework CoreFoundation
|
#cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit -framework Carbon -framework CoreFoundation
|
||||||
//#elif defined(USE_X11)
|
//#elif defined(USE_X11)
|
||||||
#cgo linux CFLAGS:-I/usr/src
|
#cgo linux CFLAGS:-I/usr/src
|
||||||
#cgo linux LDFLAGS:-L/usr/src -lpng -lz -lX11 -lXtst -lm
|
#cgo linux LDFLAGS:-L/usr/src -lX11 -lXtst -lm
|
||||||
//#endif
|
//#endif
|
||||||
#cgo windows LDFLAGS: -lgdi32 -luser32
|
#cgo windows LDFLAGS: -lgdi32 -luser32
|
||||||
//#include <AppKit/NSEvent.h>
|
//#include <AppKit/NSEvent.h>
|
||||||
#include "screen/goScreen.h"
|
#include "screen/goScreen.h"
|
||||||
#include "mouse/goMouse.h"
|
#include "mouse/goMouse.h"
|
||||||
#include "key/goKey.h"
|
#include "key/goKey.h"
|
||||||
|
//#include "bitmap/goBitmap.h"
|
||||||
|
//#include "window/goWindow.h"
|
||||||
|
//#include "event/goEvent.h"
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
@ -68,7 +71,13 @@ func SetXDisplayName(name string) string {
|
|||||||
return gstr
|
return gstr
|
||||||
}
|
}
|
||||||
|
|
||||||
func CaptureScreen(x, y, w, h C.int) Bit_map {
|
func CaptureScreen(x, y, w, h C.int) C.MMBitmapRef {
|
||||||
|
bit := C.aCaptureScreen(x, y, w, h)
|
||||||
|
Println("...", bit.width)
|
||||||
|
return bit
|
||||||
|
}
|
||||||
|
|
||||||
|
func Capture_Screen(x, y, w, h C.int) Bit_map {
|
||||||
bit := C.aCaptureScreen(x, y, w, h)
|
bit := C.aCaptureScreen(x, y, w, h)
|
||||||
// Println("...", bit)
|
// Println("...", bit)
|
||||||
bit_map := Bit_map{
|
bit_map := Bit_map{
|
||||||
@ -98,22 +107,31 @@ type MPoint struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//C.size_t int
|
//C.size_t int
|
||||||
func MoveMouse(x, y C.size_t) {
|
func MoveMouse(x, y int) {
|
||||||
C.aMoveMouse(x, y)
|
cx := C.size_t(x)
|
||||||
|
cy := C.size_t(y)
|
||||||
|
C.aMoveMouse(cx, cy)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DragMouse(x, y C.size_t) {
|
func DragMouse(x, y int) {
|
||||||
C.aDragMouse(x, y)
|
cx := C.size_t(x)
|
||||||
|
cy := C.size_t(y)
|
||||||
|
C.aDragMouse(cx, cy)
|
||||||
}
|
}
|
||||||
|
|
||||||
func MoveMouseSmooth(x, y C.size_t) {
|
func MoveMouseSmooth(x, y int) {
|
||||||
C.aMoveMouseSmooth(x, y)
|
cx := C.size_t(x)
|
||||||
|
cy := C.size_t(y)
|
||||||
|
C.aMoveMouseSmooth(cx, cy)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMousePos() (C.size_t, C.size_t) {
|
func GetMousePos() (int, int) {
|
||||||
pos := C.aGetMousePos()
|
pos := C.aGetMousePos()
|
||||||
// Println("pos:###", pos, pos.x, pos.y)
|
// Println("pos:###", pos, pos.x, pos.y)
|
||||||
return pos.x, pos.y
|
x := int(pos.x)
|
||||||
|
y := int(pos.y)
|
||||||
|
// return pos.x, pos.y
|
||||||
|
return x, y
|
||||||
}
|
}
|
||||||
|
|
||||||
func MouseClick() {
|
func MouseClick() {
|
||||||
@ -124,13 +142,15 @@ func MouseToggle() {
|
|||||||
C.aMouseToggle()
|
C.aMouseToggle()
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetMouseDelay(x C.size_t) {
|
func SetMouseDelay(x int) {
|
||||||
C.aSetMouseDelay(x)
|
cx := C.size_t(x)
|
||||||
|
C.aSetMouseDelay(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ScrollMouse(x C.size_t, y string) {
|
func ScrollMouse(x int, y string) {
|
||||||
|
cx := C.size_t(x)
|
||||||
z := C.CString(y)
|
z := C.CString(y)
|
||||||
C.aScrollMouse(x, z)
|
C.aScrollMouse(cx, z)
|
||||||
defer C.free(unsafe.Pointer(z))
|
defer C.free(unsafe.Pointer(z))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user