<AWT Dev> Review request for 8143316 Crash Trend in 1.9.0-ea-b93 (sun.awt.DefaultMouseInfoPeer.fillPointWithCoords)
alexandr.scherbatiy at oracle.com
Mon Dec 28 14:47:53 UTC 2015
Could you review the updated fix:
- DefaultMouseInfoPeer is removed from the SunToolkit and
WMouseInfoPeer is added to the WToolkit
- Screen devices initialization is added to the WMouseInfoPeer
- MONITOR_DEFAULTTONEAREST argument is changed to the
MONITOR_DEFAULTTOPRIMARY for the MonitorFromPoint method
to find a point which is not contained within any display monitor.
On 12/23/2015 5:59 PM, Sergey Bylokhov wrote:
> This issue is related to windows only, but we change the shared code
> in a way which can mislead someone, and the crash can be returned
> after some refactoring, or when someone will call
> fillPointWithCoords() before device initialization in some other place.
> So it seems this code should be rewritten, am I missed something but
> it looks like this method incorrectly work in case of scaled displays.
> I guess fillPointWithCoords should return unscaled coords otherwise
> how we will figure out what scale should be used there(screen)?
> Because at the end of the method getPointerInfo we iterate over
> devices to find which one is correct.
Windows and Mac OS X use different strategies to return the mouse
CGEventGetLocation function returns scaled mouse coordinates on Mac
GetCursorPos function returns unscaled mouse coordinates on Windows.
It looks like it is better to always return scaled coordinates from
the native level.
> On 10/12/15 15:06, Alexander Scherbatiy wrote:
>> Could you review the fix:
>> bug: https://bugs.openjdk.java.net/browse/JDK-8143316
>> webrev: http://cr.openjdk.java.net/~alexsch/8143316/webrev.00
>> The the native MouseInfo.fillPointWithCoords() method can access the
>> devices before they are initialized.
>> The fix moves the devices initialization before the
>> getMouseInfoPeer().fillPointWithCoords(point) call in the
>> getPointerInfo() method.
>> The MonitorFromPoint method is added to the native
>> fillPointWithCoords() method to find the device where the mouse cursor
>> is placed.
More information about the awt-dev