package host import "errors" var ErrDisplayNotFound = errors.New("target display not found") func computeWindowedTargetRect(winRect, targetWork WindowRect) WindowRect { workWidth := targetWork.Right - targetWork.Left workHeight := targetWork.Bottom - targetWork.Top width := min(winRect.Right-winRect.Left, workWidth) height := min(winRect.Bottom-winRect.Top, workHeight) left := targetWork.Left + (workWidth-width)/2 top := targetWork.Top + (workHeight-height)/2 return WindowRect{Left: left, Top: top, Right: left + width, Bottom: top + height} }