X11: Silently ignore events for destroyed windows

After a window has been destroyed and the corresponding entry in X11
Context has been removed, there may still be events in the X11 event
queue for that window remaining.

Silently ignore any events for windows which are not found in the X11
context using XFindContext.
Converted the OSX port to C89

It now builds with llvm-gcc-4.2 shipped by apple.
Also fixed some warnings