Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ef70dd7a
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看板
提交
ef70dd7a
编写于
6月 04, 2012
作者:
O
omajid
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7043963: AWT workaround missing for Mutter.
Reviewed-by: art, anthony Contributed-by:
N
Denis Lila
<
dlila@redhat.com
>
上级
42619e4d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
189 addition
and
11 deletion
+189
-11
src/solaris/classes/sun/awt/X11/XDecoratedPeer.java
src/solaris/classes/sun/awt/X11/XDecoratedPeer.java
+7
-5
src/solaris/classes/sun/awt/X11/XWM.java
src/solaris/classes/sun/awt/X11/XWM.java
+10
-1
test/java/awt/WMSpecificTests/Mutter/MutterMaximizeTest.java
test/java/awt/WMSpecificTests/Mutter/MutterMaximizeTest.java
+160
-0
test/java/awt/regtesthelpers/Util.java
test/java/awt/regtesthelpers/Util.java
+12
-5
未找到文件。
src/solaris/classes/sun/awt/X11/XDecoratedPeer.java
浏览文件 @
ef70dd7a
...
...
@@ -721,15 +721,17 @@ abstract class XDecoratedPeer extends XWindowPeer {
// Location, Client size + insets
newLocation
=
new
Point
(
xe
.
get_x
()
-
currentInsets
.
left
,
xe
.
get_y
()
-
currentInsets
.
top
);
}
else
{
// CDE/MWM/Metacity/Sawfish bug: if shell is resized using
// top or left border, we don't receive synthetic
// ConfigureNotify, only the one from X with zero
// coordinates. This is the workaround to get real
// location, 6261336
// ICCCM 4.1.5 states that a real ConfigureNotify will be sent when
// a window is resized but the client can not tell if the window was
// moved or not. The client should consider the position as unkown
// and use TranslateCoordinates to find the actual position.
//
// TODO this should be the default for every case.
switch
(
XWM
.
getWMID
())
{
case
XWM
.
CDE_WM
:
case
XWM
.
MOTIF_WM
:
case
XWM
.
METACITY_WM
:
case
XWM
.
MUTTER_WM
:
case
XWM
.
SAWFISH_WM
:
{
Point
xlocation
=
queryXLocation
();
...
...
src/solaris/classes/sun/awt/X11/XWM.java
浏览文件 @
ef70dd7a
...
...
@@ -102,7 +102,8 @@ final class XWM
METACITY_WM
=
11
,
COMPIZ_WM
=
12
,
LG3D_WM
=
13
,
CWM_WM
=
14
;
CWM_WM
=
14
,
MUTTER_WM
=
15
;
public
String
toString
()
{
switch
(
WMID
)
{
case
NO_WM:
...
...
@@ -131,6 +132,8 @@ final class XWM
return
"LookingGlass"
;
case
CWM_WM:
return
"CWM"
;
case
MUTTER_WM:
return
"Mutter"
;
case
UNDETERMINED_WM:
default
:
return
"Undetermined WM"
;
...
...
@@ -573,6 +576,10 @@ final class XWM
// getIntProperty(XToolkit.getDefaultRootWindow(), XAtom.XA_CARDINAL)) == 0);
}
static
boolean
isMutter
()
{
return
isNetWMName
(
"Mutter"
);
}
static
boolean
isNonReparentingWM
()
{
return
(
XWM
.
getWMID
()
==
XWM
.
COMPIZ_WM
||
XWM
.
getWMID
()
==
XWM
.
LG3D_WM
||
XWM
.
getWMID
()
==
XWM
.
CWM_WM
);
}
...
...
@@ -742,6 +749,8 @@ final class XWM
awt_wmgr
=
XWM
.
ENLIGHTEN_WM
;
}
else
if
(
isMetacity
())
{
awt_wmgr
=
XWM
.
METACITY_WM
;
}
else
if
(
isMutter
())
{
awt_wmgr
=
XWM
.
MUTTER_WM
;
}
else
if
(
isSawfish
())
{
awt_wmgr
=
XWM
.
SAWFISH_WM
;
}
else
if
(
isKDE2
())
{
...
...
test/java/awt/WMSpecificTests/Mutter/MutterMaximizeTest.java
0 → 100644
浏览文件 @
ef70dd7a
/*
* Copyright 2012 Red Hat, Inc. All Rights Reserved.
* Copyright (c) 2012, 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 7043963
@summary Tests that the screen location of windows is
updated properly after a maximize.
@author Denis Lila
@library ../../regtesthelpers
@build Util
@run main MutterMaximizeTest
*/
import
java.awt.AWTException
;
import
java.awt.Dimension
;
import
java.awt.Frame
;
import
java.awt.Point
;
import
java.awt.Robot
;
import
java.awt.Window
;
import
java.awt.event.InputEvent
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
test.java.awt.regtesthelpers.Util
;
@SuppressWarnings
(
"serial"
)
public
class
MutterMaximizeTest
extends
Frame
{
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
if
(
Util
.
getWMID
()
!=
Util
.
MUTTER_WM
)
{
System
.
out
.
println
(
"This test is only useful on Mutter"
);
return
;
}
MutterMaximizeTest
frame
=
new
MutterMaximizeTest
();
frame
.
addWindowListener
(
Util
.
getClosingWindowAdapter
());
//Display the window.
frame
.
setSize
(
500
,
500
);
Util
.
showWindowWait
(
frame
);
runRobotTest
(
frame
);
}
private
static
void
runRobotTest
(
Frame
frame
)
{
try
{
Thread
robotThread
=
startRegTest
(
frame
);
robotThread
.
start
();
waitForThread
(
robotThread
);
}
finally
{
frame
.
dispose
();
}
}
private
static
void
waitForThread
(
Thread
t
)
{
while
(
t
.
isAlive
())
{
try
{
t
.
join
();
}
catch
(
InterruptedException
e
)
{
}
}
}
private
static
void
sleepFor
(
long
millis
)
{
long
dT
=
0
;
long
start
=
System
.
nanoTime
();
while
(
dT
<
millis
)
{
try
{
long
toSleep
=
millis
-
dT
/
1000000
;
if
(
toSleep
>
0
)
{
Thread
.
sleep
(
toSleep
);
}
// if this ends without an interrupted exception,
// that's good enough.
break
;
}
catch
(
InterruptedException
e
)
{
long
now
=
System
.
nanoTime
();
dT
=
now
-
start
;
}
}
}
private
static
void
rmove
(
Robot
robot
,
Point
p
)
{
robot
.
mouseMove
(
p
.
x
,
p
.
y
);
}
private
static
void
rdown
(
Robot
robot
)
{
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
delay
(
50
);
}
private
static
void
rup
(
Robot
robot
)
{
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
robot
.
delay
(
50
);
}
public
static
void
click
(
Robot
robot
)
{
rdown
(
robot
);
rup
(
robot
);
}
public
static
void
doubleClick
(
Robot
robot
)
{
click
(
robot
);
click
(
robot
);
}
private
static
void
dragWindow
(
Window
w
,
int
dx
,
int
dy
,
Robot
robot
)
{
Point
p
=
Util
.
getTitlePoint
(
w
);
rmove
(
robot
,
p
);
rdown
(
robot
);
p
.
translate
(
dx
,
dy
);
rmove
(
robot
,
p
);
rup
(
robot
);
}
// f must be visible
private
static
Thread
startRegTest
(
final
Frame
f
)
{
Thread
robot
=
new
Thread
(
new
Runnable
()
{
public
void
run
()
{
Robot
r
=
Util
.
createRobot
();
dragWindow
(
f
,
100
,
100
,
r
);
// wait for the location to be set.
sleepFor
(
2000
);
final
Point
l2
=
f
.
getLocationOnScreen
();
// double click should maximize the frame
doubleClick
(
r
);
// wait for location again.
sleepFor
(
2000
);
final
Point
l3
=
f
.
getLocationOnScreen
();
if
(
l3
.
equals
(
l2
))
{
throw
new
RuntimeException
(
"Bad location after maximize. Window location has not moved"
);
}
}
});
return
robot
;
}
}
test/java/awt/regtesthelpers/Util.java
浏览文件 @
ef70dd7a
...
...
@@ -162,16 +162,21 @@ public final class Util {
clickOnComp
(
comp
,
robot
,
50
);
}
public
static
Point
getTitlePoint
(
Window
decoratedWindow
)
{
Point
p
=
decoratedWindow
.
getLocationOnScreen
();
Dimension
d
=
decoratedWindow
.
getSize
();
return
new
Point
(
p
.
x
+
(
int
)(
d
.
getWidth
()/
2
),
p
.
y
+
(
int
)(
decoratedWindow
.
getInsets
().
top
/
2
));
}
/*
* Clicks on a title of Frame/Dialog.
* WARNING: it may fail on some platforms when the window is not wide enough.
*/
public
static
void
clickOnTitle
(
final
Window
decoratedWindow
,
final
Robot
robot
)
{
Point
p
=
decoratedWindow
.
getLocationOnScreen
();
Dimension
d
=
decoratedWindow
.
getSize
();
if
(
decoratedWindow
instanceof
Frame
||
decoratedWindow
instanceof
Dialog
)
{
robot
.
mouseMove
(
p
.
x
+
(
int
)(
d
.
getWidth
()/
2
),
p
.
y
+
(
int
)
decoratedWindow
.
getInsets
().
top
/
2
);
Point
p
=
getTitlePoint
(
decoratedWindow
);
robot
.
mouseMove
(
p
.
x
,
p
.
y
);
robot
.
delay
(
50
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
delay
(
50
);
...
...
@@ -409,7 +414,9 @@ public final class Util {
ICE_WM
=
10
,
METACITY_WM
=
11
,
COMPIZ_WM
=
12
,
LG3D_WM
=
13
;
LG3D_WM
=
13
,
CWM_WM
=
14
,
MUTTER_WM
=
15
;
/*
* Returns -1 in case of not X Window or any problems.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录