[patch] EmulateWheel button press broken
Andrew Pimlott
andrew at pimlott.net
Thu Jan 12 14:23:19 PST 2006
As reported in two Debian bug reports [1] [2], the ability for the
EmulateWheelButton to generate button events was broken shortly before
the 6.9 release. It is still broken in current Debian unstable package
6.9.0.dfsg.1-3, and I believe it is still broken in x.org CVS.
It was broken by version 1.15 of
xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c. The problem is the
removal of the truebuttons variable. The wheel emulation code in
MouseDoPostEvent modifies buttons to mask out EmulateWheelButton,
therefore the if condition
if (buttons != pMse->lastMappedButtons) {
(line 2256) was failing when the EmulateWheelButton was pressed,
therefore
pMse->lastMappedButtons = buttons;
(line 2359) was not being run, therefore when the EmulateWheelButton was
released,
change = buttons ^ pMse->lastMappedButtons;
(line 2162) thought there was no change, therefore the button press was
not generated.
The appended patch fixes this by restoring truebuttons (which I called
origbuttons to be slightly clearer). The logic is very similar to
before 1.15, and it does not appear to interfere with the mapping
changes in 1.15, so I don't think it will introduce any problems that
weren't already there. I tested that I can now generate a button press
with EmulateWheelButton.
The patch was generated against the latest Debian unstable sources, but
applies cleanly to the latest CVS.
Andrew
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=320136
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=346098
[3] http://cvs.freedesktop.org/xorg/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c?r1=1.14&r2=1.15
--- mouse.c.orig 2006-01-12 13:46:21.000000000 -0800
+++ mouse.c 2006-01-12 14:10:46.000000000 -0800
@@ -2076,7 +2076,7 @@
MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
{
MouseDevPtr pMse;
- int emulateButtons;
+ int origbuttons, emulateButtons;
int id, change;
int emuWheelDelta, emuWheelButton, emuWheelButtonMask;
int wheelButtonMask;
@@ -2084,6 +2084,8 @@
pMse = pInfo->private;
+ origbuttons = buttons;
+
/* Do single button double click */
if (pMse->doubleClickSourceButtonMask) {
if (buttons & pMse->doubleClickSourceButtonMask) {
@@ -2211,7 +2213,7 @@
if (dx || dy)
xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy);
- if (buttons != pMse->lastMappedButtons) {
+ if (origbuttons != pMse->lastMappedButtons) {
change = buttons ^ pMse->lastMappedButtons;
@@ -2314,7 +2316,7 @@
(buttons & (1 << (id - 1))), 0, 0);
}
- pMse->lastMappedButtons = buttons;
+ pMse->lastMappedButtons = origbuttons;
}
}
More information about the xorg
mailing list