Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
950aff58
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看板
提交
950aff58
编写于
2月 20, 2009
作者:
A
anthony
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6804747: Ensure consistent graphicsConfig member across components hierarchy
Reviewed-by: art, dcherepanov
上级
82fa4fd9
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
182 addition
and
296 deletion
+182
-296
src/share/classes/java/awt/Canvas.java
src/share/classes/java/awt/Canvas.java
+12
-1
src/share/classes/java/awt/Component.java
src/share/classes/java/awt/Component.java
+14
-37
src/share/classes/java/awt/Container.java
src/share/classes/java/awt/Container.java
+18
-0
src/share/classes/java/awt/Window.java
src/share/classes/java/awt/Window.java
+28
-43
src/share/classes/java/awt/peer/CanvasPeer.java
src/share/classes/java/awt/peer/CanvasPeer.java
+10
-0
src/share/classes/java/awt/peer/ComponentPeer.java
src/share/classes/java/awt/peer/ComponentPeer.java
+6
-0
src/share/classes/sun/awt/AWTAccessor.java
src/share/classes/sun/awt/AWTAccessor.java
+5
-0
src/share/classes/sun/awt/ComponentAccessor.java
src/share/classes/sun/awt/ComponentAccessor.java
+0
-16
src/share/classes/sun/awt/NullComponentPeer.java
src/share/classes/sun/awt/NullComponentPeer.java
+8
-0
src/solaris/classes/sun/awt/X11/XCanvasPeer.java
src/solaris/classes/sun/awt/X11/XCanvasPeer.java
+32
-48
src/solaris/classes/sun/awt/X11/XComponentPeer.java
src/solaris/classes/sun/awt/X11/XComponentPeer.java
+5
-0
src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
+2
-0
src/solaris/classes/sun/awt/X11/XPanelPeer.java
src/solaris/classes/sun/awt/X11/XPanelPeer.java
+0
-33
src/solaris/classes/sun/awt/X11/XWindowPeer.java
src/solaris/classes/sun/awt/X11/XWindowPeer.java
+9
-15
src/solaris/native/sun/awt/awt_Component.h
src/solaris/native/sun/awt/awt_Component.h
+0
-5
src/solaris/native/sun/awt/awt_Window.h
src/solaris/native/sun/awt/awt_Window.h
+0
-1
src/solaris/native/sun/xawt/XToolkit.c
src/solaris/native/sun/xawt/XToolkit.c
+0
-6
src/windows/classes/sun/awt/Win32GraphicsDevice.java
src/windows/classes/sun/awt/Win32GraphicsDevice.java
+0
-1
src/windows/classes/sun/awt/windows/WCanvasPeer.java
src/windows/classes/sun/awt/windows/WCanvasPeer.java
+6
-32
src/windows/classes/sun/awt/windows/WComponentPeer.java
src/windows/classes/sun/awt/windows/WComponentPeer.java
+3
-17
src/windows/classes/sun/awt/windows/WPanelPeer.java
src/windows/classes/sun/awt/windows/WPanelPeer.java
+0
-28
src/windows/classes/sun/awt/windows/WWindowPeer.java
src/windows/classes/sun/awt/windows/WWindowPeer.java
+24
-13
未找到文件。
src/share/classes/java/awt/Canvas.java
浏览文件 @
950aff58
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
package
java.awt
;
package
java.awt
;
import
java.awt.image.BufferStrategy
;
import
java.awt.image.BufferStrategy
;
import
java.awt.peer.CanvasPeer
;
import
javax.accessibility.*
;
import
javax.accessibility.*
;
/**
/**
...
@@ -65,7 +66,17 @@ public class Canvas extends Component implements Accessible {
...
@@ -65,7 +66,17 @@ public class Canvas extends Component implements Accessible {
*/
*/
public
Canvas
(
GraphicsConfiguration
config
)
{
public
Canvas
(
GraphicsConfiguration
config
)
{
this
();
this
();
graphicsConfig
=
config
;
setGraphicsConfiguration
(
config
);
}
@Override
void
setGraphicsConfiguration
(
GraphicsConfiguration
gc
)
{
CanvasPeer
peer
=
(
CanvasPeer
)
getPeer
();
if
(
peer
!=
null
)
{
gc
=
peer
.
getAppropriateGraphicsConfiguration
(
gc
);
}
super
.
setGraphicsConfiguration
(
gc
);
}
}
/**
/**
...
...
src/share/classes/java/awt/Component.java
浏览文件 @
950aff58
...
@@ -300,7 +300,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
...
@@ -300,7 +300,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see GraphicsConfiguration
* @see GraphicsConfiguration
* @see #getGraphicsConfiguration
* @see #getGraphicsConfiguration
*/
*/
transient
GraphicsConfiguration
graphicsConfig
=
null
;
private
transient
GraphicsConfiguration
graphicsConfig
=
null
;
/**
/**
* A reference to a <code>BufferStrategy</code> object
* A reference to a <code>BufferStrategy</code> object
...
@@ -845,6 +845,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
...
@@ -845,6 +845,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
}
}
}
}
public
void
setGraphicsConfiguration
(
Component
comp
,
GraphicsConfiguration
gc
)
{
comp
.
setGraphicsConfiguration
(
gc
);
}
});
});
}
}
...
@@ -1012,50 +1018,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
...
@@ -1012,50 +1018,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
*/
*/
public
GraphicsConfiguration
getGraphicsConfiguration
()
{
public
GraphicsConfiguration
getGraphicsConfiguration
()
{
synchronized
(
getTreeLock
())
{
synchronized
(
getTreeLock
())
{
if
(
graphicsConfig
!=
null
)
{
return
getGraphicsConfiguration_NoClientCode
();
return
graphicsConfig
;
}
else
if
(
getParent
()
!=
null
)
{
return
getParent
().
getGraphicsConfiguration
();
}
else
{
return
null
;
}
}
}
}
}
final
GraphicsConfiguration
getGraphicsConfiguration_NoClientCode
()
{
final
GraphicsConfiguration
getGraphicsConfiguration_NoClientCode
()
{
GraphicsConfiguration
graphicsConfig
=
this
.
graphicsConfig
;
return
graphicsConfig
;
Container
parent
=
this
.
parent
;
if
(
graphicsConfig
!=
null
)
{
return
graphicsConfig
;
}
else
if
(
parent
!=
null
)
{
return
parent
.
getGraphicsConfiguration_NoClientCode
();
}
else
{
return
null
;
}
}
}
/**
void
setGraphicsConfiguration
(
GraphicsConfiguration
gc
)
{
* Resets this <code>Component</code>'s
* <code>GraphicsConfiguration</code> back to a default
* value. For most componenets, this is <code>null</code>.
* Called from the Toolkit thread, so NO CLIENT CODE.
*/
void
resetGC
()
{
synchronized
(
getTreeLock
())
{
synchronized
(
getTreeLock
())
{
graphicsConfig
=
null
;
graphicsConfig
=
gc
;
}
}
/*
ComponentPeer
peer
=
getPeer
();
* Not called on Component, but needed for Canvas and Window
if
(
peer
!=
null
)
{
*/
peer
.
updateGraphicsData
(
gc
);
void
setGCFromPeer
()
{
synchronized
(
getTreeLock
())
{
if
(
peer
!=
null
)
{
// can't imagine how this will be false,
// but just in case
graphicsConfig
=
peer
.
getGraphicsConfiguration
();
}
else
{
graphicsConfig
=
null
;
}
}
}
}
}
}
...
...
src/share/classes/java/awt/Container.java
浏览文件 @
950aff58
...
@@ -506,6 +506,7 @@ public class Container extends Component {
...
@@ -506,6 +506,7 @@ public class Container extends Component {
adjustDescendants
(-(
comp
.
countHierarchyMembers
()));
adjustDescendants
(-(
comp
.
countHierarchyMembers
()));
comp
.
parent
=
null
;
comp
.
parent
=
null
;
comp
.
setGraphicsConfiguration
(
null
);
component
.
remove
(
index
);
component
.
remove
(
index
);
invalidateIfValid
();
invalidateIfValid
();
...
@@ -789,6 +790,7 @@ public class Container extends Component {
...
@@ -789,6 +790,7 @@ public class Container extends Component {
component
.
add
(
index
,
comp
);
component
.
add
(
index
,
comp
);
}
}
comp
.
parent
=
this
;
comp
.
parent
=
this
;
comp
.
setGraphicsConfiguration
(
getGraphicsConfiguration
());
adjustListeningChildren
(
AWTEvent
.
HIERARCHY_EVENT_MASK
,
adjustListeningChildren
(
AWTEvent
.
HIERARCHY_EVENT_MASK
,
comp
.
numListening
(
AWTEvent
.
HIERARCHY_EVENT_MASK
));
comp
.
numListening
(
AWTEvent
.
HIERARCHY_EVENT_MASK
));
...
@@ -1056,6 +1058,7 @@ public class Container extends Component {
...
@@ -1056,6 +1058,7 @@ public class Container extends Component {
component
.
add
(
index
,
comp
);
component
.
add
(
index
,
comp
);
}
}
comp
.
parent
=
this
;
comp
.
parent
=
this
;
comp
.
setGraphicsConfiguration
(
thisGC
);
adjustListeningChildren
(
AWTEvent
.
HIERARCHY_EVENT_MASK
,
adjustListeningChildren
(
AWTEvent
.
HIERARCHY_EVENT_MASK
,
comp
.
numListening
(
AWTEvent
.
HIERARCHY_EVENT_MASK
));
comp
.
numListening
(
AWTEvent
.
HIERARCHY_EVENT_MASK
));
...
@@ -1094,6 +1097,19 @@ public class Container extends Component {
...
@@ -1094,6 +1097,19 @@ public class Container extends Component {
}
}
}
}
@Override
void
setGraphicsConfiguration
(
GraphicsConfiguration
gc
)
{
synchronized
(
getTreeLock
())
{
super
.
setGraphicsConfiguration
(
gc
);
for
(
Component
comp
:
component
)
{
if
(
comp
!=
null
)
{
comp
.
setGraphicsConfiguration
(
gc
);
}
}
}
}
/**
/**
* Checks that all Components that this Container contains are on
* Checks that all Components that this Container contains are on
* the same GraphicsDevice as this Container. If not, throws an
* the same GraphicsDevice as this Container. If not, throws an
...
@@ -1151,6 +1167,7 @@ public class Container extends Component {
...
@@ -1151,6 +1167,7 @@ public class Container extends Component {
comp
.
parent
=
null
;
comp
.
parent
=
null
;
component
.
remove
(
index
);
component
.
remove
(
index
);
comp
.
setGraphicsConfiguration
(
null
);
invalidateIfValid
();
invalidateIfValid
();
if
(
containerListener
!=
null
||
if
(
containerListener
!=
null
||
...
@@ -1227,6 +1244,7 @@ public class Container extends Component {
...
@@ -1227,6 +1244,7 @@ public class Container extends Component {
layoutMgr
.
removeLayoutComponent
(
comp
);
layoutMgr
.
removeLayoutComponent
(
comp
);
}
}
comp
.
parent
=
null
;
comp
.
parent
=
null
;
comp
.
setGraphicsConfiguration
(
null
);
if
(
containerListener
!=
null
||
if
(
containerListener
!=
null
||
(
eventMask
&
AWTEvent
.
CONTAINER_EVENT_MASK
)
!=
0
||
(
eventMask
&
AWTEvent
.
CONTAINER_EVENT_MASK
)
!=
0
||
Toolkit
.
enabledOnToolkit
(
AWTEvent
.
CONTAINER_EVENT_MASK
))
{
Toolkit
.
enabledOnToolkit
(
AWTEvent
.
CONTAINER_EVENT_MASK
))
{
...
...
src/share/classes/java/awt/Window.java
浏览文件 @
950aff58
...
@@ -394,6 +394,18 @@ public class Window extends Container implements Accessible {
...
@@ -394,6 +394,18 @@ public class Window extends Container implements Accessible {
}
}
}
}
private
GraphicsConfiguration
initGC
(
GraphicsConfiguration
gc
)
{
GraphicsEnvironment
.
checkHeadless
();
if
(
gc
==
null
)
{
gc
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
().
getDefaultScreenDevice
().
getDefaultConfiguration
();
}
setGraphicsConfiguration
(
gc
);
return
gc
;
}
private
void
init
(
GraphicsConfiguration
gc
)
{
private
void
init
(
GraphicsConfiguration
gc
)
{
GraphicsEnvironment
.
checkHeadless
();
GraphicsEnvironment
.
checkHeadless
();
...
@@ -405,14 +417,10 @@ public class Window extends Container implements Accessible {
...
@@ -405,14 +417,10 @@ public class Window extends Container implements Accessible {
setWarningString
();
setWarningString
();
this
.
cursor
=
Cursor
.
getPredefinedCursor
(
Cursor
.
DEFAULT_CURSOR
);
this
.
cursor
=
Cursor
.
getPredefinedCursor
(
Cursor
.
DEFAULT_CURSOR
);
this
.
visible
=
false
;
this
.
visible
=
false
;
if
(
gc
==
null
)
{
this
.
graphicsConfig
=
gc
=
initGC
(
gc
);
GraphicsEnvironment
.
getLocalGraphicsEnvironment
().
getDefaultScreenDevice
().
getDefaultConfiguration
();
if
(
gc
.
getDevice
().
getType
()
!=
}
else
{
this
.
graphicsConfig
=
gc
;
}
if
(
graphicsConfig
.
getDevice
().
getType
()
!=
GraphicsDevice
.
TYPE_RASTER_SCREEN
)
{
GraphicsDevice
.
TYPE_RASTER_SCREEN
)
{
throw
new
IllegalArgumentException
(
"not a screen device"
);
throw
new
IllegalArgumentException
(
"not a screen device"
);
}
}
...
@@ -420,8 +428,8 @@ public class Window extends Container implements Accessible {
...
@@ -420,8 +428,8 @@ public class Window extends Container implements Accessible {
/* offset the initial location with the original of the screen */
/* offset the initial location with the original of the screen */
/* and any insets */
/* and any insets */
Rectangle
screenBounds
=
g
raphicsConfig
.
getBounds
();
Rectangle
screenBounds
=
g
c
.
getBounds
();
Insets
screenInsets
=
getToolkit
().
getScreenInsets
(
g
raphicsConfig
);
Insets
screenInsets
=
getToolkit
().
getScreenInsets
(
g
c
);
int
x
=
getX
()
+
screenBounds
.
x
+
screenInsets
.
left
;
int
x
=
getX
()
+
screenBounds
.
x
+
screenInsets
.
left
;
int
y
=
getY
()
+
screenBounds
.
y
+
screenInsets
.
top
;
int
y
=
getY
()
+
screenBounds
.
y
+
screenInsets
.
top
;
if
(
x
!=
this
.
x
||
y
!=
this
.
y
)
{
if
(
x
!=
this
.
x
||
y
!=
this
.
y
)
{
...
@@ -2765,7 +2773,7 @@ public class Window extends Container implements Accessible {
...
@@ -2765,7 +2773,7 @@ public class Window extends Container implements Accessible {
sun
.
java2d
.
Disposer
.
addRecord
(
anchor
,
new
WindowDisposerRecord
(
appContext
,
this
));
sun
.
java2d
.
Disposer
.
addRecord
(
anchor
,
new
WindowDisposerRecord
(
appContext
,
this
));
addToWindowList
();
addToWindowList
();
initGC
(
null
);
}
}
private
void
deserializeResources
(
ObjectInputStream
s
)
private
void
deserializeResources
(
ObjectInputStream
s
)
...
@@ -2939,41 +2947,18 @@ public class Window extends Container implements Accessible {
...
@@ -2939,41 +2947,18 @@ public class Window extends Container implements Accessible {
}
// inner class AccessibleAWTWindow
}
// inner class AccessibleAWTWindow
/**
@Override
* This method returns the GraphicsConfiguration used by this Window.
void
setGraphicsConfiguration
(
GraphicsConfiguration
gc
)
{
* @since 1.3
if
(
gc
==
null
)
{
*/
gc
=
GraphicsEnvironment
.
public
GraphicsConfiguration
getGraphicsConfiguration
()
{
//NOTE: for multiscreen, this will need to take into account
//which screen the window is on/mostly on instead of returning the
//default or constructor argument config.
synchronized
(
getTreeLock
())
{
if
(
graphicsConfig
==
null
&&
!
GraphicsEnvironment
.
isHeadless
())
{
graphicsConfig
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
().
getDefaultScreenDevice
().
getDefaultConfiguration
();
}
return
graphicsConfig
;
}
}
/**
* Reset this Window's GraphicsConfiguration to match its peer.
*/
void
resetGC
()
{
if
(!
GraphicsEnvironment
.
isHeadless
())
{
// use the peer's GC
setGCFromPeer
();
// if it's still null, use the default
if
(
graphicsConfig
==
null
)
{
graphicsConfig
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
().
getLocalGraphicsEnvironment
().
getDefaultScreenDevice
().
getDefaultScreenDevice
().
getDefaultConfiguration
();
getDefaultConfiguration
();
}
}
synchronized
(
getTreeLock
())
{
super
.
setGraphicsConfiguration
(
gc
);
if
(
log
.
isLoggable
(
Level
.
FINER
))
{
if
(
log
.
isLoggable
(
Level
.
FINER
))
{
log
.
finer
(
"+ Window.
resetGC(): new GC is \n+ "
+
graphicsConfig
+
"\n+ this is "
+
this
);
log
.
finer
(
"+ Window.
setGraphicsConfiguration(): new GC is \n+ "
+
getGraphicsConfiguration_NoClientCode
()
+
"\n+ this is "
+
this
);
}
}
}
}
}
}
...
@@ -3033,7 +3018,7 @@ public class Window extends Container implements Accessible {
...
@@ -3033,7 +3018,7 @@ public class Window extends Container implements Accessible {
// target location
// target location
int
dx
=
0
,
dy
=
0
;
int
dx
=
0
,
dy
=
0
;
// target GC
// target GC
GraphicsConfiguration
gc
=
this
.
graphicsConfig
;
GraphicsConfiguration
gc
=
getGraphicsConfiguration_NoClientCode
()
;
Rectangle
gcBounds
=
gc
.
getBounds
();
Rectangle
gcBounds
=
gc
.
getBounds
();
Dimension
windowSize
=
getSize
();
Dimension
windowSize
=
getSize
();
...
...
src/share/classes/java/awt/peer/CanvasPeer.java
浏览文件 @
950aff58
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
package
java.awt.peer
;
package
java.awt.peer
;
import
java.awt.Canvas
;
import
java.awt.Canvas
;
import
java.awt.GraphicsConfiguration
;
/**
/**
* The peer interface for {@link Canvas}.
* The peer interface for {@link Canvas}.
...
@@ -36,4 +37,13 @@ import java.awt.Canvas;
...
@@ -36,4 +37,13 @@ import java.awt.Canvas;
* instances.
* instances.
*/
*/
public
interface
CanvasPeer
extends
ComponentPeer
{
public
interface
CanvasPeer
extends
ComponentPeer
{
/**
* Requests a GC that best suits this Canvas. The returned GC may differ
* from the requested GC passed as the argument to this method. This method
* must return a non-null value (given the argument is non-null as well).
*
* @since 1.7
*/
GraphicsConfiguration
getAppropriateGraphicsConfiguration
(
GraphicsConfiguration
gc
);
}
}
src/share/classes/java/awt/peer/ComponentPeer.java
浏览文件 @
950aff58
...
@@ -539,4 +539,10 @@ public interface ComponentPeer {
...
@@ -539,4 +539,10 @@ public interface ComponentPeer {
*/
*/
void
applyShape
(
Region
shape
);
void
applyShape
(
Region
shape
);
/**
* Updates internal data structures related to the component's GC.
*
* @since 1.7
*/
void
updateGraphicsData
(
GraphicsConfiguration
gc
);
}
}
src/share/classes/sun/awt/AWTAccessor.java
浏览文件 @
950aff58
...
@@ -78,6 +78,11 @@ public final class AWTAccessor {
...
@@ -78,6 +78,11 @@ public final class AWTAccessor {
* See 6797587, 6776743, 6768307, and 6768332 for details
* See 6797587, 6776743, 6768307, and 6768332 for details
*/
*/
void
setMixingCutoutShape
(
Component
comp
,
Shape
shape
);
void
setMixingCutoutShape
(
Component
comp
,
Shape
shape
);
/**
* Sets GraphicsConfiguration value for the component.
*/
void
setGraphicsConfiguration
(
Component
comp
,
GraphicsConfiguration
gc
);
}
}
/*
/*
...
...
src/share/classes/sun/awt/ComponentAccessor.java
浏览文件 @
950aff58
...
@@ -73,7 +73,6 @@ public class ComponentAccessor
...
@@ -73,7 +73,6 @@ public class ComponentAccessor
private
static
Field
fieldPacked
;
private
static
Field
fieldPacked
;
private
static
Field
fieldIgnoreRepaint
;
private
static
Field
fieldIgnoreRepaint
;
private
static
Field
fieldPeer
;
private
static
Field
fieldPeer
;
private
static
Method
methodResetGC
;
private
static
Field
fieldVisible
;
private
static
Field
fieldVisible
;
private
static
Method
methodIsEnabledImpl
;
private
static
Method
methodIsEnabledImpl
;
private
static
Method
methodGetCursorNoClientCode
;
private
static
Method
methodGetCursorNoClientCode
;
...
@@ -124,9 +123,6 @@ public class ComponentAccessor
...
@@ -124,9 +123,6 @@ public class ComponentAccessor
fieldPeer
=
componentClass
.
getDeclaredField
(
"peer"
);
fieldPeer
=
componentClass
.
getDeclaredField
(
"peer"
);
fieldPeer
.
setAccessible
(
true
);
fieldPeer
.
setAccessible
(
true
);
methodResetGC
=
componentClass
.
getDeclaredMethod
(
"resetGC"
,
(
Class
[])
null
);
methodResetGC
.
setAccessible
(
true
);
fieldVisible
=
componentClass
.
getDeclaredField
(
"visible"
);
fieldVisible
=
componentClass
.
getDeclaredField
(
"visible"
);
fieldVisible
.
setAccessible
(
true
);
fieldVisible
.
setAccessible
(
true
);
...
@@ -425,18 +421,6 @@ public class ComponentAccessor
...
@@ -425,18 +421,6 @@ public class ComponentAccessor
return
false
;
return
false
;
}
}
public
static
void
resetGC
(
Component
c
)
{
try
{
methodResetGC
.
invoke
(
c
,
(
Object
[])
null
);
}
catch
(
IllegalAccessException
e
)
{
log
.
log
(
Level
.
FINE
,
"Unable to access the Component object"
,
e
);
}
catch
(
InvocationTargetException
e
)
{
log
.
log
(
Level
.
FINE
,
"Unable to invoke on the Component object"
,
e
);
}
}
public
static
boolean
getVisible
(
Component
c
)
{
public
static
boolean
getVisible
(
Component
c
)
{
try
{
try
{
return
fieldVisible
.
getBoolean
(
c
);
return
fieldVisible
.
getBoolean
(
c
);
...
...
src/share/classes/sun/awt/NullComponentPeer.java
浏览文件 @
950aff58
...
@@ -305,4 +305,12 @@ public class NullComponentPeer implements LightweightPeer,
...
@@ -305,4 +305,12 @@ public class NullComponentPeer implements LightweightPeer,
*/
*/
public
void
applyShape
(
Region
shape
)
{
public
void
applyShape
(
Region
shape
)
{
}
}
public
void
updateGraphicsData
(
GraphicsConfiguration
gc
)
{}
public
GraphicsConfiguration
getAppropriateGraphicsConfiguration
(
GraphicsConfiguration
gc
)
{
return
gc
;
}
}
}
src/solaris/classes/sun/awt/X11/XCanvasPeer.java
浏览文件 @
950aff58
...
@@ -27,7 +27,6 @@ package sun.awt.X11;
...
@@ -27,7 +27,6 @@ package sun.awt.X11;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.peer.*
;
import
java.awt.peer.*
;
import
sun.awt.ComponentAccessor
;
import
sun.awt.SunToolkit
;
import
sun.awt.SunToolkit
;
import
sun.awt.X11GraphicsConfig
;
import
sun.awt.X11GraphicsConfig
;
...
@@ -54,60 +53,45 @@ class XCanvasPeer extends XComponentPeer implements CanvasPeer {
...
@@ -54,60 +53,45 @@ class XCanvasPeer extends XComponentPeer implements CanvasPeer {
}
}
}
}
void
resetTargetGC
(
Component
target
)
{
/* Get a GraphicsConfig with the same visual on the new
ComponentAccessor
.
resetGC
(
target
);
}
/*
* Called when the Window this
* Canvas is on is moved onto another Xinerama screen.
*
* Canvases can be created with a non-defulat GraphicsConfiguration. The
* GraphicsConfiguration needs to be changed to one on the new screen,
* preferably with the same visual ID.
*
* Up-called for other windows peer instances (XPanelPeer, XWindowPeer).
*
* Should only be called from the event thread.
*/
public
void
displayChanged
(
int
screenNum
)
{
resetLocalGC
(
screenNum
);
resetTargetGC
(
target
);
}
/* Set graphicsConfig to a GraphicsConfig with the same visual on the new
* screen, which should be easy in Xinerama mode.
* screen, which should be easy in Xinerama mode.
*
* Should only be called from displayChanged(), and therefore only from
* the event thread.
*/
*/
void
resetLocalGC
(
int
screenNum
)
{
public
GraphicsConfiguration
getAppropriateGraphicsConfiguration
(
GraphicsConfiguration
gc
)
{
if
(
graphicsConfig
==
null
||
gc
==
null
)
{
return
gc
;
}
// Opt: Only need to do if we're not using the default GC
// Opt: Only need to do if we're not using the default GC
if
(
graphicsConfig
!=
null
)
{
X11GraphicsConfig
parentgc
;
// save vis id of current gc
int
visual
=
graphicsConfig
.
getVisual
();
X11GraphicsDevice
newDev
=
(
X11GraphicsDevice
)
GraphicsEnvironment
.
int
screenNum
=
((
X11GraphicsDevice
)
gc
.
getDevice
()).
getScreen
();
getLocalGraphicsEnvironment
().
getScreenDevices
()[
screenNum
];
X11GraphicsConfig
parentgc
;
// save vis id of current gc
for
(
int
i
=
0
;
i
<
newDev
.
getNumConfigs
(
screenNum
);
i
++)
{
int
visual
=
graphicsConfig
.
getVisual
();
if
(
visual
==
newDev
.
getConfigVisualId
(
i
,
screenNum
))
{
// use that
X11GraphicsDevice
newDev
=
(
X11GraphicsDevice
)
GraphicsEnvironment
.
graphicsConfig
=
(
X11GraphicsConfig
)
newDev
.
getConfigurations
()[
i
];
getLocalGraphicsEnvironment
().
break
;
getScreenDevices
()[
screenNum
];
}
}
for
(
int
i
=
0
;
i
<
newDev
.
getNumConfigs
(
screenNum
);
i
++)
{
// just in case...
if
(
visual
==
newDev
.
getConfigVisualId
(
i
,
screenNum
))
{
if
(
graphicsConfig
==
null
)
{
// use that
graphicsConfig
=
(
X11GraphicsConfig
)
GraphicsEnvironment
.
graphicsConfig
=
(
X11GraphicsConfig
)
newDev
.
getConfigurations
()[
i
];
getLocalGraphicsEnvironment
().
break
;
getScreenDevices
()[
screenNum
].
getDefaultConfiguration
();
}
}
}
}
// just in case...
if
(
graphicsConfig
==
null
)
{
graphicsConfig
=
(
X11GraphicsConfig
)
GraphicsEnvironment
.
getLocalGraphicsEnvironment
().
getScreenDevices
()[
screenNum
].
getDefaultConfiguration
();
}
return
graphicsConfig
;
}
}
protected
boolean
shouldFocusOnClick
()
{
protected
boolean
shouldFocusOnClick
()
{
// Canvas should always be able to be focused by mouse clicks.
// Canvas should always be able to be focused by mouse clicks.
return
true
;
return
true
;
...
...
src/solaris/classes/sun/awt/X11/XComponentPeer.java
浏览文件 @
950aff58
...
@@ -35,6 +35,7 @@ import java.awt.Dimension;
...
@@ -35,6 +35,7 @@ import java.awt.Dimension;
import
java.awt.Font
;
import
java.awt.Font
;
import
java.awt.FontMetrics
;
import
java.awt.FontMetrics
;
import
java.awt.Graphics
;
import
java.awt.Graphics
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.Image
;
import
java.awt.Image
;
import
java.awt.Insets
;
import
java.awt.Insets
;
import
java.awt.KeyboardFocusManager
;
import
java.awt.KeyboardFocusManager
;
...
@@ -1556,4 +1557,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
...
@@ -1556,4 +1557,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
}
}
}
}
}
}
public
void
updateGraphicsData
(
GraphicsConfiguration
gc
)
{
initGraphicsConfiguration
();
}
}
}
src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
浏览文件 @
950aff58
...
@@ -379,4 +379,6 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
...
@@ -379,4 +379,6 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
public
void
applyShape
(
Region
shape
)
{
public
void
applyShape
(
Region
shape
)
{
}
}
public
void
updateGraphicsData
(
GraphicsConfiguration
gc
)
{}
}
}
src/solaris/classes/sun/awt/X11/XPanelPeer.java
浏览文件 @
950aff58
...
@@ -130,39 +130,6 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer {
...
@@ -130,39 +130,6 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer {
return
getInsets
();
return
getInsets
();
}
}
/*
* This method is called from XWindowPeer.displayChanged, when
* the window this Panel is on is moved to the new screen, or
* display mode is changed.
*
* The notification is propagated to the child Canvas components.
* Top-level windows and other Panels are notified too as their
* peers are subclasses of XCanvasPeer.
*/
public
void
displayChanged
(
int
screenNum
)
{
super
.
displayChanged
(
screenNum
);
displayChanged
((
Container
)
target
,
screenNum
);
}
/*
* Recursively iterates through all the HW and LW children
* of the container and calls displayChanged() for HW peers.
* Iteration through children peers only is not enough as the
* displayChanged notification may not be propagated to HW
* components inside LW containers, see 4452373 for details.
*/
private
static
void
displayChanged
(
Container
target
,
int
screenNum
)
{
Component
children
[]
=
((
Container
)
target
).
getComponents
();
for
(
Component
child
:
children
)
{
ComponentPeer
cpeer
=
child
.
getPeer
();
if
(
cpeer
instanceof
XCanvasPeer
)
{
((
XCanvasPeer
)
cpeer
).
displayChanged
(
screenNum
);
}
else
if
(
child
instanceof
Container
)
{
displayChanged
((
Container
)
child
,
screenNum
);
}
}
}
public
void
dispose
()
{
public
void
dispose
()
{
if
(
embedder
!=
null
)
{
if
(
embedder
!=
null
)
{
embedder
.
deinstall
();
embedder
.
deinstall
();
...
...
src/solaris/classes/sun/awt/X11/XWindowPeer.java
浏览文件 @
950aff58
...
@@ -47,6 +47,7 @@ import java.util.logging.Logger;
...
@@ -47,6 +47,7 @@ import java.util.logging.Logger;
import
sun.awt.AWTAccessor
;
import
sun.awt.AWTAccessor
;
import
sun.awt.ComponentAccessor
;
import
sun.awt.ComponentAccessor
;
import
sun.awt.WindowAccessor
;
import
sun.awt.WindowAccessor
;
import
sun.awt.AWTAccessor
;
import
sun.awt.DisplayChangedListener
;
import
sun.awt.DisplayChangedListener
;
import
sun.awt.SunToolkit
;
import
sun.awt.SunToolkit
;
import
sun.awt.X11GraphicsDevice
;
import
sun.awt.X11GraphicsDevice
;
...
@@ -711,6 +712,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
...
@@ -711,6 +712,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
int
curScreenNum
=
((
X11GraphicsDevice
)
getGraphicsConfiguration
().
getDevice
()).
getScreen
();
int
curScreenNum
=
((
X11GraphicsDevice
)
getGraphicsConfiguration
().
getDevice
()).
getScreen
();
int
newScreenNum
=
0
;
int
newScreenNum
=
0
;
GraphicsDevice
gds
[]
=
XToolkit
.
localEnv
.
getScreenDevices
();
GraphicsDevice
gds
[]
=
XToolkit
.
localEnv
.
getScreenDevices
();
GraphicsConfiguration
newGC
=
null
;
Rectangle
screenBounds
;
Rectangle
screenBounds
;
for
(
int
i
=
0
;
i
<
gds
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
gds
.
length
;
i
++)
{
...
@@ -726,11 +728,13 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
...
@@ -726,11 +728,13 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if
(
intAmt
==
area
)
{
if
(
intAmt
==
area
)
{
// Completely on this screen - done!
// Completely on this screen - done!
newScreenNum
=
i
;
newScreenNum
=
i
;
newGC
=
gds
[
i
].
getDefaultConfiguration
();
break
;
break
;
}
}
if
(
intAmt
>
largestAmt
)
{
if
(
intAmt
>
largestAmt
)
{
largestAmt
=
intAmt
;
largestAmt
=
intAmt
;
newScreenNum
=
i
;
newScreenNum
=
i
;
newGC
=
gds
[
i
].
getDefaultConfiguration
();
}
}
}
}
}
}
...
@@ -738,28 +742,20 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
...
@@ -738,28 +742,20 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if
(
log
.
isLoggable
(
Level
.
FINEST
))
{
if
(
log
.
isLoggable
(
Level
.
FINEST
))
{
log
.
finest
(
"XWindowPeer: Moved to a new screen"
);
log
.
finest
(
"XWindowPeer: Moved to a new screen"
);
}
}
draggedToNewScreen
(
newScreenNum
);
executeDisplayChangedOnEDT
(
newGC
);
}
}
}
}
/* Xinerama
* called to update our GC when dragged onto another screen
*/
public
void
draggedToNewScreen
(
int
screenNum
)
{
executeDisplayChangedOnEDT
(
screenNum
);
}
/**
/**
* Helper method that executes the displayChanged(screen) method on
* Helper method that executes the displayChanged(screen) method on
* the event dispatch thread. This method is used in the Xinerama case
* the event dispatch thread. This method is used in the Xinerama case
* and after display mode change events.
* and after display mode change events.
*/
*/
private
void
executeDisplayChangedOnEDT
(
final
int
screenNum
)
{
private
void
executeDisplayChangedOnEDT
(
final
GraphicsConfiguration
gc
)
{
Runnable
dc
=
new
Runnable
()
{
Runnable
dc
=
new
Runnable
()
{
public
void
run
()
{
public
void
run
()
{
// Updates this window's GC and notifies all the children.
AWTAccessor
.
getComponentAccessor
().
// See XPanelPeer/XCanvasPeer.displayChanged(int) for details.
setGraphicsConfiguration
((
Component
)
target
,
gc
);
displayChanged
(
screenNum
);
}
}
};
};
SunToolkit
.
executeOnEventHandlerThread
((
Component
)
target
,
dc
);
SunToolkit
.
executeOnEventHandlerThread
((
Component
)
target
,
dc
);
...
@@ -770,9 +766,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
...
@@ -770,9 +766,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
* X11GraphicsDevice when the display mode has been changed.
* X11GraphicsDevice when the display mode has been changed.
*/
*/
public
void
displayChanged
()
{
public
void
displayChanged
()
{
GraphicsConfiguration
gc
=
getGraphicsConfiguration
();
executeDisplayChangedOnEDT
(
getGraphicsConfiguration
());
int
curScreenNum
=
((
X11GraphicsDevice
)
gc
.
getDevice
()).
getScreen
();
executeDisplayChangedOnEDT
(
curScreenNum
);
}
}
/**
/**
...
...
src/solaris/native/sun/awt/awt_Component.h
浏览文件 @
950aff58
...
@@ -41,7 +41,6 @@ struct ComponentIDs {
...
@@ -41,7 +41,6 @@ struct ComponentIDs {
jfieldID
appContext
;
jfieldID
appContext
;
jmethodID
getParent
;
jmethodID
getParent
;
jmethodID
getLocationOnScreen
;
jmethodID
getLocationOnScreen
;
jmethodID
resetGCMID
;
};
};
/* field and method IDs for Container */
/* field and method IDs for Container */
...
@@ -65,7 +64,3 @@ struct MComponentPeerIDs {
...
@@ -65,7 +64,3 @@ struct MComponentPeerIDs {
extern
void
processTree
(
Widget
from
,
Widget
to
,
Boolean
action
);
extern
void
processTree
(
Widget
from
,
Widget
to
,
Boolean
action
);
#endif // HEADLESS
#endif // HEADLESS
/* fieldIDs for Canvas fields that may be accessed from C */
struct
CanvasIDs
{
jmethodID
setGCFromPeerMID
;
};
src/solaris/native/sun/awt/awt_Window.h
浏览文件 @
950aff58
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
/* fieldIDs for Window fields that may be accessed from C */
/* fieldIDs for Window fields that may be accessed from C */
struct
WindowIDs
{
struct
WindowIDs
{
jfieldID
warningString
;
jfieldID
warningString
;
jmethodID
resetGCMID
;
jfieldID
locationByPlatform
;
jfieldID
locationByPlatform
;
jfieldID
isAutoRequestFocus
;
jfieldID
isAutoRequestFocus
;
};
};
...
...
src/solaris/native/sun/xawt/XToolkit.c
浏览文件 @
950aff58
...
@@ -182,9 +182,6 @@ Java_java_awt_Component_initIDs
...
@@ -182,9 +182,6 @@ Java_java_awt_Component_initIDs
(
*
env
)
->
GetMethodID
(
env
,
cls
,
"getLocationOnScreen_NoTreeLock"
,
(
*
env
)
->
GetMethodID
(
env
,
cls
,
"getLocationOnScreen_NoTreeLock"
,
"()Ljava/awt/Point;"
);
"()Ljava/awt/Point;"
);
componentIDs
.
resetGCMID
=
(
*
env
)
->
GetMethodID
(
env
,
cls
,
"resetGC"
,
"()V"
);
keyclass
=
(
*
env
)
->
FindClass
(
env
,
"java/awt/event/KeyEvent"
);
keyclass
=
(
*
env
)
->
FindClass
(
env
,
"java/awt/event/KeyEvent"
);
DASSERT
(
keyclass
!=
NULL
);
DASSERT
(
keyclass
!=
NULL
);
...
@@ -197,9 +194,6 @@ Java_java_awt_Component_initIDs
...
@@ -197,9 +194,6 @@ Java_java_awt_Component_initIDs
"Lsun/awt/AppContext;"
);
"Lsun/awt/AppContext;"
);
(
*
env
)
->
DeleteLocalRef
(
env
,
keyclass
);
(
*
env
)
->
DeleteLocalRef
(
env
,
keyclass
);
DASSERT
(
componentIDs
.
resetGCMID
);
}
}
...
...
src/windows/classes/sun/awt/Win32GraphicsDevice.java
浏览文件 @
950aff58
...
@@ -380,7 +380,6 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
...
@@ -380,7 +380,6 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
// fix for 4868278
// fix for 4868278
peer
.
updateGC
();
peer
.
updateGC
();
peer
.
resetTargetGC
();
}
}
}
}
...
...
src/windows/classes/sun/awt/windows/WCanvasPeer.java
浏览文件 @
950aff58
...
@@ -38,44 +38,12 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
...
@@ -38,44 +38,12 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
private
boolean
eraseBackground
;
private
boolean
eraseBackground
;
Method
resetGCMethod
;
// Toolkit & peer internals
// Toolkit & peer internals
WCanvasPeer
(
Component
target
)
{
WCanvasPeer
(
Component
target
)
{
super
(
target
);
super
(
target
);
}
}
/*
* From the DisplayChangedListener interface.
*
* Overrides WComponentPeer version because Canvases can be created with
* a non-defulat GraphicsConfiguration, which is no longer valid.
* Up-called for other windows peer instances (WPanelPeer, WWindowPeer).
*/
public
void
displayChanged
()
{
clearLocalGC
();
resetTargetGC
();
super
.
displayChanged
();
}
/*
* Reset the graphicsConfiguration member of our target Component.
* Component.resetGC() is a package-private method, so we have to call it
* through reflection.
*/
public
void
resetTargetGC
()
{
ComponentAccessor
.
resetGC
((
Component
)
target
);
}
/*
* Clears the peer's winGraphicsConfig member.
* Overridden by WWindowPeer, which shouldn't have a null winGraphicsConfig.
*/
void
clearLocalGC
()
{
winGraphicsConfig
=
null
;
}
native
void
create
(
WComponentPeer
parent
);
native
void
create
(
WComponentPeer
parent
);
void
initialize
()
{
void
initialize
()
{
...
@@ -152,4 +120,10 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
...
@@ -152,4 +120,10 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
*/
*/
private
native
void
setNativeBackgroundErase
(
boolean
doErase
,
private
native
void
setNativeBackgroundErase
(
boolean
doErase
,
boolean
doEraseOnResize
);
boolean
doEraseOnResize
);
public
GraphicsConfiguration
getAppropriateGraphicsConfiguration
(
GraphicsConfiguration
gc
)
{
return
gc
;
}
}
}
src/windows/classes/sun/awt/windows/WComponentPeer.java
浏览文件 @
950aff58
...
@@ -59,7 +59,7 @@ import java.util.logging.*;
...
@@ -59,7 +59,7 @@ import java.util.logging.*;
public
abstract
class
WComponentPeer
extends
WObjectPeer
public
abstract
class
WComponentPeer
extends
WObjectPeer
implements
ComponentPeer
,
DropTargetPeer
,
DisplayChangedListener
implements
ComponentPeer
,
DropTargetPeer
{
{
/**
/**
* Handle to native window
* Handle to native window
...
@@ -452,15 +452,8 @@ public abstract class WComponentPeer extends WObjectPeer
...
@@ -452,15 +452,8 @@ public abstract class WComponentPeer extends WObjectPeer
}
}
}
}
/**
public
void
updateGraphicsData
(
GraphicsConfiguration
gc
)
{
* From the DisplayChangedListener interface.
winGraphicsConfig
=
(
Win32GraphicsConfig
)
gc
;
*
* Called after a change in the display mode. This event
* triggers replacing the surfaceData object (since that object
* reflects the current display depth information, which has
* just changed).
*/
public
void
displayChanged
()
{
try
{
try
{
replaceSurfaceData
();
replaceSurfaceData
();
}
catch
(
InvalidPipeException
e
)
{
}
catch
(
InvalidPipeException
e
)
{
...
@@ -468,13 +461,6 @@ public abstract class WComponentPeer extends WObjectPeer
...
@@ -468,13 +461,6 @@ public abstract class WComponentPeer extends WObjectPeer
}
}
}
}
/**
* Part of the DisplayChangedListener interface: components
* do not need to react to this event
*/
public
void
paletteChanged
()
{
}
//This will return null for Components not yet added to a Container
//This will return null for Components not yet added to a Container
public
ColorModel
getColorModel
()
{
public
ColorModel
getColorModel
()
{
GraphicsConfiguration
gc
=
getGraphicsConfiguration
();
GraphicsConfiguration
gc
=
getGraphicsConfiguration
();
...
...
src/windows/classes/sun/awt/windows/WPanelPeer.java
浏览文件 @
950aff58
...
@@ -100,34 +100,6 @@ class WPanelPeer extends WCanvasPeer implements PanelPeer {
...
@@ -100,34 +100,6 @@ class WPanelPeer extends WCanvasPeer implements PanelPeer {
return
getInsets
();
return
getInsets
();
}
}
/*
* From the DisplayChangedListener interface. Often is
* up-called from a WWindowPeer instance.
*/
public
void
displayChanged
()
{
super
.
displayChanged
();
displayChanged
((
Container
)
target
);
}
/*
* Recursively iterates through all the HW and LW children
* of the container and calls displayChanged() for HW peers.
* Iteration through children peers only is not enough as the
* displayChanged notification may not be propagated to HW
* components inside LW containers, see 4452373 for details.
*/
private
static
void
displayChanged
(
Container
target
)
{
Component
children
[]
=
((
Container
)
target
).
getComponents
();
for
(
Component
child
:
children
)
{
ComponentPeer
cpeer
=
child
.
getPeer
();
if
(
cpeer
instanceof
WComponentPeer
)
{
((
WComponentPeer
)
cpeer
).
displayChanged
();
}
else
if
(
child
instanceof
Container
)
{
displayChanged
((
Container
)
child
);
}
}
}
private
native
void
pRestack
(
Object
[]
peers
);
private
native
void
pRestack
(
Object
[]
peers
);
private
void
restack
(
Container
cont
,
Vector
peers
)
{
private
void
restack
(
Container
cont
,
Vector
peers
)
{
for
(
int
i
=
0
;
i
<
cont
.
getComponentCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
cont
.
getComponentCount
();
i
++)
{
...
...
src/windows/classes/sun/awt/windows/WWindowPeer.java
浏览文件 @
950aff58
...
@@ -41,7 +41,9 @@ import sun.awt.*;
...
@@ -41,7 +41,9 @@ import sun.awt.*;
import
sun.java2d.pipe.Region
;
import
sun.java2d.pipe.Region
;
public
class
WWindowPeer
extends
WPanelPeer
implements
WindowPeer
{
public
class
WWindowPeer
extends
WPanelPeer
implements
WindowPeer
,
DisplayChangedListener
{
private
static
final
Logger
log
=
Logger
.
getLogger
(
"sun.awt.windows.WWindowPeer"
);
private
static
final
Logger
log
=
Logger
.
getLogger
(
"sun.awt.windows.WWindowPeer"
);
private
static
final
Logger
screenLog
=
Logger
.
getLogger
(
"sun.awt.windows.screen.WWindowPeer"
);
private
static
final
Logger
screenLog
=
Logger
.
getLogger
(
"sun.awt.windows.screen.WWindowPeer"
);
...
@@ -198,7 +200,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
...
@@ -198,7 +200,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
// super.displayChanged() in WWindowPeer.displayChanged() regardless of whether
// super.displayChanged() in WWindowPeer.displayChanged() regardless of whether
// GraphicsDevice was really changed, or not. So we need to track it here.
// GraphicsDevice was really changed, or not. So we need to track it here.
updateGC
();
updateGC
();
resetTargetGC
();
realShow
();
realShow
();
updateMinimumSize
();
updateMinimumSize
();
...
@@ -400,14 +401,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
...
@@ -400,14 +401,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
});
});
}
}
/*
* Called from WCanvasPeer.displayChanged().
* Override to do nothing - Window and WWindowPeer GC must never be set to
* null!
*/
void
clearLocalGC
()
{}
public
void
updateGC
()
{
public
void
updateGC
()
{
int
scrn
=
getScreenImOn
();
int
scrn
=
getScreenImOn
();
if
(
screenLog
.
isLoggable
(
Level
.
FINER
))
{
if
(
screenLog
.
isLoggable
(
Level
.
FINER
))
{
...
@@ -446,18 +439,36 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
...
@@ -446,18 +439,36 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
oldDev
.
removeDisplayChangedListener
(
this
);
oldDev
.
removeDisplayChangedListener
(
this
);
newDev
.
addDisplayChangedListener
(
this
);
newDev
.
addDisplayChangedListener
(
this
);
}
}
SunToolkit
.
executeOnEventHandlerThread
((
Component
)
target
,
new
Runnable
()
{
public
void
run
()
{
AWTAccessor
.
getComponentAccessor
().
setGraphicsConfiguration
((
Component
)
target
,
winGraphicsConfig
);
}
});
}
}
/*
/*
*
* From the DisplayChangedListener interface
* From the DisplayChangedListener interface
.
*
*
* This method handles a display change - either when the display settings
* This method handles a display change - either when the display settings
* are changed, or when the window has been dragged onto a different
* are changed, or when the window has been dragged onto a different
* display.
* display.
* Called after a change in the display mode. This event
* triggers replacing the surfaceData object (since that object
* reflects the current display depth information, which has
* just changed).
*/
*/
public
void
displayChanged
()
{
public
void
displayChanged
()
{
updateGC
();
updateGC
();
super
.
displayChanged
();
}
/**
* Part of the DisplayChangedListener interface: components
* do not need to react to this event
*/
public
void
paletteChanged
()
{
}
}
private
native
int
getScreenImOn
();
private
native
int
getScreenImOn
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录