diff --git a/internal/types/message/messages.go b/internal/types/message/messages.go index f220e8cd..a3b9ba4b 100644 --- a/internal/types/message/messages.go +++ b/internal/types/message/messages.go @@ -20,6 +20,7 @@ type SystemInit struct { ScreenSize ScreenSize `json:"screen_size"` Members map[string]MemberData `json:"members"` ImplicitHosting bool `json:"implicit_hosting"` + CursorImage *CursorImage `json:"cursor_image"` } type SystemAdmin struct { diff --git a/internal/websocket/handler/system.go b/internal/websocket/handler/system.go index 08802081..4f08831d 100644 --- a/internal/websocket/handler/system.go +++ b/internal/websocket/handler/system.go @@ -4,6 +4,7 @@ import ( "demodesk/neko/internal/types" "demodesk/neko/internal/types/event" "demodesk/neko/internal/types/message" + "demodesk/neko/internal/utils" ) func (h *MessageHandlerCtx) systemInit(session types.Session) error { @@ -32,6 +33,20 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error { } } + var cursorImage *message.CursorImage + cur := h.desktop.GetCursorImage() + uri, err := utils.GetCursorImageURI(cur) + if err == nil { + cursorImage = &message.CursorImage{ + Event: event.CURSOR_IMAGE, + Uri: uri, + Width: cur.Width, + Height: cur.Height, + X: cur.Xhot, + Y: cur.Yhot, + } + } + return session.Send( message.SystemInit{ Event: event.SYSTEM_INIT, @@ -44,6 +59,7 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error { }, Members: members, ImplicitHosting: h.sessions.ImplicitHosting(), + CursorImage: cursorImage, }) }