Updated the event handling for X.
Now manages a few more event types and more importatnly does not get stuck with mouse move events flooding the system.