2021-09-03 07:06:58 +12:00
|
|
|
package payload
|
|
|
|
|
2023-01-21 11:08:27 +13:00
|
|
|
import "math"
|
|
|
|
|
2021-09-03 07:06:58 +12:00
|
|
|
const (
|
|
|
|
OP_CURSOR_POSITION = 0x01
|
|
|
|
OP_CURSOR_IMAGE = 0x02
|
2023-01-21 11:08:27 +13:00
|
|
|
OP_PONG = 0x03
|
2021-09-03 07:06:58 +12:00
|
|
|
)
|
|
|
|
|
|
|
|
type CursorPosition struct {
|
|
|
|
Header
|
|
|
|
|
|
|
|
X uint16
|
|
|
|
Y uint16
|
|
|
|
}
|
|
|
|
|
|
|
|
type CursorImage struct {
|
|
|
|
Header
|
|
|
|
|
|
|
|
Width uint16
|
|
|
|
Height uint16
|
|
|
|
Xhot uint16
|
|
|
|
Yhot uint16
|
|
|
|
}
|
2023-01-21 11:08:27 +13:00
|
|
|
|
|
|
|
type Pong struct {
|
|
|
|
Ping
|
|
|
|
|
|
|
|
// server's timestamp split into two uint32
|
|
|
|
ServerTs1 uint32
|
|
|
|
ServerTs2 uint32
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p Pong) ServerTs() uint64 {
|
|
|
|
return (uint64(p.ServerTs1) * uint64(math.MaxUint32)) + uint64(p.ServerTs2)
|
|
|
|
}
|