Implement Gesture API

This is by no means complete, but it's a start.