mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
33 lines
735 B
Go
33 lines
735 B
Go
package handler
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"gitlab.com/demodesk/neko/server/pkg/types"
|
|
"gitlab.com/demodesk/neko/server/pkg/types/message"
|
|
)
|
|
|
|
func (h *MessageHandlerCtx) keyboardMap(session types.Session, payload *message.KeyboardMap) error {
|
|
if !session.IsHost() {
|
|
return errors.New("is not the host")
|
|
}
|
|
|
|
return h.desktop.SetKeyboardMap(types.KeyboardMap{
|
|
Layout: payload.Layout,
|
|
Variant: payload.Variant,
|
|
})
|
|
}
|
|
|
|
func (h *MessageHandlerCtx) keyboardModifiers(session types.Session, payload *message.KeyboardModifiers) error {
|
|
if !session.IsHost() {
|
|
return errors.New("is not the host")
|
|
}
|
|
|
|
h.desktop.SetKeyboardModifiers(types.KeyboardModifiers{
|
|
NumLock: payload.NumLock,
|
|
CapsLock: payload.CapsLock,
|
|
})
|
|
|
|
return nil
|
|
}
|