Index: [thread] [date] [subject] [author]
  From: Andreas Beck <becka@rz.uni-duesseldorf.de>
  To  : ggi-develop@eskimo.com
  Date: Sat, 19 Jun 1999 13:10:14 +0200

Re: libgii - mysterious mouse implementation

> I tried to hack in libgii the third mouse button recognization of a serial
> mouse using the microsoft-protocol. But here I detected a mysterious
> thing: When I apply the following patch the inputdump demo recognize the
> middle mouse button as both left and right mouse button...

> +       /* third button added by Christoph Egger (Christoph_Egger@t-online.de) */
> +       if (buf[0] == 0x40 && !(mpriv->button_state|buf[1]|buf[2]))
> +               buttons = GII_PBUTTON_MIDDLE; /* third button on MS compatible mouse */

> When I apply the following patch instead, inputdump recognizes the middle
> mouse button as expected...

> +       /* third button added by Christoph Egger (Christoph_Egger@t-online.de) */
> +       if (buf[0] == 0x40 && !(mpriv->button_state|buf[1]|buf[2]))
> +               buttons = 4; /* third button on MS compatible mouse */

> Can anyone explain this?

Yes. Look at mouse_send_buttons. The buttons variable in the parser works as
a bitfield, while the communication with the application works on a
keypress/release basis. GII_PBUTTON_MIDDLE now happens to be 3, which will
cause mouse_send_buttons to send press/release events as required to say
"buttons 1 and 2 are on".

BTW: When I look at your patch, I get the impression, that one cannot press
the middle button together with the outer buttons. Is that correct ?
Then someone should go and shoot the one that designed that protocol ...

I was already pretty upset, when we had a little Q**** match in the
lunchbreak and I had a 2 button M$ mouse only, which caused me to need to
use the keyboard for backing up and defeated running and shooting at the
same time, as pressing both buttons caused the X server's chord-middle
function to kick in .... GRRR ...

CU, ANdy

-- 
= Andreas Beck                    |  Email :  <andreas.beck@ggi-project.org> =

Index: [thread] [date] [subject] [author]