Index: [thread] [date] [subject] [author]
  From: Christoph Egger <Christoph_Egger@t-online.de>
  To  : ggi-develop@eskimo.com
  Date: Sat, 19 Jun 1999 19:42:41 +0200 (MEST)

Re: libgii - mysterious mouse implementation

On Sat, 19 Jun 1999, Andreas Beck wrote:

> > 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".

Ah! "Mystery" solved. :-)
> 
> 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 ?

No. Inputdump recognizes all pressed buttons as expected (when I use the
second patch above). But inputdump doesn't recognize the middle mouse
button, when I am moving the mouse... :-(

Christoph Egger
E-Mail: Christoph_Egger@t-online.de

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