Il giorno ven, 14/12/2012 alle 16.35 +0400, Artem Ananiev ha scritto: > On 12/14/2012 4:10 PM, Roman Kennke wrote: > > Am Freitag, den 14.12.2012, 15:35 +0400 schrieb Artem Ananiev: > >> On 12/10/2012 11:57 PM, Mario Torre wrote: > >>> Hello Anthony, > >>> > >>> Sorry for the delay, but I've been pretty busy lately. > >>> > >>> Here is the new webrev with the corrections you requested: > >>> > >>> http://cr.openjdk.java.net/~neugens/853079/webrev.02/ > >> > >> It looks good, just a single question: > >> > >> XBaseWindow.isFullRelease(): could you provide scenario, when this > >> method is not the same as "return buttonState == 0", please? > > > > I am not sure. IIRC, the button mask for button-release events in X11 is > > the mask *before* the release (i.e. for a full-release the > > currently-released button is still in there). That's why buttonState==0 > > would not be correct in this case. > > Here is the code: > > 1036 if (button < 0 || button > buttonsNumber) { > 1037 return buttonState == 0; > 1038 } else { > 1039 return buttonState == XlibUtil.getButtonMask(button); > 1040 } > > If 0 <= button <= buttonsNumber, getButtonMask() will return 0, right? > > Thanks,
No, it returns: return 1 << (7 + button); Which is dependent of the value of button. For example, here is what I get with release: 1 - 256 2 - 512 1 - 256 4 - 2048 5 - 4096 The first is button, the second is XlibUtil.getButtonMask(button); The code result in false (buttonState != XlibUtil.getButtonMask(button)) when, for example, you press one button, keep it pressed, then press a second button, then release the second button, but keep the first button pressed. In that case, the release event for the second button doesn't match the button state: Press and release 1st: 1 - 256 - true Press and release 2nd (id=3): 3 - 1024 - true Press 1, press 2, release 2, release 1: 3 - 1024 - false 1 - 256 - true Cheers, Mario