screen size retype one struct.

This commit is contained in:
Miroslav Šedivý
2021-09-20 18:28:13 +02:00
parent 31eb743a5d
commit 51577ecff4
3 changed files with 12 additions and 37 deletions

View File

@ -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)
}