From 0ebade43f7133357ae718c321f54b1feafc9d930 Mon Sep 17 00:00:00 2001 From: vCaesar Date: Tue, 9 May 2017 21:56:22 +0800 Subject: [PATCH] Format some code --- bitmap/goBitmap.h | 10 +++++----- event/goEvent.h | 42 ++++++++++++++++++++++-------------------- key/goKey.h | 3 +-- mouse/goMouse.h | 8 ++++---- screen/goScreen.h | 4 ++-- window/goWindow.h | 18 +++++++++--------- 6 files changed, 43 insertions(+), 42 deletions(-) diff --git a/bitmap/goBitmap.h b/bitmap/goBitmap.h index 81d3793..b0cf232 100644 --- a/bitmap/goBitmap.h +++ b/bitmap/goBitmap.h @@ -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) { diff --git a/event/goEvent.h b/event/goEvent.h index 7bdee05..099180a 100644 --- a/event/goEvent.h +++ b/event/goEvent.h @@ -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); diff --git a/key/goKey.h b/key/goKey.h index faf9a94..7f3a16a 100644 --- a/key/goKey.h +++ b/key/goKey.h @@ -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; } \ No newline at end of file diff --git a/mouse/goMouse.h b/mouse/goMouse.h index ee7e52b..7a662ca 100644 --- a/mouse/goMouse.h +++ b/mouse/goMouse.h @@ -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; diff --git a/screen/goScreen.h b/screen/goScreen.h index 1a0c97f..f146fb5 100644 --- a/screen/goScreen.h +++ b/screen/goScreen.h @@ -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; diff --git a/window/goWindow.h b/window/goWindow.h index eaeae26..dbd9682 100644 --- a/window/goWindow.h +++ b/window/goWindow.h @@ -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; }