Hello,
I've tried the current CVS version to test the wheel emulation mode that
Henry T. So implemented and I've found a problem.
I'm using the fourth button as wheel emulation button, but then, when the
it's going to generate a fourth button press/release events (wheel up),
it chooses not to do so because "the real" 4th button is already pressed.
So it doesn't generate wheel up events !
The attached patch makes it work and also lowers a lot the Inertia default
value, as I think 50 is too high . I was going to suggest to set it to "1"
as I've done in my configuration, but I suppose 1 is too sensible to be
the default. In any case, even if 50 is ok for normal mice, it's too high
for trackballs (and remember that this feature is mainly for trackball's
users), so I'd say to set the default to 10.
I would also like to ask for Button6 and Button7 (and related) to be
defined in X.h . Would this be possible ? If we want to support horizontal
wheels as good as we support vertical wheels (and I can't find a reason
not to do so), then these definitions should be done in order to allow
applications to use nice definitions instead of simple values (I mean,
instead of using plain 6 and 7 numbers when checking the button being
pressed). In other way, how should the apps check for horizontal wheel's
left and right events ? (the ones in XAxisMapping)
Greetings,
--
Antonio Larrosa Jimenez
KDE Core developer - [EMAIL PROTECTED]
SuSE Labs developer - [EMAIL PROTECTED]
http://perso.wanadoo.es/antlarr
KDE - The development framework of the future, today.
Index: mouse.c
===================================================================
RCS file: /cvs/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v
retrieving revision 1.47
diff -u -p -r1.47 mouse.c
--- mouse.c 2001/09/14 19:12:17 1.47
+++ mouse.c 2001/09/21 14:49:55
@@ -511,7 +511,7 @@ MouseCommonOptions(InputInfoPtr pInfo)
pMse->wheelButtonMask = 1 << (wheelButton - 1);
pMse->wheelInertia = xf86SetIntOption(pInfo->options,
- "EmulateWheelInertia", 50);
+ "EmulateWheelInertia", 10);
if (pMse->wheelInertia <= 0) {
xf86Msg(X_WARNING, "%s: Invalid EmulateWheelInertia value: %d\n",
pInfo->name, pMse->wheelInertia);
@@ -2004,7 +2004,7 @@ MouseDoPostEvent(InputInfoPtr pInfo, int
MouseDevPtr pMse;
int truebuttons, emulateButtons;
int id, change;
- int emuWheelDelta, emuWheelButton;
+ int emuWheelDelta, emuWheelButton, emuWheelButtonMask;
pMse = pInfo->private;
@@ -2026,6 +2026,7 @@ MouseDoPostEvent(InputInfoPtr pInfo, int
emuWheelDelta = pMse->wheelInertia;
emuWheelButton = pMse->positiveY;
}
+ emuWheelButtonMask = 1 << (emuWheelButton - 1);
while (abs(pMse->wheelYDistance) > pMse->wheelInertia) {
pMse->wheelYDistance -= emuWheelDelta;
@@ -2033,7 +2034,8 @@ MouseDoPostEvent(InputInfoPtr pInfo, int
* Synthesize the press and release, but not when the button.
* to be synthesized is already pressed "for real".
*/
- if (!((1 << (emuWheelButton - 1)) & buttons)) {
+ if (!(emuWheelButtonMask & buttons)
+ || (emuWheelButtonMask & pMse->wheelButtonMask) ) {
xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 1, 0, 0);
xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 0, 0, 0);
}
@@ -2057,7 +2059,8 @@ MouseDoPostEvent(InputInfoPtr pInfo, int
* Synthesize the press and release, but not when the button.
* to be synthesized is already pressed "for real".
*/
- if (!((1 << (emuWheelButton - 1)) & buttons)) {
+ if (!(emuWheelButtonMask & buttons)
+ || (emuWheelButtonMask & pMse->wheelButtonMask) ) {
xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 1, 0, 0);
xf86PostButtonEvent(pInfo->dev, 0, emuWheelButton, 0, 0, 0);
}