mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
update window and bitmap c name
This commit is contained in:
parent
182d9a9803
commit
fc9bb0f605
@ -58,7 +58,7 @@ MMBitmapRef bitmap_deepcopy(MMBitmapRef bitmap){
|
|||||||
return bitmap == NULL ? NULL : copyMMBitmap(bitmap);
|
return bitmap == NULL ? NULL : copyMMBitmap(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
MMPoint bitmap_find_bitmap(MMBitmapRef bitmap, MMBitmapRef sbitmap, float tolerance){
|
MMPoint find_bitmap(MMBitmapRef bitmap, MMBitmapRef sbitmap, float tolerance){
|
||||||
MMPoint point = {-1, -1};
|
MMPoint point = {-1, -1};
|
||||||
// printf("tolenrance=%f\n", tolerance);
|
// printf("tolenrance=%f\n", tolerance);
|
||||||
if (!bitmap_ready(sbitmap) || !bitmap_ready(bitmap)) {
|
if (!bitmap_ready(sbitmap) || !bitmap_ready(bitmap)) {
|
||||||
@ -184,7 +184,7 @@ bool bitmap_str(MMBitmapRef bitmap, char *out){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MMBitmapRef get_Portion(MMBitmapRef bit_map, MMRect rect){
|
MMBitmapRef get_portion(MMBitmapRef bit_map, MMRect rect){
|
||||||
// MMRect rect;
|
// MMRect rect;
|
||||||
MMBitmapRef portion = NULL;
|
MMBitmapRef portion = NULL;
|
||||||
|
|
||||||
|
24
robotgo.go
24
robotgo.go
@ -738,7 +738,7 @@ func FindBitmap(args ...interface{}) (int, int) {
|
|||||||
tolerance = 0.5
|
tolerance = 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
pos := C.bitmap_find_bitmap(bit, sbit, tolerance)
|
pos := C.find_bitmap(bit, sbit, tolerance)
|
||||||
// fmt.Println("pos----", pos)
|
// fmt.Println("pos----", pos)
|
||||||
return int(pos.x), int(pos.y)
|
return int(pos.x), int(pos.y)
|
||||||
}
|
}
|
||||||
@ -911,7 +911,7 @@ func GetPortion(bit C.MMBitmapRef, x, y, w, h C.size_t) C.MMBitmapRef {
|
|||||||
rect.size.width = w
|
rect.size.width = w
|
||||||
rect.size.height = h
|
rect.size.height = h
|
||||||
|
|
||||||
pos := C.get_Portion(bit, rect)
|
pos := C.get_portion(bit, rect)
|
||||||
return pos
|
return pos
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1093,7 +1093,7 @@ func ShowAlert(title, msg string, args ...string) int {
|
|||||||
adefaultButton := C.CString(defaultButton)
|
adefaultButton := C.CString(defaultButton)
|
||||||
acancelButton := C.CString(cancelButton)
|
acancelButton := C.CString(cancelButton)
|
||||||
|
|
||||||
cbool := C.aShowAlert(atitle, amsg, adefaultButton, acancelButton)
|
cbool := C.show_alert(atitle, amsg, adefaultButton, acancelButton)
|
||||||
ibool := int(cbool)
|
ibool := int(cbool)
|
||||||
|
|
||||||
defer C.free(unsafe.Pointer(atitle))
|
defer C.free(unsafe.Pointer(atitle))
|
||||||
@ -1106,7 +1106,7 @@ func ShowAlert(title, msg string, args ...string) int {
|
|||||||
|
|
||||||
// IsValid valid the window
|
// IsValid valid the window
|
||||||
func IsValid() bool {
|
func IsValid() bool {
|
||||||
abool := C.aIsValid()
|
abool := C.is_valid()
|
||||||
gbool := bool(abool)
|
gbool := bool(abool)
|
||||||
// fmt.Println("bool---------", gbool)
|
// fmt.Println("bool---------", gbool)
|
||||||
return gbool
|
return gbool
|
||||||
@ -1114,30 +1114,30 @@ func IsValid() bool {
|
|||||||
|
|
||||||
// SetActive set the window active
|
// SetActive set the window active
|
||||||
func SetActive(win C.MData) {
|
func SetActive(win C.MData) {
|
||||||
C.aSetActive(win)
|
C.set_active(win)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetActive get the active window
|
// GetActive get the active window
|
||||||
func GetActive() C.MData {
|
func GetActive() C.MData {
|
||||||
mdata := C.aGetActive()
|
mdata := C.get_active()
|
||||||
// fmt.Println("active----", mdata)
|
// fmt.Println("active----", mdata)
|
||||||
return mdata
|
return mdata
|
||||||
}
|
}
|
||||||
|
|
||||||
// CloseWindow close the window
|
// CloseWindow close the window
|
||||||
func CloseWindow() {
|
func CloseWindow() {
|
||||||
C.aCloseWindow()
|
C.close_window()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHandle set the window handle
|
// SetHandle set the window handle
|
||||||
func SetHandle(hwnd int) {
|
func SetHandle(hwnd int) {
|
||||||
chwnd := C.uintptr(hwnd)
|
chwnd := C.uintptr(hwnd)
|
||||||
C.aSetHandle(chwnd)
|
C.set_handle(chwnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHandle get the window handle
|
// GetHandle get the window handle
|
||||||
func GetHandle() int {
|
func GetHandle() int {
|
||||||
hwnd := C.aGetHandle()
|
hwnd := C.get_handle()
|
||||||
ghwnd := int(hwnd)
|
ghwnd := int(hwnd)
|
||||||
// fmt.Println("gethwnd---", ghwnd)
|
// fmt.Println("gethwnd---", ghwnd)
|
||||||
return ghwnd
|
return ghwnd
|
||||||
@ -1145,7 +1145,7 @@ func GetHandle() int {
|
|||||||
|
|
||||||
// GetBHandle get the window handle
|
// GetBHandle get the window handle
|
||||||
func GetBHandle() int {
|
func GetBHandle() int {
|
||||||
hwnd := C.bGetHandle()
|
hwnd := C.bget_handle()
|
||||||
ghwnd := int(hwnd)
|
ghwnd := int(hwnd)
|
||||||
//fmt.Println("gethwnd---", ghwnd)
|
//fmt.Println("gethwnd---", ghwnd)
|
||||||
return ghwnd
|
return ghwnd
|
||||||
@ -1153,7 +1153,7 @@ func GetBHandle() int {
|
|||||||
|
|
||||||
// GetTitle get the window title
|
// GetTitle get the window title
|
||||||
func GetTitle() string {
|
func GetTitle() string {
|
||||||
title := C.aGetTitle()
|
title := C.get_title()
|
||||||
gtittle := C.GoString(title)
|
gtittle := C.GoString(title)
|
||||||
// fmt.Println("title...", gtittle)
|
// fmt.Println("title...", gtittle)
|
||||||
return gtittle
|
return gtittle
|
||||||
@ -1161,7 +1161,7 @@ func GetTitle() string {
|
|||||||
|
|
||||||
// GetPID get the process id
|
// GetPID get the process id
|
||||||
func GetPID() int {
|
func GetPID() int {
|
||||||
pid := C.aGetPID()
|
pid := C.get_PID()
|
||||||
return int(pid)
|
return int(pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,38 +11,38 @@
|
|||||||
#include "alert_c.h"
|
#include "alert_c.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
int aShowAlert(const char *title, const char *msg, const char *defaultButton,
|
int show_alert(const char *title, const char *msg, const char *defaultButton,
|
||||||
const char *cancelButton){
|
const char *cancelButton){
|
||||||
int alert = showAlert(title, msg, defaultButton, cancelButton);
|
int alert = showAlert(title, msg, defaultButton, cancelButton);
|
||||||
|
|
||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool aIsValid(){
|
bool is_valid(){
|
||||||
bool abool = IsValid();
|
bool abool = IsValid();
|
||||||
return abool;
|
return abool;
|
||||||
}
|
}
|
||||||
|
|
||||||
// int aFindwindow(char* name){
|
// int find_window(char* name){
|
||||||
// int z = findwindow(name);
|
// int z = findwindow(name);
|
||||||
// return z;
|
// return z;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void aCloseWindow(void){
|
void close_window(void){
|
||||||
CloseWin();
|
CloseWin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool aSetHandle(uintptr handle){
|
bool set_handle(uintptr handle){
|
||||||
bool hwnd = setHandle(handle);
|
bool hwnd = setHandle(handle);
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr aGetHandle(){
|
uintptr get_handle(){
|
||||||
uintptr hwnd = getHandle();
|
uintptr hwnd = getHandle();
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr bGetHandle(){
|
uintptr bget_handle(){
|
||||||
MData mData = GetActive();
|
MData mData = GetActive();
|
||||||
#if defined(IS_MACOSX)
|
#if defined(IS_MACOSX)
|
||||||
return (uintptr)mData.CgID;
|
return (uintptr)mData.CgID;
|
||||||
@ -53,7 +53,7 @@ uintptr bGetHandle(){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void aSetActive(const MData win){
|
void set_active(const MData win){
|
||||||
SetActive(win);
|
SetActive(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,18 +70,18 @@ void active_PID(uintptr pid){
|
|||||||
SetActive(win);
|
SetActive(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
MData aGetActive(){
|
MData get_active(){
|
||||||
MData mdata = GetActive();
|
MData mdata = GetActive();
|
||||||
return mdata;
|
return mdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* aGetTitle(){
|
char* get_title(){
|
||||||
char* title = GetTitle();
|
char* title = GetTitle();
|
||||||
// printf("title::::%s\n", title );
|
// printf("title::::%s\n", title );
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 aGetPID(void){
|
int32 get_PID(void){
|
||||||
int pid = WGetPID();
|
int pid = WGetPID();
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user