handle all input events, some even with flags.
set link for fiddle