Man who allegedly shot ex-wife in custody