diff options
author | Mathias Fredriksson <mafredri@gmail.com> | 2022-02-08 23:50:49 +0200 |
---|---|---|
committer | Mathias Fredriksson <mafredri@gmail.com> | 2022-02-08 23:51:02 +0200 |
commit | 2bf53f0397f16ee0367be99373b57dadf1742195 (patch) | |
tree | 3669265f12b38742d86ef53a2d8f7f19096ea4ee /m4p/message.go | |
parent | eb2617ac12b2432e8d8d22c7cae64b887d1c70e5 (diff) |
Add support for mouse click and scroll wheel
Requires the webos client to have support for these events, see:
https://github.com/Wouterdek/magic4pc/pull/10
Diffstat (limited to 'm4p/message.go')
-rw-r--r-- | m4p/message.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/m4p/message.go b/m4p/message.go index 34a9383..0a9ebeb 100644 --- a/m4p/message.go +++ b/m4p/message.go @@ -13,6 +13,8 @@ const ( SubSensorMessage MessageType = "sub_sensor" RemoteUpdateMessage MessageType = "remote_update" InputMessage MessageType = "input" + MouseMessage MessageType = "mouse" + WheelMessage MessageType = "wheel" KeepAliveMessage MessageType = "keepalive" ) @@ -24,6 +26,8 @@ type Message struct { *Register *RemoteUpdate *Input + Mouse Mouse `json:"mouse"` + Wheel Wheel `json:"wheel"` } // NewMessage initializes a message with the type and protocol version. @@ -62,10 +66,24 @@ type RemoteUpdate struct { Payload []byte `json:"payload"` } +type Coordinates struct { + X int32 `json:"x"` + Y int32 `json:"y"` +} + +type Mouse struct { + Type string `json:"type"` // mousedown, mouseup + Coordinates +} + +type Wheel struct { + Delta int32 `json:"delta"` + Coordinates +} + // type ( // ReturnValue uint8 // DeviceID uint8 -// Coordinates struct{ X, Y int32 } // Gyroscope struct{ X, Y, Z float32 } // Acceleration struct{ X, Y, Z float32 } // Quaternion struct{ Q0, Q1, Q2, Q3 float32 } |