diff --git a/event/goEvent.h b/event/goEvent.h index 91786ac..850670f 100644 --- a/event/goEvent.h +++ b/event/goEvent.h @@ -30,30 +30,38 @@ void dispatch_proc(iohook_event * const event) { case EVENT_KEY_PRESSED: // If the escape key is pressed, naturally terminate the program. if (event->data.keyboard.keycode == VC_ESCAPE) { - int status = hook_stop(); - switch (status) { - // System level errors. - case IOHOOK_ERROR_OUT_OF_MEMORY: - loggerProc(LOG_LEVEL_ERROR, "Failed to allocate memory. (%#X)", status); - break; + // int status = hook_stop(); + // switch (status) { + // // System level errors. + // case IOHOOK_ERROR_OUT_OF_MEMORY: + // loggerProc(LOG_LEVEL_ERROR, "Failed to allocate memory. (%#X)", status); + // break; - case IOHOOK_ERROR_X_RECORD_GET_CONTEXT: - // NOTE This is the only platform specific error that occurs on hook_stop(). - loggerProc(LOG_LEVEL_ERROR, "Failed to get XRecord context. (%#X)", status); - break; + // case IOHOOK_ERROR_X_RECORD_GET_CONTEXT: + // // NOTE This is the only platform specific error that occurs on hook_stop(). + // loggerProc(LOG_LEVEL_ERROR, "Failed to get XRecord context. (%#X)", status); + // break; - // Default error. - case IOHOOK_FAILURE: - default: - loggerProc(LOG_LEVEL_ERROR, "An unknown hook error occurred. (%#X)", status); - break; - } + // // Default error. + // case IOHOOK_FAILURE: + // default: + // loggerProc(LOG_LEVEL_ERROR, "An unknown hook error occurred. (%#X)", status); + // break; + // } } case EVENT_KEY_RELEASED: 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; + + if (event->data.keyboard.keycode == VC_ESCAPE + && atoi(cevent) == 11) { + int stopEvent = stop_event(); + // printf("stop_event%d\n", stopEvent); + cstatus = 0; + } + // printf("atoi(str)---%d\n", atoi(cevent)); if (akeyCode == atoi(cevent)){ int stopEvent = stop_event(); diff --git a/robotgo.go b/robotgo.go index c6a477f..4d74f62 100644 --- a/robotgo.go +++ b/robotgo.go @@ -1111,6 +1111,7 @@ func AddEvent(aeve string) int { "f11": "69", "f12": "70", // more + "esc": "11", "tab": "15", "ctrl": "29", "control": "29",