Make mouse handling respect CSS scaling.

See #868.