Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3a75e3fb
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看板
提交
3a75e3fb
编写于
7月 29, 2009
作者:
Y
yan
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
cd8f91ce
f01a2151
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
81 addition
and
42 deletion
+81
-42
src/solaris/classes/sun/awt/X11/XRobotPeer.java
src/solaris/classes/sun/awt/X11/XRobotPeer.java
+4
-2
src/solaris/native/sun/awt/awt_Robot.c
src/solaris/native/sun/awt/awt_Robot.c
+9
-12
test/java/awt/EventQueue/6638195/bug6638195.java
test/java/awt/EventQueue/6638195/bug6638195.java
+15
-3
test/java/awt/Frame/FrameSize/TestFrameSize.java
test/java/awt/Frame/FrameSize/TestFrameSize.java
+53
-25
未找到文件。
src/solaris/classes/sun/awt/X11/XRobotPeer.java
浏览文件 @
3a75e3fb
...
...
@@ -27,6 +27,7 @@ package sun.awt.X11;
import
java.awt.*
;
import
java.awt.peer.*
;
import
sun.awt.X11GraphicsConfig
;
import
sun.awt.SunToolkit
;
class
XRobotPeer
implements
RobotPeer
{
private
X11GraphicsConfig
xgc
=
null
;
...
...
@@ -38,7 +39,8 @@ class XRobotPeer implements RobotPeer {
XRobotPeer
(
GraphicsConfiguration
gc
)
{
this
.
xgc
=
(
X11GraphicsConfig
)
gc
;
setup
();
SunToolkit
tk
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
setup
(
tk
.
getNumberOfButtons
());
}
public
void
dispose
()
{
...
...
@@ -81,7 +83,7 @@ class XRobotPeer implements RobotPeer {
return
pixelArray
;
}
private
static
native
synchronized
void
setup
();
private
static
native
synchronized
void
setup
(
int
numberOfButtons
);
private
static
native
synchronized
void
mouseMoveImpl
(
X11GraphicsConfig
xgc
,
int
x
,
int
y
);
private
static
native
synchronized
void
mousePressImpl
(
int
buttons
);
...
...
src/solaris/native/sun/awt/awt_Robot.c
浏览文件 @
3a75e3fb
...
...
@@ -51,9 +51,8 @@
extern
struct
X11GraphicsConfigIDs
x11GraphicsConfigIDs
;
extern
int32_t
getNumButtons
();
static
jint
*
masks
;
static
jint
num_buttons
;
static
int32_t
isXTestAvailable
()
{
int32_t
major_opcode
,
first_event
,
first_error
;
...
...
@@ -164,34 +163,34 @@ static XImage *getWindowImage(Display * display, Window window,
/*********************************************************************************************/
// this should be called from XRobotPeer constructor
JNIEXPORT
void
JNICALL
Java_sun_awt_X11_XRobotPeer_setup
(
JNIEnv
*
env
,
jclass
cls
)
{
Java_sun_awt_X11_XRobotPeer_setup
(
JNIEnv
*
env
,
jclass
cls
,
jint
numberOfButtons
)
{
int32_t
xtestAvailable
;
// this should be called from XRobotPeer constructor
DTRACE_PRINTLN
(
"RobotPeer: setup()"
);
num_buttons
=
numberOfButtons
;
jclass
inputEventClazz
=
(
*
env
)
->
FindClass
(
env
,
"java/awt/event/InputEvent"
);
jmethodID
getButtonDownMasksID
=
(
*
env
)
->
GetStaticMethodID
(
env
,
inputEventClazz
,
"getButtonDownMasks"
,
"()[I"
);
jintArray
obj
=
(
jintArray
)(
*
env
)
->
CallStaticObjectMethod
(
env
,
inputEventClazz
,
getButtonDownMasksID
);
jsize
len
=
(
*
env
)
->
GetArrayLength
(
env
,
obj
);
jint
*
tmp
=
(
*
env
)
->
GetIntArrayElements
(
env
,
obj
,
JNI_FALSE
);
masks
=
(
jint
*
)
malloc
(
sizeof
(
jint
)
*
len
);
masks
=
(
jint
*
)
malloc
(
sizeof
(
jint
)
*
num_buttons
);
if
(
masks
==
(
jint
*
)
NULL
)
{
JNU_ThrowOutOfMemoryError
((
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
),
NULL
);
goto
finally
;
}
int
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
num_buttons
;
i
++
)
{
masks
[
i
]
=
tmp
[
i
];
}
(
*
env
)
->
ReleaseIntArrayElements
(
env
,
obj
,
tmp
,
0
);
(
*
env
)
->
DeleteLocalRef
(
env
,
obj
);
DTRACE_PRINTLN
(
"RobotPeer: setup()"
);
AWT_LOCK
();
xtestAvailable
=
isXTestAvailable
();
DTRACE_PRINTLN1
(
"RobotPeer: XTest available = %d"
,
xtestAvailable
);
if
(
!
xtestAvailable
)
{
...
...
@@ -338,8 +337,6 @@ void mouseAction(JNIEnv *env,
{
AWT_LOCK
();
int32_t
num_buttons
=
getNumButtons
();
//from XToolkit.c
DTRACE_PRINTLN1
(
"RobotPeer: mouseAction(%i)"
,
buttonMask
);
DTRACE_PRINTLN1
(
"RobotPeer: mouseAction, press = %d"
,
isMousePress
);
...
...
test/java/awt/EventQueue/6638195/bug6638195.java
浏览文件 @
3a75e3fb
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008
-2009
Sun Microsystems, Inc. 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
...
...
@@ -23,7 +23,7 @@
/* @test
*
* @bug 6638195
* @bug 6638195
6844297
* @author Igor Kushnirskiy
* @summary tests if EventQueueDelegate.Delegate is invoked.
*/
...
...
@@ -47,11 +47,22 @@ public class bug6638195 {
}
private
static
void
runTest
(
MyEventQueueDelegate
delegate
)
throws
Exception
{
// We need an empty runnable here, so the next event is
// processed with a new EventQueueDelegate. See 6844297
// for details
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
}
});
// The following event is expected to be processed by
// the EventQueueDelegate instance
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
}
});
// Finally, proceed on the main thread
final
CountDownLatch
latch
=
new
CountDownLatch
(
1
);
EventQueue
.
invokeLater
(
new
Runnable
()
{
...
...
@@ -60,7 +71,7 @@ public class bug6638195 {
}
});
latch
.
await
();
if
(!
delegate
.
allInvoked
())
{
if
(!
delegate
.
allInvoked
())
{
throw
new
RuntimeException
(
"failed"
);
}
}
...
...
@@ -125,6 +136,7 @@ public class bug6638195 {
return
objectMap
;
}
static
class
MyEventQueueDelegate
implements
EventQueueDelegate
.
Delegate
{
private
volatile
boolean
getNextEventInvoked
=
false
;
private
volatile
boolean
beforeDispatchInvoked
=
false
;
...
...
test/java/awt/Frame/FrameSize/TestFrameSize.java
浏览文件 @
3a75e3fb
/*
* Copyright 2009 Red Hat, Inc. All Rights Reserved.
* Portions Copyright 2009 Sun Microsystems, Inc. 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
...
...
@@ -37,35 +38,62 @@
* Test fails if size of window is wrong
*/
import
java.awt.Dimension
;
import
java.awt.Frame
;
import
java.awt.*
;
public
class
TestFrameSize
{
static
Dimension
desiredDimensions
=
new
Dimension
(
200
,
200
);
static
int
ERROR_MARGIN
=
15
;
static
Frame
mainWindow
;
public
static
void
drawGui
()
{
mainWindow
=
new
Frame
(
""
);
mainWindow
.
setPreferredSize
(
desiredDimensions
);
mainWindow
.
pack
();
Dimension
actualDimensions
=
mainWindow
.
getSize
();
System
.
out
.
println
(
"Desired dimensions: "
+
desiredDimensions
.
toString
());
System
.
out
.
println
(
"Actual dimensions: "
+
actualDimensions
.
toString
());
if
(
Math
.
abs
(
actualDimensions
.
height
-
desiredDimensions
.
height
)
>
ERROR_MARGIN
)
{
throw
new
RuntimeException
(
"Incorrect widow size"
);
}
static
Dimension
desiredDimensions
=
new
Dimension
(
200
,
200
);
static
Frame
mainWindow
;
private
static
Dimension
getClientSize
(
Frame
window
)
{
Dimension
size
=
window
.
getSize
();
Insets
insets
=
window
.
getInsets
();
System
.
out
.
println
(
"getClientSize() for "
+
window
);
System
.
out
.
println
(
" size: "
+
size
);
System
.
out
.
println
(
" insets: "
+
insets
);
return
new
Dimension
(
size
.
width
-
insets
.
left
-
insets
.
right
,
size
.
height
-
insets
.
top
-
insets
.
bottom
);
}
public
static
void
drawGui
()
{
mainWindow
=
new
Frame
(
""
);
mainWindow
.
setPreferredSize
(
desiredDimensions
);
mainWindow
.
pack
();
Dimension
actualDimensions
=
mainWindow
.
getSize
();
System
.
out
.
println
(
"Desired dimensions: "
+
desiredDimensions
.
toString
());
System
.
out
.
println
(
"Actual dimensions: "
+
actualDimensions
.
toString
());
if
(!
actualDimensions
.
equals
(
desiredDimensions
))
{
throw
new
RuntimeException
(
"Incorrect widow size"
);
}
// pack() guarantees to preserve the size of the client area after
// showing the window.
Dimension
clientSize1
=
getClientSize
(
mainWindow
);
System
.
out
.
println
(
"Client size before showing: "
+
clientSize1
);
mainWindow
.
setVisible
(
true
);
((
sun
.
awt
.
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
Dimension
clientSize2
=
getClientSize
(
mainWindow
);
System
.
out
.
println
(
"Client size after showing: "
+
clientSize2
);
if
(!
clientSize2
.
equals
(
clientSize1
))
{
throw
new
RuntimeException
(
"Incorrect client area size."
);
}
}
public
static
void
main
(
String
[]
args
)
{
try
{
drawGui
();
}
finally
{
if
(
mainWindow
!=
null
)
{
mainWindow
.
dispose
();
}
}
public
static
void
main
(
String
[]
args
)
{
try
{
drawGui
();
}
finally
{
if
(
mainWindow
!=
null
)
{
mainWindow
.
dispose
();
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录