Format some code

This commit is contained in:
vCaesar 2017-05-09 21:56:22 +08:00
parent 52479b6e13
commit 0ebade43f7
6 changed files with 43 additions and 42 deletions

View File

@ -30,15 +30,15 @@
MMPoint aFindBitmap(MMBitmapRef bit_map,MMRect rect){
// MMRect rect;
// rect.size.width=10;
// rect.size.height=20;
// rect.origin.x=10;
// rect.origin.y=20;
// rect.size.width = 10;
// rect.size.height = 20;
// rect.origin.x = 10;
// rect.origin.y = 20;
float tolerance = 0.0f;
MMPoint point;
tolerance=0.5;
tolerance = 0.5;
if (findBitmapInRect(bit_map, bit_map, &point,
rect, tolerance) == 0) {

View File

@ -89,7 +89,7 @@ typedef struct _MEvent MEvent;
// typedef MMBitmap *MMBitmapRef;
char *cevent;
// uint16_t *cevent;
int cstatus=1;
int cstatus = 1;
MEvent mEvent;
void dispatch_proc(iohook_event * const event) {
@ -125,12 +125,12 @@ void dispatch_proc(iohook_event * const event) {
snprintf(buffer + length, sizeof(buffer) - length,
",keycode=%u,rawcode=0x%X",
event->data.keyboard.keycode, event->data.keyboard.rawcode);
int akeycode=(uint16_t) event->data.keyboard.keycode;
int akeycode = (uint16_t) event->data.keyboard.keycode;
// printf("atoi(str)---%d\n", atoi(cevent));
if (akeycode==atoi(cevent)){
int astop=aStop();
if (akeycode == atoi(cevent)){
int astop = aStop();
// printf("%d\n",astop);
cstatus=0;
cstatus = 0;
}
break;
@ -153,9 +153,9 @@ void dispatch_proc(iohook_event * const event) {
#endif
if (strcmp(buf, cevent) == 0){
int astop=aStop();
int astop = aStop();
// printf("%d\n",astop);
cstatus=0;
cstatus = 0;
}
// return (char*) event->data.keyboard.keychar;
break;
@ -169,30 +169,32 @@ void dispatch_proc(iohook_event * const event) {
",x=%i,y=%i,button=%i,clicks=%i",
event->data.mouse.x, event->data.mouse.y,
event->data.mouse.button, event->data.mouse.clicks);
int abutton=event->data.mouse.button;
int aclicks=event->data.mouse.clicks;
int amouse=-1;
int abutton = event->data.mouse.button;
int aclicks = event->data.mouse.clicks;
int amouse = -1;
if (strcmp(cevent,"mleft") == 0){
amouse=1;
amouse = 1;
}
if (strcmp(cevent,"mright") == 0){
amouse=2;
amouse = 2;
}
if (strcmp(cevent,"wheelDown") == 0){
amouse=4;
amouse = 4;
}
if (strcmp(cevent,"wheelUp") == 0){
amouse=5;
amouse = 5;
}
if (strcmp(cevent,"wheelLeft") == 0){
amouse=6;
amouse = 6;
}
if (strcmp(cevent,"wheelRight") == 0){
amouse=7;
amouse = 7;
}
if (abutton==amouse && aclicks==1){
int astop=aStop();
cstatus=0;
if (abutton == amouse && aclicks == 1){
int astop = aStop();
cstatus = 0;
}
break;
@ -213,7 +215,7 @@ void dispatch_proc(iohook_event * const event) {
int aEvent(char *aevent) {
// (uint16_t *)
cevent=aevent;
cevent = aevent;
// Set the logger callback for library output.
hookSetlogger(&loggerProc);

View File

@ -318,10 +318,9 @@ void aTypeString(char *str){
}
void aTypeStringDelayed(char *str,size_t cpm){
typeStringDelayed(str, cpm);
}
void aSetKeyboardDelay(size_t val){
keyboardDelay =val;
keyboardDelay = val;
}

View File

@ -41,8 +41,8 @@ int mouseDelay = 10;
int aMoveMouse(size_t x, size_t y){
MMPoint point;
//int x =103;
//int y =104;
//int x = 103;
//int y = 104;
point = MMPointMake(x, y);
moveMouse(point);
@ -50,8 +50,8 @@ int aMoveMouse(size_t x, size_t y){
}
int aDragMouse(size_t x, size_t y){
// const size_t x=10;
// const size_t y=20;
// const size_t x = 10;
// const size_t y = 20;
MMMouseButton button = LEFT_BUTTON;
MMPoint point;

View File

@ -44,7 +44,7 @@ char* aGetPixelColor(size_t x, size_t y){
// return 0;
char* s=(char*)calloc(100,sizeof(char*));
char* s = (char*)calloc(100,sizeof(char*));
if(s)strcpy(s,hex);
return s;
@ -68,7 +68,7 @@ char* aSetXDisplayName(char* name){
char* aGetXDisplayName(){
#if defined(USE_X11)
const char* display = getXDisplay();
char* sd=(char*)calloc(100,sizeof(char*));
char* sd = (char*)calloc(100,sizeof(char*));
if(sd)strcpy(sd,display);
return sd;

View File

@ -13,18 +13,18 @@
int aShowAlert(const char *title, const char *msg, const char *defaultButton,
const char *cancelButton){
int alert=showAlert(title,msg,defaultButton,cancelButton);
int alert = showAlert(title,msg,defaultButton,cancelButton);
return alert;
}
bool aIsValid(){
bool abool=IsValid();
bool abool = IsValid();
return abool;
}
// int aFindwindow(char* name){
// int z=findwindow(name);
// int z = findwindow(name);
// return z;
// }
@ -33,17 +33,17 @@ void aCloseWindow(void){
}
bool aSetHandle (uintptr handle){
bool hwnd=setHandle(handle);
bool hwnd = setHandle(handle);
return hwnd;
}
uintptr aGetHandle(){
uintptr hwnd=getHandle();
uintptr hwnd = getHandle();
return hwnd;
}
uintptr bGetHandle(){
MData mData=GetActive();
MData mData = GetActive();
#if defined(IS_MACOSX)
return (uintptr)mData.CgID;
#elif defined(USE_X11)
@ -58,17 +58,17 @@ void aSetActive(const MData win){
}
MData aGetActive(){
MData mdata=GetActive();
MData mdata = GetActive();
return mdata;
}
char* aGetTitle(){
char* title=GetTitle();
char* title = GetTitle();
// printf("title::::%s\n",title );
return title;
}
int32 aGetPID(void){
int pid=WGetPID();
int pid = WGetPID();
return pid;
}