Cleaned up internal handling of mouse buttons.

Also added internal bit-manip helpers.
Cleaned up internal keyboard handling.

Also added things to bitop.h.
Added an API for getting a full mouse button mask.
Added an API for directly getting mouse delta-pos.