Reorganize cursor plumbing in preparation for hardware cursors.
Add support for hardware cursors.