提交 485c4cc3 编写于 作者: S serb

8191696: Better mouse positioning

Reviewed-by: skoivu, rhalade, prr, aghaisas
上级 67301c11
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,11 +25,10 @@ ...@@ -25,11 +25,10 @@
package sun.awt.X11; package sun.awt.X11;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Point; import java.awt.Point;
import java.awt.Window; import java.awt.Window;
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.peer.MouseInfoPeer; import java.awt.peer.MouseInfoPeer;
public class XMouseInfoPeer implements MouseInfoPeer { public class XMouseInfoPeer implements MouseInfoPeer {
...@@ -76,14 +75,15 @@ public class XMouseInfoPeer implements MouseInfoPeer { ...@@ -76,14 +75,15 @@ public class XMouseInfoPeer implements MouseInfoPeer {
} }
public boolean isWindowUnderMouse(Window w) { public boolean isWindowUnderMouse(Window w) {
if (w == null) {
return false;
}
XWindow peer = (XWindow) w.getPeer();
if (peer == null) {
return false;
}
long display = XToolkit.getDisplay(); long display = XToolkit.getDisplay();
long contentWindow = peer.getContentWindow();
// 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 parent = XlibUtil.getParentWindow(contentWindow); long parent = XlibUtil.getParentWindow(contentWindow);
XToolkit.awtLock(); XToolkit.awtLock();
......
/* /*
* Copyright (c) 2003, 2014, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -48,6 +48,7 @@ Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse(JNIEnv *env, jclass cls, ...@@ -48,6 +48,7 @@ Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse(JNIEnv *env, jclass cls,
} }
jobject winPeer = AwtObject::GetPeerForTarget(env, window); jobject winPeer = AwtObject::GetPeerForTarget(env, window);
CHECK_NULL_RETURN(winPeer, JNI_FALSE);
PDATA pData; PDATA pData;
pData = JNI_GET_PDATA(winPeer); pData = JNI_GET_PDATA(winPeer);
env->DeleteLocalRef(winPeer); env->DeleteLocalRef(winPeer);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册