Fix handling of identical consecutive key events

Events generated programmatically may have the same timestamp as the previous
event, which caused them to be ignored on the assumption that they were the same
event being sent to a parent window. Fix this by detecting when a new event could
be generated by the event loop.
Closes #15802


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77074 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775