<AWT Dev> RFC: JDK-8231991: Mouse wheel change focus on awt/swing windows

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Oct 25 23:06:28 UTC 2019


Hi, Mario.

The code change looks fine, but could you confirm the new behavior align with the native applications?

On 10/25/19 6:52 am, Mario Torre wrote:
> On Tue, 2019-10-08 at 11:42 +0200, Mario Torre wrote:
> 
> Ping?
> 
> Cheers,
> Mario
> 
>> Hi all,
>>
>> I filed a bug related to how mouse wheel interact with focus events:
>>
>> https://bugs.openjdk.java.net/browse/JDK-8231991
>>
>> The issue seems to be that we still consider mouse button
>> press/release the wheel event. This is a bit tricky since X11 doesn't
>> really have the concept of mouse wheel but those events are indeed
>> synthesized from button press and converted into the scoll-up/down
>> logic, furthermore, it's possible to remap the buttons from the
>> de-facto standard of button 4 and 5 to anything else, however I'm not
>> sure how to detect which button is configured for the mouse wheel.
>>
>> In this patch I introduced a couple of new constants in
>> XConstants.java for now hard coded to button 4 and 5, but we can
>> refactor later if needed the way those constants are filled (or if
>> anyone has an idea I'll be happy to fix this right away):
>>
>> http://cr.openjdk.java.net/~neugens/JDK-8231991/webrev.00/
>>
>> I also added a test case. The fix is essentially to skip the focus
>> logic if this is a mouse wheel event. I tried with a few different
>> configurations and all seems to work correctly, but I appreciate
>> feedback here since this areas is rather tricky.
>>
>> I aim at backporting this fix - if approved - all the way down to 8,
>> I'm not sure if the addition of those two constants is accepted
>> however in the backports, perhaps I should just hard code the values
>> for these instead?
>>
>> Thanks in advance for the feedback.
>>
>> Cheers,
>> Mario
> 


-- 
Best regards, Sergey.


More information about the awt-dev mailing list