[gpm][PATCH] 2 wheels support for imps2

Pozsar Balazs pozsy@sch.bme.hu
Sun, 16 Jun 2002 03:11:07 +0200 (MEST)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-758783491-1024189867=:26665
Content-Type: TEXT/PLAIN; charset=US-ASCII


Hi!

This is a patch against 1.20.0, and unfortunately doesn't apply to current
cvs version because the m_imps2 function has changed.

A4Tech dual-wheel mice send these bytes in imps2 mode:
data[3]=
 0xff first wheel up
 0x01 first wheel down
 0xfe second wheel up
 0x02 second wheel down

Current code translates both wheels as if the first wheel was scrolled,
and doesn't even try to repeat them.

Using this patch, when is -Rimps2 mode, X receives button4 and button5
events for scrooling the first wheel, and button6 and button7 events for
the second, just as if you configured X to control the mice itself in
IMPS/2 mode.

Comments welcome :)

ps: I haven't tried the current cvs, only looked at the source, but I
think m_imps2/r_imps2 is messed up there... m_imps2 stores scrooling
information (from data[3]) in state->wdx and state->wdy, while r_imps2
checks bits of state->buttons. Am I missing something?

-- 
pozsy

---559023410-758783491-1024189867=:26665
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="gpm-1.20.0-2wheels"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.4.30.0206160311070.26665@balu>
Content-Description: 
Content-Disposition: attachment; filename="gpm-1.20.0-2wheels"

ZGlmZiAtTmF1ciBncG0tMS4yMC4wL3NyYy9oZWFkZXJzL2dwbS5oIGdwbS10
b3Jvay9zcmMvaGVhZGVycy9ncG0uaA0KLS0tIGdwbS0xLjIwLjAvc3JjL2hl
YWRlcnMvZ3BtLmgJU2F0IEZlYiAyMyAxNTo0MjoyMyAyMDAyDQorKysgZ3Bt
LXRvcm9rL3NyYy9oZWFkZXJzL2dwbS5oCVNhdCBKdW4gIDEgMjA6Mjg6MzQg
MjAwMg0KQEAgLTc2LDYgKzc2LDggQEANCiANCiAvKi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi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