Use some typed units in compositor and windowing.

This is a rebased, squashed, and updated version of #2444.