mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
cursor image as WS event.
This commit is contained in:
parent
9782b8391d
commit
589628f6ca
@ -44,6 +44,10 @@ const (
|
|||||||
KEYBOARD_LAYOUT = "keyboard/layout"
|
KEYBOARD_LAYOUT = "keyboard/layout"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
CURSOR_IMAGE = "cursor/image"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
BORADCAST_STATUS = "broadcast/status"
|
BORADCAST_STATUS = "broadcast/status"
|
||||||
)
|
)
|
||||||
|
@ -143,6 +143,19 @@ type KeyboardLayout struct {
|
|||||||
Layout string `json:"layout"`
|
Layout string `json:"layout"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
// Cursor
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
|
type CursorImage struct {
|
||||||
|
Event string `json:"event,omitempty"`
|
||||||
|
Uri string `json:"uri"`
|
||||||
|
Width uint16 `json:"width"`
|
||||||
|
Height uint16 `json:"height"`
|
||||||
|
X uint16 `json:"x"`
|
||||||
|
Y uint16 `json:"y"`
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Broadcast
|
// Broadcast
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
@ -118,15 +118,14 @@ func (ws *WebSocketManagerCtx) Start() {
|
|||||||
if cursor != cur.Serial || cur.Serial == 0 {
|
if cursor != cur.Serial || cur.Serial == 0 {
|
||||||
cursor = cur.Serial
|
cursor = cur.Serial
|
||||||
|
|
||||||
// TODO: Refactor.
|
|
||||||
uri, _ := utils.GetCursorImageURI(cur)
|
uri, _ := utils.GetCursorImageURI(cur)
|
||||||
ws.sessions.Broadcast(message.Message{
|
ws.sessions.Broadcast(message.CursorImage{
|
||||||
Event: "cursor/image",
|
Event: event.CURSOR_IMAGE,
|
||||||
Payload: struct{
|
Uri: uri,
|
||||||
Xhot uint16
|
Width: cur.Width,
|
||||||
Yhot uint16
|
Height: cur.Height,
|
||||||
Uri string
|
X: cur.Xhot,
|
||||||
}{ cur.Xhot, cur.Yhot, uri },
|
Y: cur.Yhot,
|
||||||
}, nil)
|
}, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user