Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
57e0914c
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
57e0914c
编写于
12月 09, 2016
作者:
P
pchelko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8035568: [macosx] Cursor management unification
Reviewed-by: anthony, serb
上级
9feddb7e
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
224 addition
and
82 deletion
+224
-82
src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java
src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java
+6
-2
src/macosx/classes/sun/lwawt/LWToolkit.java
src/macosx/classes/sun/lwawt/LWToolkit.java
+2
-0
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+3
-5
src/macosx/classes/sun/lwawt/PlatformWindow.java
src/macosx/classes/sun/lwawt/PlatformWindow.java
+0
-2
src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
...cosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
+0
-5
src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java
+0
-5
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+1
-5
src/macosx/classes/sun/lwawt/macosx/CRobot.java
src/macosx/classes/sun/lwawt/macosx/CRobot.java
+31
-2
src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java
.../classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java
+0
-5
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
+5
-0
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+7
-6
src/macosx/native/sun/awt/CCursorManager.m
src/macosx/native/sun/awt/CCursorManager.m
+5
-7
src/macosx/native/sun/awt/CRobot.m
src/macosx/native/sun/awt/CRobot.m
+1
-38
test/java/awt/MouseInfo/GetPointerInfoTest.java
test/java/awt/MouseInfo/GetPointerInfoTest.java
+73
-0
test/java/awt/MouseInfo/MultiscreenPointerInfo.java
test/java/awt/MouseInfo/MultiscreenPointerInfo.java
+90
-0
未找到文件。
src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java
浏览文件 @
57e0914c
...
...
@@ -51,8 +51,12 @@ public class LWMouseInfoPeer implements MouseInfoPeer {
return
false
;
}
final
Object
windowPeer
=
AWTAccessor
.
getComponentAccessor
().
getPeer
(
w
);
return
LWWindowPeer
.
getWindowUnderCursor
()
==
windowPeer
;
LWWindowPeer
windowPeer
=
(
LWWindowPeer
)
AWTAccessor
.
getComponentAccessor
().
getPeer
(
w
);
if
(
windowPeer
==
null
)
{
return
false
;
}
return
LWToolkit
.
getLWToolkit
().
getPlatformWindowUnderMouse
()
==
windowPeer
.
getPlatformWindow
();
}
}
...
...
src/macosx/classes/sun/lwawt/LWToolkit.java
浏览文件 @
57e0914c
...
...
@@ -385,6 +385,8 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
return
new
LWMouseInfoPeer
();
}
protected
abstract
PlatformWindow
getPlatformWindowUnderMouse
();
@Override
public
final
PrintJob
getPrintJob
(
Frame
frame
,
String
doctitle
,
Properties
props
)
{
...
...
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
57e0914c
...
...
@@ -750,11 +750,10 @@ public class LWWindowPeer
lastMouseEventPeer
=
targetPeer
;
}
}
else
{
PlatformWindow
topmostPlatforWindow
=
platformWindow
.
getTopmostPlatformWindowUnderMouse
();
PlatformWindow
topmostPlatformWindow
=
LWToolkit
.
getLWToolkit
().
getPlatformWindowUnderMouse
();
LWWindowPeer
topmostWindowPeer
=
topmostPlatfor
Window
!=
null
?
topmostPlatfor
Window
.
getPeer
()
:
null
;
topmostPlatfor
mWindow
!=
null
?
topmostPlatform
Window
.
getPeer
()
:
null
;
// topmostWindowPeer == null condition is added for the backward
// compatibility with applets. It can be removed when the
...
...
@@ -765,8 +764,7 @@ public class LWWindowPeer
screenX
,
screenY
,
modifiers
,
clickCount
,
popupTrigger
,
targetPeer
);
}
else
{
LWComponentPeer
<?,
?>
topmostTargetPeer
=
topmostWindowPeer
!=
null
?
topmostWindowPeer
.
findPeerAt
(
r
.
x
+
x
,
r
.
y
+
y
)
:
null
;
LWComponentPeer
<?,
?>
topmostTargetPeer
=
topmostWindowPeer
.
findPeerAt
(
r
.
x
+
x
,
r
.
y
+
y
);
topmostWindowPeer
.
generateMouseEnterExitEventsForComponents
(
when
,
button
,
x
,
y
,
screenX
,
screenY
,
modifiers
,
clickCount
,
popupTrigger
,
topmostTargetPeer
);
...
...
src/macosx/classes/sun/lwawt/PlatformWindow.java
浏览文件 @
57e0914c
...
...
@@ -107,8 +107,6 @@ public interface PlatformWindow {
public
void
setAlwaysOnTop
(
boolean
value
);
public
PlatformWindow
getTopmostPlatformWindowUnderMouse
();
public
void
updateFocusableWindowState
();
public
boolean
rejectFocusRequest
(
CausedFocusEvent
.
Cause
cause
);
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
浏览文件 @
57e0914c
...
...
@@ -129,11 +129,6 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
@Override
public
void
setAlwaysOnTop
(
boolean
value
)
{}
// This method should be properly implemented for applets.
// It returns null just as a stub.
@Override
public
PlatformWindow
getTopmostPlatformWindowUnderMouse
()
{
return
null
;
}
@Override
public
void
updateFocusableWindowState
()
{}
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java
浏览文件 @
57e0914c
...
...
@@ -161,11 +161,6 @@ public class CPlatformLWWindow extends CPlatformWindow {
public
void
setAlwaysOnTop
(
boolean
isAlwaysOnTop
)
{
}
@Override
public
PlatformWindow
getTopmostPlatformWindowUnderMouse
(){
return
null
;
}
@Override
public
void
setOpacity
(
float
opacity
)
{
}
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
57e0914c
...
...
@@ -63,9 +63,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private
static
native
void
nativeSynthesizeMouseEnteredExitedEvents
();
private
static
native
void
nativeSynthesizeMouseEnteredExitedEvents
(
long
nsWindowPtr
,
int
eventType
);
private
static
native
void
nativeDispose
(
long
nsWindowPtr
);
private
static
native
CPlatformWindow
nativeGetTopmostPlatformWindowUnderMouse
();
private
static
native
void
nativeEnterFullScreenMode
(
long
nsWindowPtr
);
private
static
native
void
nativeExitFullScreenMode
(
long
nsWindowPtr
);
static
native
CPlatformWindow
nativeGetTopmostPlatformWindowUnderMouse
();
// Loger to report issues happened during execution but that do not affect functionality
private
static
final
PlatformLogger
logger
=
PlatformLogger
.
getLogger
(
"sun.lwawt.macosx.CPlatformWindow"
);
...
...
@@ -727,10 +727,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
setStyleBits
(
ALWAYS_ON_TOP
,
isAlwaysOnTop
);
}
public
PlatformWindow
getTopmostPlatformWindowUnderMouse
(){
return
CPlatformWindow
.
nativeGetTopmostPlatformWindowUnderMouse
();
}
@Override
public
void
setOpacity
(
float
opacity
)
{
CWrapper
.
NSWindow
.
setAlphaValue
(
getNSWindowPtr
(),
opacity
);
...
...
src/macosx/classes/sun/lwawt/macosx/CRobot.java
浏览文件 @
57e0914c
...
...
@@ -78,7 +78,7 @@ class CRobot implements RobotPeer {
@Override
public
void
mousePress
(
int
buttons
)
{
mouseButtonsState
|=
buttons
;
checkMousePos
();
mouseEvent
(
fDevice
.
getCGDisplayID
(),
mouseLastX
,
mouseLastY
,
buttons
,
true
,
false
);
}
...
...
@@ -92,11 +92,40 @@ class CRobot implements RobotPeer {
@Override
public
void
mouseRelease
(
int
buttons
)
{
mouseButtonsState
&=
~
buttons
;
checkMousePos
();
mouseEvent
(
fDevice
.
getCGDisplayID
(),
mouseLastX
,
mouseLastY
,
buttons
,
false
,
false
);
}
/**
* Set unknown mouse location, if needed.
*/
private
void
checkMousePos
()
{
if
(
mouseLastX
==
MOUSE_LOCATION_UNKNOWN
||
mouseLastY
==
MOUSE_LOCATION_UNKNOWN
)
{
Rectangle
deviceBounds
=
fDevice
.
getDefaultConfiguration
().
getBounds
();
Point
mousePos
=
CCursorManager
.
getInstance
().
getCursorPosition
();
if
(
mousePos
.
x
<
deviceBounds
.
x
)
{
mousePos
.
x
=
deviceBounds
.
x
;
}
else
if
(
mousePos
.
x
>
deviceBounds
.
x
+
deviceBounds
.
width
)
{
mousePos
.
x
=
deviceBounds
.
x
+
deviceBounds
.
width
;
}
if
(
mousePos
.
y
<
deviceBounds
.
y
)
{
mousePos
.
y
=
deviceBounds
.
y
;
}
else
if
(
mousePos
.
y
>
deviceBounds
.
y
+
deviceBounds
.
height
)
{
mousePos
.
y
=
deviceBounds
.
y
+
deviceBounds
.
height
;
}
mouseLastX
=
mousePos
.
x
;
mouseLastY
=
mousePos
.
y
;
}
}
@Override
public
native
void
mouseWheel
(
int
wheelAmt
);
...
...
src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java
浏览文件 @
57e0914c
...
...
@@ -143,11 +143,6 @@ public class CViewPlatformEmbeddedFrame implements PlatformWindow {
public
void
setAlwaysOnTop
(
boolean
value
)
{
}
@Override
public
PlatformWindow
getTopmostPlatformWindowUnderMouse
()
{
return
null
;
}
@Override
public
void
updateFocusableWindowState
()
{
}
...
...
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
浏览文件 @
57e0914c
...
...
@@ -917,4 +917,9 @@ public final class LWCToolkit extends LWToolkit {
!
path
.
endsWith
(
"/"
)
&&
!
path
.
endsWith
(
"."
);
}
@Override
protected
PlatformWindow
getPlatformWindowUnderMouse
()
{
return
CPlatformWindow
.
nativeGetTopmostPlatformWindowUnderMouse
();
}
}
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
57e0914c
...
...
@@ -1258,15 +1258,16 @@ JNIEXPORT jobject
JNICALL
Java_sun_lwawt_macosx_CPlatformWindow_nativeGetTopmostPlatformWindowUnderMouse
(
JNIEnv
*
env
,
jclass
clazz
)
{
jobject
topmostWindowUnderMouse
=
nil
;
__block
jobject
topmostWindowUnderMouse
=
nil
;
JNF_COCOA_ENTER
(
env
);
AWT_ASSERT_APPKIT_THREAD
;
AWTWindow
*
awtWindow
=
[
AWTWindow
getTopmostWindowUnderMouse
];
if
(
awtWindow
!=
nil
)
{
topmostWindowUnderMouse
=
[
awtWindow
.
javaPlatformWindow
jObject
];
}
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
{
AWTWindow
*
awtWindow
=
[
AWTWindow
getTopmostWindowUnderMouse
];
if
(
awtWindow
!=
nil
)
{
topmostWindowUnderMouse
=
[
awtWindow
.
javaPlatformWindow
jObject
];
}
}];
JNF_COCOA_EXIT
(
env
);
...
...
src/macosx/native/sun/awt/CCursorManager.m
浏览文件 @
57e0914c
...
...
@@ -118,13 +118,11 @@ Java_sun_lwawt_macosx_CCursorManager_nativeGetCursorPosition
JNF_COCOA_ENTER
(
env
);
__block
NSPoint
pt
=
NSZeroPoint
;
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
pt
=
ConvertNSScreenPoint
(
env
,
[
NSEvent
mouseLocation
]);
}];
jpt
=
NSToJavaPoint
(
env
,
pt
);
CGEventRef
event
=
CGEventCreate
(
NULL
);
CGPoint
globalPos
=
CGEventGetLocation
(
event
);
CFRelease
(
event
);
jpt
=
NSToJavaPoint
(
env
,
globalPos
);
JNF_COCOA_EXIT
(
env
);
...
...
src/macosx/native/sun/awt/CRobot.m
浏览文件 @
57e0914c
...
...
@@ -146,47 +146,10 @@ Java_sun_lwawt_macosx_CRobot_mouseEvent
// This is the native method called when Robot mouse events occur.
// The CRobot tracks the mouse position, and which button was
// pressed. If the mouse position is unknown it is obtained from
// CGEvents. The peer also tracks the mouse button desired state,
// pressed. The peer also tracks the mouse button desired state,
// the appropriate key modifier state, and whether the mouse action
// is simply a mouse move with no mouse button state changes.
CGError
err
=
kCGErrorSuccess
;
CGRect
globalDeviceBounds
=
CGDisplayBounds
(
displayID
);
// Set unknown mouse location, if needed.
if
((
mouseLastX
==
sun_lwawt_macosx_CRobot_MOUSE_LOCATION_UNKNOWN
)
||
(
mouseLastY
==
sun_lwawt_macosx_CRobot_MOUSE_LOCATION_UNKNOWN
))
{
CGEventRef
event
=
CGEventCreate
(
NULL
);
if
(
event
==
NULL
)
{
return
;
}
CGPoint
globalPos
=
CGEventGetLocation
(
event
);
CFRelease
(
event
);
// Normalize the coords within this display device, as
// per Robot rules.
if
(
globalPos
.
x
<
CGRectGetMinX
(
globalDeviceBounds
))
{
globalPos
.
x
=
CGRectGetMinX
(
globalDeviceBounds
);
}
else
if
(
globalPos
.
x
>
CGRectGetMaxX
(
globalDeviceBounds
))
{
globalPos
.
x
=
CGRectGetMaxX
(
globalDeviceBounds
);
}
if
(
globalPos
.
y
<
CGRectGetMinY
(
globalDeviceBounds
))
{
globalPos
.
y
=
CGRectGetMinY
(
globalDeviceBounds
);
}
else
if
(
globalPos
.
y
>
CGRectGetMaxY
(
globalDeviceBounds
))
{
globalPos
.
y
=
CGRectGetMaxY
(
globalDeviceBounds
);
}
mouseLastX
=
(
jint
)
globalPos
.
x
;
mouseLastY
=
(
jint
)
globalPos
.
y
;
}
// volatile, otherwise it warns that it might be clobbered by 'longjmp'
volatile
CGPoint
point
;
...
...
test/java/awt/MouseInfo/GetPointerInfoTest.java
0 → 100644
浏览文件 @
57e0914c
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@summary unit test for getPointerInfo() from MouseInfo class
@author dav@sparc.spb.su: area=
@bug 4009555
@run main GetPointerInfoTest
*/
import
java.awt.*
;
/**
* Simply check the result on non-null and results are correct.
*/
public
class
GetPointerInfoTest
{
private
static
final
String
successStage
=
"Test stage completed.Passed."
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsDevice
[]
gds
=
ge
.
getScreenDevices
();
int
gdslen
=
gds
.
length
;
System
.
out
.
println
(
"There are "
+
gdslen
+
" Graphics Devices"
);
if
(
gdslen
==
0
)
{
System
.
out
.
println
(
"Nothing to be done."
);
return
;
}
Robot
robot
=
new
Robot
(
gds
[
0
]);
robot
.
setAutoDelay
(
0
);
robot
.
setAutoWaitForIdle
(
true
);
robot
.
delay
(
10
);
robot
.
waitForIdle
();
Point
p
=
new
Point
(
101
,
99
);
robot
.
mouseMove
(
p
.
x
,
p
.
y
);
PointerInfo
pi
=
MouseInfo
.
getPointerInfo
();
if
(
pi
==
null
)
{
throw
new
RuntimeException
(
"Test failed. getPointerInfo() returned null value."
);
}
else
{
System
.
out
.
println
(
successStage
);
}
Point
piLocation
=
pi
.
getLocation
();
if
(
piLocation
.
x
!=
p
.
x
||
piLocation
.
y
!=
p
.
y
)
{
throw
new
RuntimeException
(
"Test failed.getPointerInfo() returned incorrect result."
);
}
else
{
System
.
out
.
println
(
successStage
);
}
System
.
out
.
println
(
"Test PASSED."
);
}
}
test/java/awt/MouseInfo/MultiscreenPointerInfo.java
0 → 100644
浏览文件 @
57e0914c
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@summary unit test for getPointerInfo() from MouseInfo class
@author prs@sparc.spb.su: area=
@bug 4009555
@run main MultiscreenPointerInfo
*/
import
java.awt.*
;
/**
* Simply check the result on non-null and results are correct.
*/
public
class
MultiscreenPointerInfo
{
private
static
final
String
successStage
=
"Test stage completed.Passed."
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsDevice
[]
gds
=
ge
.
getScreenDevices
();
int
gdslen
=
gds
.
length
;
System
.
out
.
println
(
"There are "
+
gdslen
+
" Graphics Devices"
);
if
(
gdslen
<
2
)
{
System
.
out
.
println
(
"Nothing to be done. PASSED automatically."
);
return
;
}
Rectangle
rx
=
gds
[
1
].
getDefaultConfiguration
().
getBounds
();
Robot
robot
;
if
(
rx
.
x
==
0
&&
rx
.
y
==
0
)
{
// Assuming independent graphics devices
robot
=
new
Robot
(
gds
[
1
]);
}
else
{
// Means we have a virtual device
robot
=
new
Robot
(
gds
[
0
]);
}
robot
.
setAutoDelay
(
0
);
robot
.
setAutoWaitForIdle
(
true
);
robot
.
delay
(
10
);
robot
.
waitForIdle
();
Point
p
=
new
Point
(
rx
.
x
+
101
,
rx
.
y
+
99
);
robot
.
mouseMove
(
p
.
x
,
p
.
y
);
PointerInfo
pi
=
MouseInfo
.
getPointerInfo
();
if
(
pi
==
null
)
{
throw
new
RuntimeException
(
"Test failed. getPointerInfo() returned null value."
);
}
else
{
System
.
out
.
println
(
successStage
);
}
Point
piLocation
=
pi
.
getLocation
();
if
(
piLocation
.
x
!=
p
.
x
||
piLocation
.
y
!=
p
.
y
)
{
throw
new
RuntimeException
(
"Test failed.getPointerInfo() returned incorrect location."
);
}
else
{
System
.
out
.
println
(
successStage
);
}
GraphicsDevice
dev
=
pi
.
getDevice
();
if
(
dev
!=
gds
[
1
])
{
throw
new
RuntimeException
(
"Test failed.getPointerInfo() returned incorrect device."
);
}
else
{
System
.
out
.
println
(
successStage
);
}
System
.
out
.
println
(
"Test PASSED."
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录