Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3ffc31bc
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看板
提交
3ffc31bc
编写于
9月 06, 2016
作者:
D
dmarkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8050478: [macosx] Cursor not updating correctly after closing a modal dialog
Reviewed-by: serb, alexsch
上级
c430b74d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
161 addition
and
2 deletion
+161
-2
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+8
-0
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+25
-2
test/java/awt/Mouse/EnterExitEvents/ModalDialogEnterExitEventsTest.java
...Mouse/EnterExitEvents/ModalDialogEnterExitEventsTest.java
+128
-0
未找到文件。
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
3ffc31bc
...
@@ -61,6 +61,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -61,6 +61,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private
static
native
void
nativeSetNSWindowRepresentedFilename
(
long
nsWindowPtr
,
String
representedFilename
);
private
static
native
void
nativeSetNSWindowRepresentedFilename
(
long
nsWindowPtr
,
String
representedFilename
);
private
static
native
void
nativeSetEnabled
(
long
nsWindowPtr
,
boolean
isEnabled
);
private
static
native
void
nativeSetEnabled
(
long
nsWindowPtr
,
boolean
isEnabled
);
private
static
native
void
nativeSynthesizeMouseEnteredExitedEvents
();
private
static
native
void
nativeSynthesizeMouseEnteredExitedEvents
();
private
static
native
void
nativeSynthesizeMouseEnteredExitedEvents
(
long
nsWindowPtr
,
int
eventType
);
private
static
native
void
nativeDispose
(
long
nsWindowPtr
);
private
static
native
void
nativeDispose
(
long
nsWindowPtr
);
private
static
native
CPlatformWindow
nativeGetTopmostPlatformWindowUnderMouse
();
private
static
native
CPlatformWindow
nativeGetTopmostPlatformWindowUnderMouse
();
private
static
native
void
nativeEnterFullScreenMode
(
long
nsWindowPtr
);
private
static
native
void
nativeEnterFullScreenMode
(
long
nsWindowPtr
);
...
@@ -826,6 +827,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -826,6 +827,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
return
;
return
;
}
}
if
(
blocked
)
{
// We are going to show a modal window. Previously displayed window will be
// blocked/disabled. So we have to send mouse exited event to it now, since
// all mouse events are discarded for blocked/disabled windows.
nativeSynthesizeMouseEnteredExitedEvents
(
getNSWindowPtr
(),
CocoaConstants
.
NSMouseExited
);
}
nativeSetEnabled
(
getNSWindowPtr
(),
!
blocked
);
nativeSetEnabled
(
getNSWindowPtr
(),
!
blocked
);
checkBlockingAndOrder
();
checkBlockingAndOrder
();
}
}
...
...
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
3ffc31bc
...
@@ -1273,9 +1273,9 @@ JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeGetTopmostPlatformWindowUnde
...
@@ -1273,9 +1273,9 @@ JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeGetTopmostPlatformWindowUnde
/*
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSynthesizeMouseEnteredExitedEvents
* Method: nativeSynthesizeMouseEnteredExitedEvents
* Signature: (
J
)V
* Signature: ()V
*/
*/
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents
__
(
JNIEnv
*
env
,
jclass
clazz
)
(
JNIEnv
*
env
,
jclass
clazz
)
{
{
JNF_COCOA_ENTER
(
env
);
JNF_COCOA_ENTER
(
env
);
...
@@ -1287,6 +1287,29 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou
...
@@ -1287,6 +1287,29 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou
JNF_COCOA_EXIT
(
env
);
JNF_COCOA_EXIT
(
env
);
}
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeSynthesizeMouseEnteredExitedEvents
* Signature: (JI)V
*/
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents__JI
(
JNIEnv
*
env
,
jclass
clazz
,
jlong
windowPtr
,
jint
eventType
)
{
JNF_COCOA_ENTER
(
env
);
if
(
eventType
==
NSMouseEntered
||
eventType
==
NSMouseExited
)
{
NSWindow
*
nsWindow
=
OBJC
(
windowPtr
);
[
ThreadUtilities
performOnMainThreadWaiting
:
NO
block
:
^
(){
[
AWTWindow
synthesizeMouseEnteredExitedEvents
:
nsWindow
withType
:
eventType
];
}];
}
else
{
[
JNFException
raise
:
env
as
:
kIllegalArgumentException
reason
:
"unknown event type"
];
}
JNF_COCOA_EXIT
(
env
);
}
/*
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: _toggleFullScreenMode
* Method: _toggleFullScreenMode
...
...
test/java/awt/Mouse/EnterExitEvents/ModalDialogEnterExitEventsTest.java
0 → 100644
浏览文件 @
3ffc31bc
/*
* Copyright (c) 2016, 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
* @bug 8050478
* @summary Cursor not updating correctly after closing a modal dialog.
* The root cause of the issue was the lack of a mouse exit event
* during displaying of a modal dialog.
* @author Dmitry Markov
* @library ../../regtesthelpers
* @build Util
* @run main ModalDialogEnterExitEventsTest
*/
import
javax.swing.JButton
;
import
javax.swing.JDialog
;
import
javax.swing.JFrame
;
import
javax.swing.SwingUtilities
;
import
java.awt.FlowLayout
;
import
java.awt.Frame
;
import
java.awt.Robot
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
test.java.awt.regtesthelpers.Util
;
public
class
ModalDialogEnterExitEventsTest
{
private
static
volatile
AtomicInteger
mouseEnterCount
=
new
AtomicInteger
();
private
static
volatile
AtomicInteger
mouseExitCount
=
new
AtomicInteger
();
private
static
JFrame
frame
;
private
static
JButton
openButton
;
private
static
JButton
closeButton
;
public
static
void
main
(
String
[]
args
)
{
Robot
robot
=
Util
.
createRobot
();
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
@Override
public
void
run
()
{
createAndShowGUI
();
}
});
Util
.
waitForIdle
(
robot
);
Util
.
clickOnComp
(
frame
,
robot
,
500
);
Util
.
waitForIdle
(
robot
);
mouseEnterCount
.
set
(
0
);
mouseExitCount
.
set
(
0
);
Util
.
clickOnComp
(
openButton
,
robot
,
500
);
Util
.
waitForIdle
(
robot
);
if
(
mouseExitCount
.
get
()
!=
1
)
{
throw
new
RuntimeException
(
"Test FAILED. Wrong number of MouseExited events = "
+
mouseExitCount
.
get
());
}
Util
.
clickOnComp
(
closeButton
,
robot
,
500
);
Util
.
waitForIdle
(
robot
);
if
(
mouseEnterCount
.
get
()
!=
1
)
{
throw
new
RuntimeException
(
"Test FAILED. Wrong number of MouseEntered events = "
+
mouseEnterCount
.
get
());
}
}
private
static
void
createAndShowGUI
()
{
frame
=
new
JFrame
(
"ModalDialogEnterExitEventsTest"
);
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
setLayout
(
new
FlowLayout
());
frame
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseExited
(
MouseEvent
e
)
{
mouseExitCount
.
getAndIncrement
();
}
@Override
public
void
mouseEntered
(
MouseEvent
e
)
{
mouseEnterCount
.
getAndIncrement
();
}
});
openButton
=
new
JButton
(
"Open Dialog"
);
openButton
.
addActionListener
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
JDialog
dialog
=
new
JDialog
(
frame
,
"Modal Dialog"
,
true
);
dialog
.
setLayout
(
new
FlowLayout
());
closeButton
=
new
JButton
(
"Close"
);
closeButton
.
addActionListener
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
dialog
.
dispose
();
}
});
dialog
.
add
(
closeButton
);
dialog
.
setSize
(
200
,
200
);
dialog
.
setLocationRelativeTo
(
null
);
dialog
.
setVisible
(
true
);
}
});
frame
.
add
(
openButton
);
frame
.
setExtendedState
(
Frame
.
MAXIMIZED_BOTH
);
frame
.
setVisible
(
true
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录