Review request for 7124382: [macosx] Property sun.awt.enableExtraMouseButtons is always 'false'

Leonid Romanov leonid.romanov at oracle.com
Thu Feb 2 08:52:34 PST 2012


Ok, I moved them to LWCToolkit:
http://cr.openjdk.java.net/~leonidr/7124382/webrev.02/ 

On 02.02.2012, at 20:05, Artem Ananiev wrote:

> 
> On 2/2/2012 7:41 PM, Leonid Romanov wrote:
>> Updated webrev:
>> http://cr.openjdk.java.net/~leonidr/7124382/webrev.01/
> 
> You should also make sure AWTEvent is initialized before CRobot. Otherwise, gNumberOfButtons (which is referenced in initRobot()) will not have a correct value.
> 
> Thanks,
> 
> Artem
> 
>> On 02.02.2012, at 19:17, Artem Ananiev wrote:
>> 
>>> 
>>> On 2/2/2012 6:56 PM, Leonid Romanov wrote:
>>>> I think caching in native is better than in java. I suggest I left a single copy of  gsNumberOfButtons and gsButtonDownMasks in AWTEvent, because they seem to be events related, and modify Robot code to refer to AWTEvent's copy  of gsNumberOfButtons and gsButtonDownMasks. Is it OK to you?
>>> 
>>> Sounds good.
>>> 
>>> Thanks,
>>> 
>>> Artem
>>> 
>>>> On 02.02.2012, at 17:47, Artem Ananiev wrote:
>>>> 
>>>>> 
>>>>> On 2/2/2012 4:37 PM, Leonid Romanov wrote:
>>>>>> 
>>>>>> On 02.02.2012, at 16:16, Artem Ananiev wrote:
>>>>>> 
>>>>>>> Some comments from my side:
>>>>>>> 
>>>>>>> 1. It would be fine not to store gsNumberOfButtons and gsButtonDownMasks in the native code twice. Probably, caching may be done at the Java level, e.g. in LWCToolkit? BTW, static variables in native are really painful in MVM-like environment (if we ever really support it).
>>>>>> 
>>>>>> So, your suggestion is to use JNI field-access methods to get these cached values in native every time we need them, right?
>>>>> 
>>>>> Access a field via JNI, or call a method via JNI, or something like this. At least, have a single copy of gsNumberOfButtons and gsButtonDownMasks and reference it both from CRobot and AWTEvent.
>>>>> 
>>>>>>> 2. I wonder how the following piece of code is expected to work:
>>>>>>> 
>>>>>>> robot.mousePress(BUTTON1_DOWN_MASK | BUTTON2_DOWN_MASK)
>>>>>>> 
>>>>>>> Should we post two native events in this case (CGEventCreateMouseEvent doesn't seem to support multiple buttons at once)? It's not a question about the current fix, but rather how it works, or doesn't work, right now.
>>>>>> 
>>>>>> We don't support it because it doesn't make sense: real user can't press both buttons exactly at the same time, one of the buttons would always be pressed before the other.
>>>>> 
>>>>> Real users can't, but java.awt.Robot can. It's a robot! :)
>>>>> 
>>>>> Robot.mousePress() JavaDoc explicitly states that several buttons may be pressed at once. So it would be fine to support this case...
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> Artem
>>>>> 
>>>>>>> Thanks,
>>>>>>> 
>>>>>>> Artem
>>>>>>> 
>>>>>>> On 2/2/2012 2:49 PM, Leonid Romanov wrote:
>>>>>>>> Hi,
>>>>>>>> Please, review a fix for for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7124382
>>>>>>>> webrev: http://cr.openjdk.java.net/~leonidr/7124382/webrev.00/
>>>>>>>> 
>>>>>>>> Thanks,
>>>>>>>> Leonid.
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> 



More information about the macosx-port-dev mailing list