Mercurial > hg > openjdk > jdk6 > jdk
changeset 1796:5bfbe17c45bc
8191696: Better mouse positioning
Reviewed-by: skoivu, rhalade, prr, aghaisas
author | serb |
---|---|
date | Wed, 03 Jan 2018 19:24:14 -0800 |
parents | 97c119db6c89 |
children | 1ded804bbc07 |
files | src/solaris/classes/sun/awt/X11/XMouseInfoPeer.java src/windows/native/sun/windows/MouseInfo.cpp |
diffstat | 2 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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();
--- 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);