From 4e658a44067ca3562de0ed25c145d3b837ad2ae4 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Wed, 27 Feb 2019 09:59:41 -0400 Subject: [PATCH] update rotation to int32 Fixed sometimes json.Unmarshal break --- event/dispatch_proc.h | 2 +- hook.go | 2 +- hook/iohook.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/event/dispatch_proc.h b/event/dispatch_proc.h index a598b21..15ef19a 100644 --- a/event/dispatch_proc.h +++ b/event/dispatch_proc.h @@ -52,7 +52,7 @@ void dispatch_proc(iohook_event * const event) { break; case EVENT_MOUSE_WHEEL: sprintf(buffer, - "{\"id\":%i,\"time\":%" PRIu64 ",\"mask\":%hu,\"reserved\":%hu,\"clicks\":%hu,\"x\":%hd,\"y\":%hd,\"type\":%d,\"ammount\":%hu,\"rotation\":%hu,\"direction\":%d}", + "{\"id\":%i,\"time\":%" PRIu64 ",\"mask\":%hu,\"reserved\":%hu,\"clicks\":%hu,\"x\":%hd,\"y\":%hd,\"type\":%d,\"ammount\":%hu,\"rotation\":%d,\"direction\":%d}", event->type, event->time, event->mask, event->reserved, event->data.wheel.clicks, event->data.wheel.x, diff --git a/hook.go b/hook.go index 86316ba..00927b4 100644 --- a/hook.go +++ b/hook.go @@ -76,7 +76,7 @@ type Event struct { Y int16 `json:"y"` Amount uint16 `json:"amount"` - Rotation int16 `json:"rotation"` + Rotation int32 `json:"rotation"` Direction uint8 `json:"direction"` } diff --git a/hook/iohook.h b/hook/iohook.h index e135ba6..6fd3471 100644 --- a/hook/iohook.h +++ b/hook/iohook.h @@ -103,7 +103,8 @@ typedef struct _mouse_wheel_event_data { int16_t y; uint8_t type; uint16_t amount; - int16_t rotation; + int32_t rotation; + // int16_t rotation; uint8_t direction; } mouse_wheel_event_data;