update window and bitmap c name

This commit is contained in:
vcaesar 2017-12-29 19:52:42 +08:00
parent 182d9a9803
commit fc9bb0f605
3 changed files with 25 additions and 25 deletions

View File

@ -58,7 +58,7 @@ MMBitmapRef bitmap_deepcopy(MMBitmapRef 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};
// printf("tolenrance=%f\n", tolerance);
if (!bitmap_ready(sbitmap) || !bitmap_ready(bitmap)) {
@ -184,7 +184,7 @@ bool bitmap_str(MMBitmapRef bitmap, char *out){
return true;
}
MMBitmapRef get_Portion(MMBitmapRef bit_map, MMRect rect){
MMBitmapRef get_portion(MMBitmapRef bit_map, MMRect rect){
// MMRect rect;
MMBitmapRef portion = NULL;

View File

@ -738,7 +738,7 @@ func FindBitmap(args ...interface{}) (int, int) {
tolerance = 0.5
}
pos := C.bitmap_find_bitmap(bit, sbit, tolerance)
pos := C.find_bitmap(bit, sbit, tolerance)
// fmt.Println("pos----", pos)
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.height = h
pos := C.get_Portion(bit, rect)
pos := C.get_portion(bit, rect)
return pos
}
@ -1093,7 +1093,7 @@ func ShowAlert(title, msg string, args ...string) int {
adefaultButton := C.CString(defaultButton)
acancelButton := C.CString(cancelButton)
cbool := C.aShowAlert(atitle, amsg, adefaultButton, acancelButton)
cbool := C.show_alert(atitle, amsg, adefaultButton, acancelButton)
ibool := int(cbool)
defer C.free(unsafe.Pointer(atitle))
@ -1106,7 +1106,7 @@ func ShowAlert(title, msg string, args ...string) int {
// IsValid valid the window
func IsValid() bool {
abool := C.aIsValid()
abool := C.is_valid()
gbool := bool(abool)
// fmt.Println("bool---------", gbool)
return gbool
@ -1114,30 +1114,30 @@ func IsValid() bool {
// SetActive set the window active
func SetActive(win C.MData) {
C.aSetActive(win)
C.set_active(win)
}
// GetActive get the active window
func GetActive() C.MData {
mdata := C.aGetActive()
mdata := C.get_active()
// fmt.Println("active----", mdata)
return mdata
}
// CloseWindow close the window
func CloseWindow() {
C.aCloseWindow()
C.close_window()
}
// SetHandle set the window handle
func SetHandle(hwnd int) {
chwnd := C.uintptr(hwnd)
C.aSetHandle(chwnd)
C.set_handle(chwnd)
}
// GetHandle get the window handle
func GetHandle() int {
hwnd := C.aGetHandle()
hwnd := C.get_handle()
ghwnd := int(hwnd)
// fmt.Println("gethwnd---", ghwnd)
return ghwnd
@ -1145,7 +1145,7 @@ func GetHandle() int {
// GetBHandle get the window handle
func GetBHandle() int {
hwnd := C.bGetHandle()
hwnd := C.bget_handle()
ghwnd := int(hwnd)
//fmt.Println("gethwnd---", ghwnd)
return ghwnd
@ -1153,7 +1153,7 @@ func GetBHandle() int {
// GetTitle get the window title
func GetTitle() string {
title := C.aGetTitle()
title := C.get_title()
gtittle := C.GoString(title)
// fmt.Println("title...", gtittle)
return gtittle
@ -1161,7 +1161,7 @@ func GetTitle() string {
// GetPID get the process id
func GetPID() int {
pid := C.aGetPID()
pid := C.get_PID()
return int(pid)
}

View File

@ -11,38 +11,38 @@
#include "alert_c.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){
int alert = showAlert(title, msg, defaultButton, cancelButton);
return alert;
}
bool aIsValid(){
bool is_valid(){
bool abool = IsValid();
return abool;
}
// int aFindwindow(char* name){
// int find_window(char* name){
// int z = findwindow(name);
// return z;
// }
void aCloseWindow(void){
void close_window(void){
CloseWin();
}
bool aSetHandle(uintptr handle){
bool set_handle(uintptr handle){
bool hwnd = setHandle(handle);
return hwnd;
}
uintptr aGetHandle(){
uintptr get_handle(){
uintptr hwnd = getHandle();
return hwnd;
}
uintptr bGetHandle(){
uintptr bget_handle(){
MData mData = GetActive();
#if defined(IS_MACOSX)
return (uintptr)mData.CgID;
@ -53,7 +53,7 @@ uintptr bGetHandle(){
#endif
}
void aSetActive(const MData win){
void set_active(const MData win){
SetActive(win);
}
@ -70,18 +70,18 @@ void active_PID(uintptr pid){
SetActive(win);
}
MData aGetActive(){
MData get_active(){
MData mdata = GetActive();
return mdata;
}
char* aGetTitle(){
char* get_title(){
char* title = GetTitle();
// printf("title::::%s\n", title );
return title;
}
int32 aGetPID(void){
int32 get_PID(void){
int pid = WGetPID();
return pid;
}