Re: St.ButtonMask bug



El 19 de agosto de 2011 12:23, Olav Vitters <olav vitters nl> escribió:
On Fri, Aug 19, 2011 at 12:19:10PM +0200, Antonio Hernández Díaz wrote:
> I'm writing a Shell extension and I have just found that the value for
> St.ButtonMask.THREE is 4. This is obviously wrong.
> Has anyone else noticed this problem?, Do you know if it has been corrected?

It is a mask, so it is binary
1 => 1   /      0001
2 => 2   /      0010
3 => 4   /      0100
4 => 8   /      1000
8 => 16  / 0001 0000

etc
--
Regards,
Olav


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.

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


Do I have to write a comparison like event.get_button() == St.ButtonMask.ONE | St.ButtonMask.TWO or something?
Isn't it easier to have a mask for each of the mouse buttons?

--
Antonio Hernández



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