Joystick: Test + unified polling

This pull has four commits.

The first fixes a trivial problem with joysticks that don't have axes or buttons, such as the way the accelerometer in the applesmc is represented on Linux as a joystick with two axes on no buttons. If this patch is not applied, then it crashes and if you just protect the width computation, you get errors on every frame.

The next three commits provide consistent intra-frame (i.e. intra-PollEvents) reads of the Joystick state. Without this patch, every call to the joystick functions process more events on OS X and X11, meaning that the answer will be different between calls and a game could not reliably treat the joystick within a frame.

The Linux patch has been compiled and works great.

The OS X patch was done without compiling or testing.

The Windows patch just adds the correct function, but since the existing Windows code doesn't work with discrete events that are polled for (it must be handled by the OS?), it doesn't do anything. I did put in a comment about how it would work, but I can't write it because I can't test it.