Comment 23 for bug 370818

Revision history for this message
Aisano (info-ais-sanmarino) wrote :

I am having this problem on my new notebook running Ubuntu 10.04, and I did a little source code reading. At least on my hardware the problem is caused by the processing of mouse move events, where the event state mask happens to have the 0x2000 bit set. This bit is not defined in the "gdktypes.h" header, and I do not know what it means. But it causes the comparison to the mouse button bit masks in "xsane-preview.c" to fail, so the scan rectangle is never drawn or updated.

A look at the code revealed that there seems to be a little misunderstanding: Though the "GdkEventMotion.state" value is a bit mask it is AND-ed with constants such as GDK_Num_Lock or GDK_Caps_Lock, which are not bit masks but enumerated values. What the author probably meant was ignoring any modifiers (such as Shift or Ctrl) except for the bare mouse buttons. This is easily achieved by AND-ing the state value with the OR-ed mouse button constants (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK).

I am adding a patch for xsane-preview.c, which solves the problem on my platform and looks like "doing the right thing", so it should not harm anybody even if the problem should have different causes on different platforms.