Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
39f03ee9
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看板
提交
39f03ee9
编写于
6月 12, 2014
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8033786: White flashing when opening Dialogs and Menus using Nimbus with dark background
Reviewed-by: alexsch, anthony
上级
d6eb9cc7
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
98 addition
and
40 deletion
+98
-40
src/macosx/classes/sun/lwawt/LWComponentPeer.java
src/macosx/classes/sun/lwawt/LWComponentPeer.java
+2
-0
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+6
-0
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+12
-10
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
+8
-5
src/macosx/native/sun/awt/CWrapper.m
src/macosx/native/sun/awt/CWrapper.m
+7
-25
src/share/classes/javax/swing/JDialog.java
src/share/classes/javax/swing/JDialog.java
+1
-0
test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java
...ng/JDialog/WrongBackgroundColor/WrongBackgroundColor.java
+62
-0
未找到文件。
src/macosx/classes/sun/lwawt/LWComponentPeer.java
浏览文件 @
39f03ee9
...
...
@@ -319,6 +319,8 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
* subclasses to initialize specific peers properties.
*/
void
initializeImpl
()
{
// note that these methods can be overridden by the user and
// can return some strange values like null.
setBackground
(
target
.
getBackground
());
setForeground
(
target
.
getForeground
());
setFont
(
target
.
getFont
());
...
...
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
39f03ee9
...
...
@@ -443,6 +443,12 @@ public class LWWindowPeer
getPlatformWindow
().
updateIconImages
();
}
@Override
public
void
setBackground
(
final
Color
c
)
{
super
.
setBackground
(
c
);
updateOpaque
();
}
@Override
public
void
setOpacity
(
float
opacity
)
{
getPlatformWindow
().
setOpacity
(
opacity
);
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
39f03ee9
...
...
@@ -747,20 +747,22 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
public
void
setOpaque
(
boolean
isOpaque
)
{
CWrapper
.
NSWindow
.
setOpaque
(
getNSWindowPtr
(),
isOpaque
);
boolean
isTextured
=
(
peer
==
null
)?
false
:
peer
.
isTextured
();
if
(!
isOpaque
&&
!
isTextured
)
{
long
clearColor
=
CWrapper
.
NSColor
.
clearColor
();
CWrapper
.
NSWindow
.
setBackgroundColor
(
getNSWindowPtr
(),
clearColor
);
boolean
isTextured
=
(
peer
==
null
)
?
false
:
peer
.
isTextured
();
if
(!
isTextured
)
{
if
(!
isOpaque
)
{
CWrapper
.
NSWindow
.
setBackgroundColor
(
getNSWindowPtr
(),
0
);
}
else
if
(
peer
!=
null
)
{
Color
color
=
peer
.
getBackground
();
if
(
color
!=
null
)
{
int
rgb
=
color
.
getRGB
();
CWrapper
.
NSWindow
.
setBackgroundColor
(
getNSWindowPtr
(),
rgb
);
}
}
}
//This is a temporary workaround. Looks like after 7124236 will be fixed
//the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
@Override
public
void
run
()
{
invalidateShadow
();
}
});
SwingUtilities
.
invokeLater
(
this
::
invalidateShadow
);
}
@Override
...
...
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
浏览文件 @
39f03ee9
...
...
@@ -61,7 +61,14 @@ final class CWrapper {
static
native
void
setAlphaValue
(
long
window
,
float
alpha
);
static
native
void
setOpaque
(
long
window
,
boolean
opaque
);
static
native
void
setBackgroundColor
(
long
window
,
long
color
);
/**
* Sets background color of the NSWindow.
*
* @param window the pointer of the NSWindow
* @param color the color in argb format
*/
static
native
void
setBackgroundColor
(
long
window
,
int
color
);
static
native
void
miniaturize
(
long
window
);
static
native
void
deminiaturize
(
long
window
);
...
...
@@ -82,8 +89,4 @@ final class CWrapper {
static
native
void
setToolTip
(
long
view
,
String
msg
);
}
static
final
class
NSColor
{
static
native
long
clearColor
();
}
}
src/macosx/native/sun/awt/CWrapper.m
浏览文件 @
39f03ee9
...
...
@@ -337,12 +337,17 @@ JNF_COCOA_EXIT(env);
*
/
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setBackgroundColor
(
JNIEnv
*env
,
jclass
cls
,
jlong
windowPtr
,
j
long
colorPtr
)
(
JNIEnv
*env
,
jclass
cls
,
jlong
windowPtr
,
j
int
rgb
)
{
JNF_COCOA_ENTER
(
env
);
NSWindow
*window =
(NSWindow
*
)
jlong_to_ptr
(
windowPtr
);
NSColor
*color =
(NSColor
*
)
jlong_to_ptr
(
colorPtr
);
CGFloat
alpha =
(((rgb
>
> 24)
&
0xff) / 255.0);
CGFloat red = (((rgb >> 16)
&
0xff) / 255.0);
CGFloat green = (((rgb >> 8)
&
0xff) / 255.0);
CGFloat blue = (((rgb >> 0)
&
0xff) / 255.0);
NSColor *color = [NSColor colorWithCalibratedRed:red green:green blue:blue
alpha:alpha];
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setBackgroundColor:color];
}];
...
...
@@ -575,26 +580,3 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT(env);
}
/
*
*
Class:
sun_lwawt_macosx_CWrapper
$
NSColor
*
Method:
clearColor
*
Signature:
()
J
*
/
JNIEXPORT
jlong
JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSColor_clearColor
(
JNIEnv
*env
,
jclass
cls
)
{
__block
jlong
clearColorPtr =
0L;
JNF_COCOA_ENTER
(
env
);
[
ThreadUtilities
performOnMainThreadWaiting:YES
block:
^(){
clearColorPtr =
ptr_to_jlong([NSColor
clearColor
]);
}];
JNF_COCOA_EXIT
(
env
);
return
clearColorPtr
;
}
src/share/classes/javax/swing/JDialog.java
浏览文件 @
39f03ee9
...
...
@@ -646,6 +646,7 @@ public class JDialog extends Dialog implements WindowConstants,
enableEvents
(
AWTEvent
.
KEY_EVENT_MASK
|
AWTEvent
.
WINDOW_EVENT_MASK
);
setLocale
(
JComponent
.
getDefaultLocale
()
);
setRootPane
(
createRootPane
());
setBackground
(
UIManager
.
getColor
(
"control"
));
setRootPaneCheckingEnabled
(
true
);
if
(
JDialog
.
isDefaultLookAndFeelDecorated
())
{
boolean
supportsWindowDecorations
=
...
...
test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java
0 → 100644
浏览文件 @
39f03ee9
/*
* 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.
*/
import
java.awt.Color
;
import
java.lang.reflect.InvocationTargetException
;
import
javax.swing.JDialog
;
import
javax.swing.JFrame
;
import
javax.swing.SwingUtilities
;
import
javax.swing.UIDefaults
;
import
javax.swing.UIManager
;
import
javax.swing.plaf.ColorUIResource
;
/**
* @test
* @bug 8033786
* @summary JDialog should update background color of the native peer.
* @author Sergey Bylokhov
*/
public
final
class
WrongBackgroundColor
{
public
static
void
main
(
final
String
[]
args
)
throws
InvocationTargetException
,
InterruptedException
{
SwingUtilities
.
invokeAndWait
(()
->
{
UIDefaults
ui
=
UIManager
.
getDefaults
();
ui
.
put
(
"control"
,
new
ColorUIResource
(
54
,
54
,
54
));
final
JDialog
dialog
=
new
JDialog
();
final
JFrame
frame
=
new
JFrame
();
frame
.
pack
();
dialog
.
pack
();
final
Color
dialogBackground
=
dialog
.
getBackground
();
final
Color
frameBackground
=
frame
.
getBackground
();
frame
.
dispose
();
dialog
.
dispose
();
if
(!
dialogBackground
.
equals
(
frameBackground
))
{
System
.
err
.
println
(
"Expected:"
+
frameBackground
);
System
.
err
.
println
(
"Actual:"
+
dialogBackground
);
throw
new
RuntimeException
(
"Wrong background color"
);
}
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录