Looks like a bug
OK, I believe this is a bug in the xorg evdev driver, but as ubuntu-bug for precise so kindly asked me to work this trough the support channels, I first went ant reported this here. In the meantime, I've upgraded to quantal and reported a proper bug, but if someone from the support community should have an answer, that wouldn't go amiss either. (Paragraph has been edited to refer to the reported bug)
Setup
This is Ubuntu 12.04 precise connected to an Acer T231H multitouch monitor. Actually I encountered this on more than one OS setup, one of them done through debootstrap. Packages involved:
- xserver-xorg-input-evdev 1:2.7.0-0ubuntu1
- linux-image-*-generic 3.2.0-24.39 on one and 3.2.0-25 on the other system
Symptom
The mouse events as X sends them to the applications are inconsitent. This can be debugged using xev.
The first touch of the screen is preceeded by a MotionNotify event which already has state 0x100, i.e. left mouse button pressed. After that comes a ButtonPress event, again with state 0x100 although that value should indicate the state of the buttons before the event occurred. The subsequent drag is all right, and the ButtonRelease as well, but the 0x100 bit in the state value will never become zero again.
Even if I've got an ordinary mouse connected as well, it will henceforth report every movement as if I were keeping the left mouse button down. The only cure that I could find was restarting the X server. Together with the ButtonPress and ButtonRelease events, this constant bit for left mouse button amounts to an inconsistent reporting of button state.
Java applications e.g. will report every move as a drag due to this issue, with severe implications for focus management. This makes using differenent parts of the application almost impossible, as mouse movement will only be reported to the component where the mouse entered the application window.
Comparison of expected and actual behaviour
Expected behaviour:
- MotionNotify with state 0x000 when dragging the ordinary mouse
- MotionNotify with state 0x000 for move prior to touch, or no event at all
- ButtonPress with state 0x000 when touching the screen
- MotionNotify with state 0x100 while dragging the finger
- ButtonRelease with state 0x100 when lifting the finger
- MotionNotify with state 0x000 when dragging the ordinary mouse afterwards
Actual behaviour:
- MotionNotify with state 0x000 when dragging the ordinary mouse before the first touch
- MotionNotify with state 0x100 for prior to ButtonPress event
- ButtonPress with state 0x100 when touching the screen
- MotionNotify with state 0x100 while dragging the finger
- ButtonRelease with state 0x100 when lifting the finger
- MotionNotify with state 0x100 when dragging the ordinary mouse afterwards