From 9298b9bc179cf1b0d58888e0613a2ce9f92ab6af Mon Sep 17 00:00:00 2001 From: vCaesar Date: Wed, 10 May 2017 13:50:28 +0800 Subject: [PATCH] Format some code --- bitmap/goBitmap.h | 6 +++--- event/goEvent.h | 12 ++++++------ key/goKey.h | 22 +++++++++++----------- mouse/goMouse.h | 8 ++++---- screen/goScreen.h | 10 +++++----- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/bitmap/goBitmap.h b/bitmap/goBitmap.h index b0cf232..72a0c11 100644 --- a/bitmap/goBitmap.h +++ b/bitmap/goBitmap.h @@ -28,7 +28,7 @@ #include #include -MMPoint aFindBitmap(MMBitmapRef bit_map,MMRect rect){ +MMPoint aFindBitmap(MMBitmapRef bit_map, MMRect rect){ // MMRect rect; // rect.size.width = 10; // rect.size.height = 20; @@ -47,7 +47,7 @@ MMPoint aFindBitmap(MMBitmapRef bit_map,MMRect rect){ return point; } -MMBitmapRef aOpenBitmap(char *path ,uint16_t ttype){ +MMBitmapRef aOpenBitmap(char *path, uint16_t ttype){ // MMImageType type; MMBitmapRef bitmap; @@ -59,7 +59,7 @@ MMBitmapRef aOpenBitmap(char *path ,uint16_t ttype){ } -char *aSaveBitmap(MMBitmapRef bitmap,char *path, uint16_t type){ +char *aSaveBitmap(MMBitmapRef bitmap, char *path, uint16_t type){ if (saveMMBitmapToFile(bitmap, path,(MMImageType) type) != 0) { return "Could not save image to file."; }else{ diff --git a/event/goEvent.h b/event/goEvent.h index 099180a..9be88e6 100644 --- a/event/goEvent.h +++ b/event/goEvent.h @@ -174,22 +174,22 @@ void dispatch_proc(iohook_event * const event) { int aclicks = event->data.mouse.clicks; int amouse = -1; - if (strcmp(cevent,"mleft") == 0){ + if (strcmp(cevent, "mleft") == 0){ amouse = 1; } - if (strcmp(cevent,"mright") == 0){ + if (strcmp(cevent, "mright") == 0){ amouse = 2; } - if (strcmp(cevent,"wheelDown") == 0){ + if (strcmp(cevent, "wheelDown") == 0){ amouse = 4; } - if (strcmp(cevent,"wheelUp") == 0){ + if (strcmp(cevent, "wheelUp") == 0){ amouse = 5; } - if (strcmp(cevent,"wheelLeft") == 0){ + if (strcmp(cevent, "wheelLeft") == 0){ amouse = 6; } - if (strcmp(cevent,"wheelRight") == 0){ + if (strcmp(cevent, "wheelRight") == 0){ amouse = 7; } if (abutton == amouse && aclicks == 1){ diff --git a/key/goKey.h b/key/goKey.h index 7f3a16a..998b5df 100644 --- a/key/goKey.h +++ b/key/goKey.h @@ -179,12 +179,12 @@ int GetFlagsFromValue(char* value[], MMKeyFlags* flags,int num){ } // If it's not an array, it should be a single string value. -char* aKey_Tap(char *k,char* keyarr[],int num){ +char* aKey_Tap(char *k, char* keyarr[], int num){ MMKeyFlags flags = MOD_NONE; // MMKeyFlags flags = 0; MMKeyCode key; - switch(GetFlagsFromValue(keyarr,&flags,num)){ + switch(GetFlagsFromValue(keyarr, &flags, num)){ // switch (CheckKeyFlags(akey,&flags)){ case -1: return "Null pointer in key flag."; @@ -209,7 +209,7 @@ char* aKey_Tap(char *k,char* keyarr[],int num){ return "0"; } -char* aKeyTap(char *k,char *akey,char *akeyt){ +char* aKeyTap(char *k, char *akey, char *akeyt){ MMKeyFlags flags = (MMKeyFlags) MOD_NONE; // MMKeyFlags flags = 0; MMKeyCode key; @@ -218,7 +218,7 @@ char* aKeyTap(char *k,char *akey,char *akeyt){ // k = *kstr; if (strcmp(akey, "null") != 0){ if (strcmp(akeyt, "null") == 0){ - switch (CheckKeyFlags(akey,&flags)){ + switch (CheckKeyFlags(akey, &flags)){ case -1: return "Null pointer in key flag."; break; @@ -227,8 +227,8 @@ char* aKeyTap(char *k,char *akey,char *akeyt){ break; } }else{ - char* akeyarr[2] = {akey,akeyt}; - switch(GetFlagsFromValue(akeyarr,&flags,2)){ + char* akeyarr[2] = {akey, akeyt}; + switch(GetFlagsFromValue(akeyarr, &flags, 2)){ case -1: return "Null pointer in key flag."; break; @@ -254,7 +254,7 @@ char* aKeyTap(char *k,char *akey,char *akeyt){ return "0"; } -char* aKeyToggle(char *k,char *d,char *akey,char *akeyt){ +char* aKeyToggle(char *k, char *d, char *akey, char *akeyt){ MMKeyFlags flags = (MMKeyFlags) MOD_NONE; MMKeyCode key; @@ -276,7 +276,7 @@ char* aKeyToggle(char *k,char *d,char *akey,char *akeyt){ if (strcmp(akey, "null") != 0){ if (strcmp(akeyt, "null") == 0){ - switch (CheckKeyFlags(akey,&flags)){ + switch (CheckKeyFlags(akey, &flags)){ case -1: return "Null pointer in key flag."; break; @@ -285,8 +285,8 @@ char* aKeyToggle(char *k,char *d,char *akey,char *akeyt){ break; } }else{ - char* akeyarr[2] = {akey,akeyt}; - switch (GetFlagsFromValue(akeyarr, &flags,2)) + char* akeyarr[2] = {akey, akeyt}; + switch (GetFlagsFromValue(akeyarr, &flags, 2)) { case -1: return "Null pointer in key flag."; @@ -317,7 +317,7 @@ void aTypeString(char *str){ typeString(str); } -void aTypeStringDelayed(char *str,size_t cpm){ +void aTypeStringDelayed(char *str, size_t cpm){ typeStringDelayed(str, cpm); } diff --git a/mouse/goMouse.h b/mouse/goMouse.h index 7a662ca..c545d59 100644 --- a/mouse/goMouse.h +++ b/mouse/goMouse.h @@ -63,7 +63,7 @@ int aDragMouse(size_t x, size_t y){ return 0; } -int aMoveMouseSmooth(size_t x, size_t y,double lowSpeed,double highSpeed){ +int aMoveMouseSmooth(size_t x, size_t y, double lowSpeed, double highSpeed){ MMPoint point; point = MMPointMake(x, y); smoothlyMoveMouse(point, lowSpeed, highSpeed); @@ -81,7 +81,7 @@ MMPoint aGetMousePos(){ return pos; } -int aMouseClick(MMMouseButton button,bool doubleC){ +int aMouseClick(MMMouseButton button, bool doubleC){ // MMMouseButton button = LEFT_BUTTON; // bool doubleC = false; @@ -96,7 +96,7 @@ int aMouseClick(MMMouseButton button,bool doubleC){ return 0; } -int aMouseToggle(char* d,MMMouseButton button){ +int aMouseToggle(char* d, MMMouseButton button){ // MMMouseButton button = LEFT_BUTTON; bool down = false; if (strcmp(d, "down") == 0){ @@ -119,7 +119,7 @@ int aSetMouseDelay(size_t val){ return 0; } -int aScrollMouse(size_t scrollMagnitude,char *s){ +int aScrollMouse(size_t scrollMagnitude, char *s){ // int scrollMagnitude = 20; MMMouseWheelDirection scrollDirection; diff --git a/screen/goScreen.h b/screen/goScreen.h index f146fb5..4439c97 100644 --- a/screen/goScreen.h +++ b/screen/goScreen.h @@ -44,8 +44,8 @@ char* aGetPixelColor(size_t x, size_t y){ // return 0; - char* s = (char*)calloc(100,sizeof(char*)); - if(s)strcpy(s,hex); + char* s = (char*)calloc(100, sizeof(char*)); + if(s)strcpy(s, hex); return s; } @@ -68,8 +68,8 @@ char* aSetXDisplayName(char* name){ char* aGetXDisplayName(){ #if defined(USE_X11) const char* display = getXDisplay(); - char* sd = (char*)calloc(100,sizeof(char*)); - if(sd)strcpy(sd,display); + char* sd = (char*)calloc(100, sizeof(char*)); + if(sd)strcpy(sd, display); return sd; #else @@ -77,7 +77,7 @@ char* aGetXDisplayName(){ #endif } -MMBitmapRef aCaptureScreen(size_t x,size_t y,size_t w,size_t h){ +MMBitmapRef aCaptureScreen(size_t x, size_t y, size_t w, size_t h){ // if (){ // x = 0; // y = 0;