mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
f8b128e1e9
* xserver dummy with RandR. * update. * remove screen configurations from xorg. * screen size cannot be nil anymore. * use predefined screen configurations. * use screen configurations. * fix error. * remove comment.
33 lines
661 B
Go
33 lines
661 B
Go
package handler
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/demodesk/neko/pkg/types"
|
|
"github.com/demodesk/neko/pkg/types/event"
|
|
"github.com/demodesk/neko/pkg/types/message"
|
|
)
|
|
|
|
func (h *MessageHandlerCtx) screenSet(session types.Session, payload *message.ScreenSize) error {
|
|
if !session.Profile().IsAdmin {
|
|
return errors.New("is not the admin")
|
|
}
|
|
|
|
size, err := h.desktop.SetScreenSize(types.ScreenSize{
|
|
Width: payload.Width,
|
|
Height: payload.Height,
|
|
Rate: payload.Rate,
|
|
})
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
h.sessions.Broadcast(event.SCREEN_UPDATED, message.ScreenSize{
|
|
Width: size.Width,
|
|
Height: size.Height,
|
|
Rate: size.Rate,
|
|
})
|
|
return nil
|
|
}
|