From 8d5c93253274de95c0fa6d4921f4c1e87c0f19ae Mon Sep 17 00:00:00 2001 From: vcaesar Date: Thu, 21 Feb 2019 09:10:31 -0400 Subject: [PATCH] fixed c99 func and update code style --- event/pub.h | 2 +- hook.go | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/event/pub.h b/event/pub.h index 3aa7529..80a76d9 100644 --- a/event/pub.h +++ b/event/pub.h @@ -49,7 +49,7 @@ int cstatus = 1; int event_status; int rrevent; -int add(dispatcher_t dispatch); +int add_hook(dispatcher_t dispatch); void add_event_async(); int add_event(char *key_event); int stop_event(); diff --git a/hook.go b/hook.go index 3cdb57f..86316ba 100644 --- a/hook.go +++ b/hook.go @@ -96,28 +96,36 @@ func (e Event) String() string { return fmt.Sprintf("%v - Event: {Kind: KeyUp, Rawcode: %v, Keychar: %v}", e.When, e.Rawcode, e.Keychar) case KeyHold: - return fmt.Sprintf("%v - Event: {Kind: KeyHold, Rawcode: %v, Keychar: %v}", + return fmt.Sprintf( + "%v - Event: {Kind: KeyHold, Rawcode: %v, Keychar: %v}", e.When, e.Rawcode, e.Keychar) case KeyDown: - return fmt.Sprintf("%v - Event: {Kind: KeyDown, Rawcode: %v, Keychar: %v}", + return fmt.Sprintf( + "%v - Event: {Kind: KeyDown, Rawcode: %v, Keychar: %v}", e.When, e.Rawcode, e.Keychar) case MouseUp: - return fmt.Sprintf("%v - Event: {Kind: MouseUp, Button: %v, X: %v, Y: %v, Clicks: %v}", + return fmt.Sprintf( + "%v - Event: {Kind: MouseUp, Button: %v, X: %v, Y: %v, Clicks: %v}", e.When, e.Button, e.X, e.Y, e.Clicks) case MouseHold: - return fmt.Sprintf("%v - Event: {Kind: MouseHold, Button: %v, X: %v, Y: %v, Clicks: %v}", + return fmt.Sprintf( + "%v - Event: {Kind: MouseHold, Button: %v, X: %v, Y: %v, Clicks: %v}", e.When, e.Button, e.X, e.Y, e.Clicks) case MouseDown: - return fmt.Sprintf("%v - Event: {Kind: MouseDown, Button: %v, X: %v, Y: %v, Clicks: %v}", + return fmt.Sprintf( + "%v - Event: {Kind: MouseDown, Button: %v, X: %v, Y: %v, Clicks: %v}", e.When, e.Button, e.X, e.Y, e.Clicks) case MouseMove: - return fmt.Sprintf("%v - Event: {Kind: MouseMove, Button: %v, X: %v, Y: %v, Clicks: %v}", + return fmt.Sprintf( + "%v - Event: {Kind: MouseMove, Button: %v, X: %v, Y: %v, Clicks: %v}", e.When, e.Button, e.X, e.Y, e.Clicks) case MouseDrag: - return fmt.Sprintf("%v - Event: {Kind: MouseDrag, Button: %v, X: %v, Y: %v, Clicks: %v}", + return fmt.Sprintf( + "%v - Event: {Kind: MouseDrag, Button: %v, X: %v, Y: %v, Clicks: %v}", e.When, e.Button, e.X, e.Y, e.Clicks) case MouseWheel: - return fmt.Sprintf("%v - Event: {Kind: MouseWheel, Amount: %v, Rotation: %v, Direction: %v}", + return fmt.Sprintf( + "%v - Event: {Kind: MouseWheel, Amount: %v, Rotation: %v, Direction: %v}", e.When, e.Amount, e.Rotation, e.Direction) case FakeEvent: return fmt.Sprintf("%v - Event: {Kind: FakeEvent}", e.When)