cursor image as WS event.

This commit is contained in:
Miroslav Šedivý 2021-01-10 12:37:32 +01:00
parent 9782b8391d
commit 589628f6ca
3 changed files with 24 additions and 8 deletions

View file

@ -118,15 +118,14 @@ func (ws *WebSocketManagerCtx) Start() {
if cursor != cur.Serial || cur.Serial == 0 {
cursor = cur.Serial
// TODO: Refactor.
uri, _ := utils.GetCursorImageURI(cur)
ws.sessions.Broadcast(message.Message{
Event: "cursor/image",
Payload: struct{
Xhot uint16
Yhot uint16
Uri string
}{ cur.Xhot, cur.Yhot, uri },
ws.sessions.Broadcast(message.CursorImage{
Event: event.CURSOR_IMAGE,
Uri: uri,
Width: cur.Width,
Height: cur.Height,
X: cur.Xhot,
Y: cur.Yhot,
}, nil)
}