Translating window system events to gestures, and delivering gestures to gadgets