mirror of
https://github.com/robotn/gohook.git
synced 2024-11-24 21:36:50 +08:00
fixed c99 func and update code style
This commit is contained in:
parent
a2f711c144
commit
8d5c932532
@ -49,7 +49,7 @@ int cstatus = 1;
|
|||||||
int event_status;
|
int event_status;
|
||||||
int rrevent;
|
int rrevent;
|
||||||
|
|
||||||
int add(dispatcher_t dispatch);
|
int add_hook(dispatcher_t dispatch);
|
||||||
void add_event_async();
|
void add_event_async();
|
||||||
int add_event(char *key_event);
|
int add_event(char *key_event);
|
||||||
int stop_event();
|
int stop_event();
|
||||||
|
24
hook.go
24
hook.go
@ -96,28 +96,36 @@ func (e Event) String() string {
|
|||||||
return fmt.Sprintf("%v - Event: {Kind: KeyUp, Rawcode: %v, Keychar: %v}",
|
return fmt.Sprintf("%v - Event: {Kind: KeyUp, Rawcode: %v, Keychar: %v}",
|
||||||
e.When, e.Rawcode, e.Keychar)
|
e.When, e.Rawcode, e.Keychar)
|
||||||
case KeyHold:
|
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)
|
e.When, e.Rawcode, e.Keychar)
|
||||||
case KeyDown:
|
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)
|
e.When, e.Rawcode, e.Keychar)
|
||||||
case MouseUp:
|
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)
|
e.When, e.Button, e.X, e.Y, e.Clicks)
|
||||||
case MouseHold:
|
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)
|
e.When, e.Button, e.X, e.Y, e.Clicks)
|
||||||
case MouseDown:
|
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)
|
e.When, e.Button, e.X, e.Y, e.Clicks)
|
||||||
case MouseMove:
|
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)
|
e.When, e.Button, e.X, e.Y, e.Clicks)
|
||||||
case MouseDrag:
|
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)
|
e.When, e.Button, e.X, e.Y, e.Clicks)
|
||||||
case MouseWheel:
|
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)
|
e.When, e.Amount, e.Rotation, e.Direction)
|
||||||
case FakeEvent:
|
case FakeEvent:
|
||||||
return fmt.Sprintf("%v - Event: {Kind: FakeEvent}", e.When)
|
return fmt.Sprintf("%v - Event: {Kind: FakeEvent}", e.When)
|
||||||
|
Loading…
Reference in New Issue
Block a user