[ent util] Use util::constrain to constrain focus (and also fix a bug in the former)