This hungry class EventEater encapsulates event masking logic.
Its basic role is to kill synthetic mouseMove events sent by Xorg or Qt after tablet events. Those events are sent in order to allow widgets that haven't implemented tablet specific functionality to seamlessly behave as if one were using a mouse. These synthetic events are supposed to be optional, or at least come with a flag saying "This is a fake event!!" but neither of those methods is trustworthy. (This is correct as of Qt 5.4 + Xorg.)
Qt 5.4 provides no reliable way to see if a user's tablet is being hovered over the pad, since it converts all tablethover events into mousemove, with no option to turn this off. Moreover, sometimes the MouseButtonPress event from the tapping their tablet happens BEFORE the TabletPress event. This means we have to resort to a somewhat complicated logic. What makes this truly a joke is that we are not guaranteed to observe TabletProximityEnter events when we're using a tablet, either, you may only see an Enter event.
Once we see tablet events heading our way, we can say pretty confidently that every mouse event is fake. There are two painful cases to consider - a mousePress event could arrive before the tabletPress event, or it could arrive much later, e.g. after tabletRelease. The first was only seen on Linux with Qt's XInput2 code, the solution was to hold onto mousePress events temporarily and wait for tabletPress later, this is contained in git history but is now removed. The second case is currently handled by the eatOneMousePress function, which waits as long as necessary to detect and block a single mouse press event.
Definition at line 60 of file kis_input_manager_p.cpp.
61{
62 return (t == QEvent::MouseMove ||
63 t == QEvent::MouseButtonPress ||
64 t == QEvent::MouseButtonRelease ||
65 t == QEvent::MouseButtonDblClick);
66}