Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
8d0b9cb0
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8d0b9cb0
编写于
4月 20, 2020
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8242174: [macos] The NestedModelessDialogTest test make the macOS unstable
Reviewed-by: prr
上级
606da936
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
14 deletion
+54
-14
src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m
src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m
+45
-6
test/jdk/ProblemList.txt
test/jdk/ProblemList.txt
+2
-2
test/jdk/java/awt/Toolkit/RealSync/Test.java
test/jdk/java/awt/Toolkit/RealSync/Test.java
+7
-6
未找到文件。
src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m
浏览文件 @
8d0b9cb0
...
...
@@ -67,6 +67,7 @@ static NSTimeInterval gsLastClickTime;
// happen with z-order.
static
int
gsEventNumber
;
static
int
*
gsButtonEventNumber
;
static
NSTimeInterval
gNextKeyEventTime
;
static
inline
CGKeyCode
GetCGKeyCode
(
jint
javaKeyCode
);
...
...
@@ -84,6 +85,28 @@ CreateJavaException(JNIEnv* env, CGError err)
[
s
UTF8String
]);
}
/**
* Saves the "safe moment" when the NEXT event can be posted by the robot safely
* and sleeps for some time if the "safe moment" for the CURRENT event is not
* reached.
*
* We need to sleep to give time for the macOS to update the state.
*
* The "mouse move" events are skipped, because it is not a big issue if we lost
* some of them, the latest coordinates are saved in the peer and will be used
* for clicks.
*/
static
inline
void
autoDelay
(
BOOL
isMove
)
{
if
(
!
isMove
){
NSTimeInterval
now
=
[[
NSDate
date
]
timeIntervalSinceReferenceDate
];
NSTimeInterval
delay
=
gNextKeyEventTime
-
now
;
if
(
delay
>
0
)
{
[
NSThread
sleepForTimeInterval
:
delay
];
}
}
gNextKeyEventTime
=
[[
NSDate
date
]
timeIntervalSinceReferenceDate
]
+
0
.
050
;
}
/*
* Class: sun_lwawt_macosx_CRobot
* Method: initRobot
...
...
@@ -119,6 +142,7 @@ Java_sun_lwawt_macosx_CRobot_initRobot
gsClickCount
=
0
;
gsLastClickTime
=
0
;
gNextKeyEventTime
=
0
;
gsEventNumber
=
ROBOT_EVENT_NUMBER_START
;
gsButtonEventNumber
=
(
int
*
)
SAFE_SIZE_ARRAY_ALLOC
(
malloc
,
sizeof
(
int
),
gNumberOfButtons
);
...
...
@@ -145,6 +169,7 @@ Java_sun_lwawt_macosx_CRobot_mouseEvent
jboolean
isButtonsDownState
,
jboolean
isMouseMove
)
{
JNF_COCOA_ENTER
(
env
);
autoDelay
(
isMouseMove
);
// This is the native method called when Robot mouse events occur.
// The CRobot tracks the mouse position, and which button was
...
...
@@ -241,14 +266,19 @@ JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CRobot_mouseWheel
(
JNIEnv
*
env
,
jobject
peer
,
jint
wheelAmt
)
{
autoDelay
(
NO
);
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
CGEventRef
event
=
CGEventCreateScrollWheelEvent
(
NULL
,
CGEventSourceRef
source
=
CGEventSourceCreate
(
kCGEventSourceStateHIDSystemState
);
CGEventRef
event
=
CGEventCreateScrollWheelEvent
(
source
,
kCGScrollEventUnitLine
,
k_JAVA_ROBOT_WHEEL_COUNT
,
wheelAmt
);
if
(
event
!=
NULL
)
{
CGEventPost
(
kCG
Session
EventTap
,
event
);
CGEventPost
(
kCG
HID
EventTap
,
event
);
CFRelease
(
event
);
}
if
(
source
!=
NULL
)
{
CFRelease
(
source
);
}
}];
}
...
...
@@ -261,13 +291,18 @@ JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CRobot_keyEvent
(
JNIEnv
*
env
,
jobject
peer
,
jint
javaKeyCode
,
jboolean
keyPressed
)
{
autoDelay
(
NO
);
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
CGEventSourceRef
source
=
CGEventSourceCreate
(
kCGEventSourceStateHIDSystemState
);
CGKeyCode
keyCode
=
GetCGKeyCode
(
javaKeyCode
);
CGEventRef
event
=
CGEventCreateKeyboardEvent
(
NULL
,
keyCode
,
keyPressed
);
CGEventRef
event
=
CGEventCreateKeyboardEvent
(
source
,
keyCode
,
keyPressed
);
if
(
event
!=
NULL
)
{
CGEventPost
(
kCG
Session
EventTap
,
event
);
CGEventPost
(
kCG
HID
EventTap
,
event
);
CFRelease
(
event
);
}
if
(
source
!=
NULL
)
{
CFRelease
(
source
);
}
}];
}
...
...
@@ -338,13 +373,17 @@ static void PostMouseEvent(const CGPoint point, CGMouseButton button,
CGEventType
type
,
int
clickCount
,
int
eventNumber
)
{
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
CGEventRef
mouseEvent
=
CGEventCreateMouseEvent
(
NULL
,
type
,
point
,
button
);
CGEventSourceRef
source
=
CGEventSourceCreate
(
kCGEventSourceStateHIDSystemState
);
CGEventRef
mouseEvent
=
CGEventCreateMouseEvent
(
source
,
type
,
point
,
button
);
if
(
mouseEvent
!=
NULL
)
{
CGEventSetIntegerValueField
(
mouseEvent
,
kCGMouseEventClickState
,
clickCount
);
CGEventSetIntegerValueField
(
mouseEvent
,
kCGMouseEventNumber
,
eventNumber
);
CGEventPost
(
kCG
Session
EventTap
,
mouseEvent
);
CGEventPost
(
kCG
HID
EventTap
,
mouseEvent
);
CFRelease
(
mouseEvent
);
}
if
(
source
!=
NULL
)
{
CFRelease
(
source
);
}
}];
}
...
...
test/jdk/ProblemList.txt
浏览文件 @
8d0b9cb0
...
...
@@ -168,7 +168,6 @@ java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java 6829264
java/awt/datatransfer/DragImage/MultiResolutionDragImageTest.java 8080982 generic-all
java/awt/datatransfer/SystemFlavorMap/AddFlavorTest.java 8079268 linux-all
java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java 6829250 windows-all
java/awt/Toolkit/RealSync/Test.java 6849383 macosx-all
java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java 8159252 windows-all
java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java 8203047 macosx-all
java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.html 8073636 macosx-all
...
...
@@ -195,7 +194,7 @@ java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java 8196017 windo
java/awt/Scrollbar/ScrollbarMouseWheelTest/ScrollbarMouseWheelTest.java 8196018 windows-all,linux-all
java/awt/TrayIcon/ActionCommand/ActionCommand.java 8150540 windows-all
java/awt/TrayIcon/ActionEventMask/ActionEventMask.java 8150540 windows-all
java/awt/TrayIcon/ActionEventTest/ActionEventTest.java 8150540
windows
-all
java/awt/TrayIcon/ActionEventTest/ActionEventTest.java 8150540
,8242801 windows-all,macosx
-all
java/awt/TrayIcon/ModalityTest/ModalityTest.java 8150540 windows-all,macosx-all
java/awt/TrayIcon/MouseEventMask/MouseEventMaskTest.java 8150540 windows-all
java/awt/TrayIcon/MouseMovedTest/MouseMovedTest.java 8150540 windows-all
...
...
@@ -503,6 +502,7 @@ java/awt/Window/WindowResizing/DoubleClickTitleBarTest.java 8233557 macosx-all
java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java 8233558 macosx-all
java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java 8233564 macosx-all
java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java 8233565 macosx-all
java/awt/keyboard/AllKeyCode/AllKeyCode.java 8242930 macosx-all
java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java 8233566 macosx-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogTest/EnqueueWithDialogTest.java 8233566 macosx-all
java/awt/FullScreen/8013581/bug8013581.java 8169471 macosx-all
...
...
test/jdk/java/awt/Toolkit/RealSync/Test.java
浏览文件 @
8d0b9cb0
...
...
@@ -23,7 +23,7 @@
/*
@test
@bug 6252005
@bug 6252005
8242174
@key headful
@summary Tests that realSync feature works
@author denis.mikhalkin: area=awt.toolkit
...
...
@@ -31,16 +31,17 @@
@run main/timeout=6000 Test
*/
import
java.awt.Frame
;
import
java.awt.Point
;
import
java.awt.Robot
;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.util.LinkedList
;
import
java.util.Collections
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Modifier
;
import
java.util.Collections
;
import
java.util.LinkedList
;
import
javax.swing.*
;
import
java.awt.image.*
;
import
javax.imageio.*
;
import
java.io.*
;
/**
* Tests various problematic areas and how they are fixed using real-sync API:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录