wayland: Move checks for grabbing into a central location

This means that we won't have as much work to do to introduce similar
checks for touch.