Fixes #158. Optionally allows a user to pass in an app window

Do not assume the window to attach the gesture recognizer to lives on the application delegate. Instead, allow the user to optionally pass in a reference to a window at creation time, hold a weak reference to that, and only fall back to the application delegate if that reference is nil.