cursor Image on connect.

This commit is contained in:
Miroslav Šedivý 2021-01-10 12:42:07 +01:00
parent 589628f6ca
commit a7d4511037
2 changed files with 17 additions and 0 deletions

View File

@ -20,6 +20,7 @@ type SystemInit struct {
ScreenSize ScreenSize `json:"screen_size"` ScreenSize ScreenSize `json:"screen_size"`
Members map[string]MemberData `json:"members"` Members map[string]MemberData `json:"members"`
ImplicitHosting bool `json:"implicit_hosting"` ImplicitHosting bool `json:"implicit_hosting"`
CursorImage *CursorImage `json:"cursor_image"`
} }
type SystemAdmin struct { type SystemAdmin struct {

View File

@ -4,6 +4,7 @@ import (
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/types/event" "demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message" "demodesk/neko/internal/types/message"
"demodesk/neko/internal/utils"
) )
func (h *MessageHandlerCtx) systemInit(session types.Session) error { 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( return session.Send(
message.SystemInit{ message.SystemInit{
Event: event.SYSTEM_INIT, Event: event.SYSTEM_INIT,
@ -44,6 +59,7 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error {
}, },
Members: members, Members: members,
ImplicitHosting: h.sessions.ImplicitHosting(), ImplicitHosting: h.sessions.ImplicitHosting(),
CursorImage: cursorImage,
}) })
} }