handle mouse down, quit and timer events