tablet: move tablet tool change processing to tablet_flush
Unlike virtually everything else, the tablet tool was processed at the time
the event was read rather than when the subsequent EV_SYN
came in. This causes
difficulties with tablets that send the wrong BTN_TOOL_PEN
events.
Moving the tool change processing to tablet_flush()
makes the injection of the
BTN_TOOL_PEN
event a lot easier, simply flipping the matching bit does the
job. It also makes it easier to ignore duplicate tool updates like we've seen
in #259 (closed).
Note: this will now swallow any BTN_TOOL_RUBBER
event that comes in late, so it'll make the eraser useless on those devices. Another fix for that is in the pipe.