From 482d465472a4e39d7ec6600c11e6743376d91da7 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Sat, 7 Jul 2018 23:01:55 +0800 Subject: [PATCH] update code style --- event/goEvent.h | 18 +++++++++--------- key/goKey.h | 41 +++++++++++++++++++++-------------------- mouse/goMouse.h | 2 +- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/event/goEvent.h b/event/goEvent.h index 850670f..ba4d118 100644 --- a/event/goEvent.h +++ b/event/goEvent.h @@ -63,7 +63,7 @@ void dispatch_proc(iohook_event * const event) { } // printf("atoi(str)---%d\n", atoi(cevent)); - if (akeyCode == atoi(cevent)){ + if (akeyCode == atoi(cevent)) { int stopEvent = stop_event(); // printf("%d\n", stopEvent); cstatus = 0; @@ -88,7 +88,7 @@ void dispatch_proc(iohook_event * const event) { free (buf); #endif - if (strcmp(buf, cevent) == 0){ + if (strcmp(buf, cevent) == 0) { int stopEvent = stop_event(); // printf("%d\n", stopEvent); cstatus = 0; @@ -110,25 +110,25 @@ 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){ + if (abutton == amouse && aclicks == 1) { int stopEvent = stop_event(); cstatus = 0; } diff --git a/key/goKey.h b/key/goKey.h index c4ec351..003883c 100644 --- a/key/goKey.h +++ b/key/goKey.h @@ -104,7 +104,7 @@ struct KeyNames{ int CheckKeyCodes(char* k, MMKeyCode *key){ if (!key) { return -1; } - if (strlen(k) == 1){ + if (strlen(k) == 1) { *key = keyCodeForChar(*k); return 0; } @@ -120,7 +120,7 @@ int CheckKeyCodes(char* k, MMKeyCode *key){ kn++; } - if (*key == K_NOT_A_KEY){ + if (*key == K_NOT_A_KEY) { return -2; } @@ -130,19 +130,19 @@ int CheckKeyCodes(char* k, MMKeyCode *key){ int CheckKeyFlags(char* f, MMKeyFlags* flags){ if (!flags) { return -1; } - if (strcmp(f, "alt") == 0){ + if (strcmp(f, "alt") == 0) { *flags = MOD_ALT; } - else if(strcmp(f, "command") == 0){ + else if(strcmp(f, "command") == 0) { *flags = MOD_META; } - else if(strcmp(f, "control") == 0){ + else if(strcmp(f, "control") == 0) { *flags = MOD_CONTROL; } - else if(strcmp(f, "shift") == 0){ + else if(strcmp(f, "shift") == 0) { *flags = MOD_SHIFT; } - else if(strcmp(f, "none") == 0){ + else if(strcmp(f, "none") == 0) { *flags = (MMKeyFlags) MOD_NONE; } else { return -2; @@ -153,6 +153,7 @@ int CheckKeyFlags(char* f, MMKeyFlags* flags){ int GetFlagsFromValue(char* value[], MMKeyFlags* flags, int num){ if (!flags) {return -1;} + int i; for ( i= 0; i