mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
screen size retype one struct.
This commit is contained in:
parent
31eb743a5d
commit
51577ecff4
@ -23,11 +23,8 @@ func (h *RoomHandler) screenConfiguration(w http.ResponseWriter, r *http.Request
|
||||
return utils.HttpInternalServerError().WithInternalMsg("unable to get screen configuration")
|
||||
}
|
||||
|
||||
return utils.HttpSuccess(w, ScreenConfigurationPayload{
|
||||
Width: size.Width,
|
||||
Height: size.Height,
|
||||
Rate: size.Rate,
|
||||
})
|
||||
payload := ScreenConfigurationPayload(*size)
|
||||
return utils.HttpSuccess(w, payload)
|
||||
}
|
||||
|
||||
func (h *RoomHandler) screenConfigurationChange(w http.ResponseWriter, r *http.Request) error {
|
||||
@ -36,21 +33,13 @@ func (h *RoomHandler) screenConfigurationChange(w http.ResponseWriter, r *http.R
|
||||
return err
|
||||
}
|
||||
|
||||
if err := h.desktop.SetScreenSize(types.ScreenSize{
|
||||
Width: data.Width,
|
||||
Height: data.Height,
|
||||
Rate: data.Rate,
|
||||
}); err != nil {
|
||||
size := types.ScreenSize(*data)
|
||||
if err := h.desktop.SetScreenSize(size); err != nil {
|
||||
return utils.HttpUnprocessableEntity("cannot set screen size").WithInternalErr(err)
|
||||
}
|
||||
|
||||
h.sessions.Broadcast(
|
||||
event.SCREEN_UPDATED,
|
||||
message.ScreenSize{
|
||||
Width: data.Width,
|
||||
Height: data.Height,
|
||||
Rate: data.Rate,
|
||||
}, nil)
|
||||
payload := message.ScreenSize(*data)
|
||||
h.sessions.Broadcast(event.SCREEN_UPDATED, payload, nil)
|
||||
|
||||
return utils.HttpSuccess(w, data)
|
||||
}
|
||||
|
@ -13,21 +13,11 @@ func (h *MessageHandlerCtx) screenSet(session types.Session, payload *message.Sc
|
||||
return errors.New("is not the admin")
|
||||
}
|
||||
|
||||
if err := h.desktop.SetScreenSize(types.ScreenSize{
|
||||
Width: payload.Width,
|
||||
Height: payload.Height,
|
||||
Rate: payload.Rate,
|
||||
}); err != nil {
|
||||
data := types.ScreenSize(*payload)
|
||||
if err := h.desktop.SetScreenSize(data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
h.sessions.Broadcast(
|
||||
event.SCREEN_UPDATED,
|
||||
message.ScreenSize{
|
||||
Width: payload.Width,
|
||||
Height: payload.Height,
|
||||
Rate: payload.Rate,
|
||||
}, nil)
|
||||
|
||||
h.sessions.Broadcast(event.SCREEN_UPDATED, payload, nil)
|
||||
return nil
|
||||
}
|
||||
|
@ -42,11 +42,7 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error {
|
||||
message.SystemInit{
|
||||
SessionId: session.ID(),
|
||||
ControlHost: controlHost,
|
||||
ScreenSize: message.ScreenSize{
|
||||
Width: size.Width,
|
||||
Height: size.Height,
|
||||
Rate: size.Rate,
|
||||
},
|
||||
ScreenSize: message.ScreenSize(*size),
|
||||
Sessions: sessions,
|
||||
ImplicitHosting: h.sessions.ImplicitHosting(),
|
||||
ScreencastEnabled: h.capture.Screencast().Enabled(),
|
||||
|
Loading…
Reference in New Issue
Block a user