37 lines
864 B
Go
Raw Normal View History

2020-11-30 17:45:53 +01:00
package handler
import (
"demodesk/neko/internal/types"
"demodesk/neko/internal/types/message"
)
2021-01-15 16:53:03 +01:00
func (h *MessageHandlerCtx) keyboardMap(session types.Session, payload *message.KeyboardMap) error {
2021-08-29 18:23:58 +02:00
logger := h.logger.With().Str("session_id", session.ID()).Logger()
2020-11-30 17:45:53 +01:00
if !session.IsHost() {
2021-08-29 18:23:58 +02:00
logger.Debug().Msg("is not the host")
2020-11-30 17:45:53 +01:00
return nil
}
2021-01-15 16:53:03 +01:00
return h.desktop.SetKeyboardMap(types.KeyboardMap{
2021-02-14 14:40:17 +01:00
Layout: payload.Layout,
2021-01-15 16:53:03 +01:00
Variant: payload.Variant,
})
2020-11-30 17:45:53 +01:00
}
func (h *MessageHandlerCtx) keyboardModifiers(session types.Session, payload *message.KeyboardModifiers) error {
2021-08-29 18:23:58 +02:00
logger := h.logger.With().Str("session_id", session.ID()).Logger()
2020-11-30 17:45:53 +01:00
if !session.IsHost() {
2021-08-29 18:23:58 +02:00
logger.Debug().Msg("is not the host")
2020-11-30 17:45:53 +01:00
return nil
}
2021-01-12 22:54:13 +01:00
h.desktop.SetKeyboardModifiers(types.KeyboardModifiers{
2021-02-14 14:40:17 +01:00
NumLock: payload.NumLock,
2021-01-12 22:54:13 +01:00
CapsLock: payload.CapsLock,
})
2021-03-16 10:53:03 +01:00
2020-11-30 17:45:53 +01:00
return nil
}