On this page:
viewport-flush-input

12 Flushing

(viewport-flush-input viewport)  void?
  viewport : viewport?
Empties all mouse and keyboard events in the input buffer of viewport.