Re: St.ButtonMask bug



2011/8/19 Emmanuele Bassi <ebassi gmail com>
On 2011-08-19 at 13:11, Antonio Hernández Díaz wrote:
> Yes, it is binary. The real problem comes when you try to handle a mouse
> right click.
>
> If you write a callback for a "button-press-event" signal and try to get the
> pressed button,
> for a right click you get event.get_button() == 3, and there isn't a mask
> with that value.

you don't use masks for that.

button identifiers are numeric (it's a trait shared between X11, GDK and
Clutter) because the pointer device can have a non-standard layout, can
be user-rearranged, or can be left or right oriented.

> I don't know what's the expected behaviour, but the values are:
>
>                       get_button()   |   ButtonMask
> left click                 1                       1
> middle click            2                       2
> right click               3                       4

the first column should really be:

 primary
 middle
 secondary

where primary is usually the left-most button in a right-handed layout,
and secondary is the right-most button in the same layout.

> Do I have to write a comparison like event.get_button()

just use the numeric id, as you did above:

 if (event.get_button() == 1) {
     ...
 }

ciao,
 Emmanuele.

W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi
_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
http://mail.gnome.org/mailman/listinfo/gnome-shell-list


Ok, numeric identifiers then,
thanks!

--
Antonio Hernández



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]