# HG changeset patch # User serb # Date 1515036254 28800 # Node ID 5bfbe17c45bc4e3f6adcc4d9e6c4c8fa69ea1336 # Parent 97c119db6c89eb2e232bfda3c4ca207d6a3225e9 8191696: Better mouse positioning Reviewed-by: skoivu, rhalade, prr, aghaisas diff -r 97c119db6c89 -r 5bfbe17c45bc src/solaris/classes/sun/awt/X11/XMouseInfoPeer.java --- a/src/solaris/classes/sun/awt/X11/XMouseInfoPeer.java Sun Dec 10 19:01:40 2017 -0800 +++ b/src/solaris/classes/sun/awt/X11/XMouseInfoPeer.java Wed Jan 03 19:24:14 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,10 @@ package sun.awt.X11; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; import java.awt.Point; import java.awt.Window; -import java.awt.GraphicsEnvironment; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; import java.awt.peer.MouseInfoPeer; public class XMouseInfoPeer implements MouseInfoPeer { @@ -76,14 +75,15 @@ } public boolean isWindowUnderMouse(Window w) { - + if (w == null) { + return false; + } + XWindow peer = (XWindow) w.getPeer(); + if (peer == null) { + return false; + } long display = XToolkit.getDisplay(); - - // java.awt.Component.findUnderMouseInWindow checks that - // the peer is non-null by checking that the component - // is showing. - - long contentWindow = ((XWindow)w.getPeer()).getContentWindow(); + long contentWindow = peer.getContentWindow(); long parent = XlibUtil.getParentWindow(contentWindow); XToolkit.awtLock(); diff -r 97c119db6c89 -r 5bfbe17c45bc src/windows/native/sun/windows/MouseInfo.cpp --- a/src/windows/native/sun/windows/MouseInfo.cpp Sun Dec 10 19:01:40 2017 -0800 +++ b/src/windows/native/sun/windows/MouseInfo.cpp Wed Jan 03 19:24:14 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,6 +48,7 @@ } jobject winPeer = AwtObject::GetPeerForTarget(env, window); + CHECK_NULL_RETURN(winPeer, JNI_FALSE); PDATA pData; pData = JNI_GET_PDATA(winPeer); env->DeleteLocalRef(winPeer);