Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ece4d22e
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看板
提交
ece4d22e
编写于
3月 13, 2008
作者:
S
son
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6632140: minor refactoring for XWM
Summary: code cleanup and generificaion for XWM Reviewed-by: anthony
上级
a984c3dd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
82 addition
and
84 deletion
+82
-84
src/solaris/classes/sun/awt/X11/XFramePeer.java
src/solaris/classes/sun/awt/X11/XFramePeer.java
+18
-14
src/solaris/classes/sun/awt/X11/XNETProtocol.java
src/solaris/classes/sun/awt/X11/XNETProtocol.java
+7
-8
src/solaris/classes/sun/awt/X11/XToolkit.java
src/solaris/classes/sun/awt/X11/XToolkit.java
+18
-15
src/solaris/classes/sun/awt/X11/XWM.java
src/solaris/classes/sun/awt/X11/XWM.java
+39
-47
未找到文件。
src/solaris/classes/sun/awt/X11/XFramePeer.java
浏览文件 @
ece4d22e
/*
* Copyright 2002-200
7
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2002-200
8
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
...
...
@@ -24,15 +24,18 @@
*/
package
sun.awt.X11
;
import
java.util.Vector
;
import
java.awt.*
;
import
java.awt.peer.*
;
import
java.awt.event.*
;
import
sun.awt.im.*
;
import
sun.awt.*
;
import
java.util.logging.*
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.awt.Color
;
import
java.awt.Dimension
;
import
java.awt.Font
;
import
java.awt.FontMetrics
;
import
java.awt.Frame
;
import
java.awt.Graphics
;
import
java.awt.Insets
;
import
java.awt.MenuBar
;
import
java.awt.Rectangle
;
import
java.awt.peer.FramePeer
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
class
XFramePeer
extends
XDecoratedPeer
implements
FramePeer
,
XConstants
{
private
static
Logger
log
=
Logger
.
getLogger
(
"sun.awt.X11.XFramePeer"
);
...
...
@@ -285,19 +288,20 @@ class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants {
* Let's see if this is a window state protocol message, and
* if it is - decode a new state in terms of java constants.
*/
Integer
newState
=
XWM
.
getWM
().
isStateChange
(
this
,
ev
);
if
(
newState
==
null
)
{
if
(!
XWM
.
getWM
().
isStateChange
(
this
,
ev
))
{
stateLog
.
finer
(
"either not a state atom or state has not been changed"
);
return
;
}
int
changed
=
state
^
newState
.
intValue
();
final
int
newState
=
XWM
.
getWM
().
getState
(
this
);
int
changed
=
state
^
newState
;
if
(
changed
==
0
)
{
stateLog
.
finer
(
"State is the same: "
+
state
);
return
;
}
int
old_state
=
state
;
state
=
newState
.
intValue
()
;
state
=
newState
;
if
((
changed
&
Frame
.
ICONIFIED
)
!=
0
)
{
if
((
state
&
Frame
.
ICONIFIED
)
!=
0
)
{
...
...
src/solaris/classes/sun/awt/X11/XNETProtocol.java
浏览文件 @
ece4d22e
/*
* Copyright 2003-200
7
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-200
8
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
...
...
@@ -26,17 +26,15 @@
package
sun.awt.X11
;
import
java.awt.
*
;
import
java.awt.
Frame
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.LogManager
;
import
java.awt.*
;
import
java.awt.image.*
;
import
java.util.*
;
class
XNETProtocol
extends
XProtocol
implements
XStateProtocol
,
XLayerProtocol
{
final
static
Logger
log
=
Logger
.
getLogger
(
"sun.awt.X11.XNETProtocol"
);
final
class
XNETProtocol
extends
XProtocol
implements
XStateProtocol
,
XLayerProtocol
{
private
final
static
Logger
log
=
Logger
.
getLogger
(
"sun.awt.X11.XNETProtocol"
);
private
final
static
Logger
iconLog
=
Logger
.
getLogger
(
"sun.awt.X11.icon.XNETProtocol"
);
private
static
Logger
stateLog
=
Logger
.
getLogger
(
"sun.awt.X11.states.XNETProtocol"
);
/**
* XStateProtocol
...
...
@@ -276,6 +274,7 @@ class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
boolean
doStateProtocol
()
{
boolean
res
=
active
()
&&
checkProtocol
(
XA_NET_SUPPORTED
,
XA_NET_WM_STATE
);
stateLog
.
finer
(
"doStateProtocol() returns "
+
res
);
return
res
;
}
...
...
src/solaris/classes/sun/awt/X11/XToolkit.java
浏览文件 @
ece4d22e
/*
* Copyright 2002-200
7
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2002-200
8
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
...
...
@@ -25,11 +25,9 @@
package
sun.awt.X11
;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.awt.peer.*
;
import
java.beans.PropertyChangeListener
;
import
sun.awt.*
;
import
java.util.*
;
import
java.awt.event.InputEvent
;
import
java.awt.event.MouseEvent
;
import
java.awt.datatransfer.Clipboard
;
import
java.awt.dnd.DragSource
;
import
java.awt.dnd.DragGestureListener
;
import
java.awt.dnd.DragGestureEvent
;
...
...
@@ -37,20 +35,27 @@ import java.awt.dnd.DragGestureRecognizer;
import
java.awt.dnd.MouseDragGestureRecognizer
;
import
java.awt.dnd.InvalidDnDOperationException
;
import
java.awt.dnd.peer.DragSourceContextPeer
;
import
java.awt.image.*
;
import
java.security.*
;
import
java.awt.im.InputMethodHighlight
;
import
java.awt.im.spi.InputMethodDescriptor
;
import
java.awt.datatransfer.Clipboard
;
import
java.awt.image.ColorModel
;
import
java.awt.peer.*
;
import
java.beans.PropertyChangeListener
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.util.*
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.swing.LookAndFeel
;
import
javax.swing.UIDefaults
;
import
java.util.logging
.*
;
import
sun.awt
.*
;
import
sun.font.FontManager
;
import
sun.misc.PerformanceLogger
;
import
sun.print.PrintJob2D
;
import
java.lang.reflect.*
;
public
class
XToolkit
extends
UNIXToolkit
implements
Runnable
,
XConstants
{
public
final
class
XToolkit
extends
UNIXToolkit
implements
Runnable
,
XConstants
{
private
static
Logger
log
=
Logger
.
getLogger
(
"sun.awt.X11.XToolkit"
);
private
static
Logger
eventLog
=
Logger
.
getLogger
(
"sun.awt.X11.event.XToolkit"
);
private
static
final
Logger
timeoutTaskLog
=
Logger
.
getLogger
(
"sun.awt.X11.timeoutTask.XToolkit"
);
...
...
@@ -1871,9 +1876,7 @@ public class XToolkit extends UNIXToolkit implements Runnable, XConstants {
}
public
boolean
isAlwaysOnTopSupported
()
{
Iterator
iter
=
XWM
.
getWM
().
getProtocols
(
XLayerProtocol
.
class
).
iterator
();
while
(
iter
.
hasNext
())
{
XLayerProtocol
proto
=
(
XLayerProtocol
)
iter
.
next
();
for
(
XLayerProtocol
proto
:
XWM
.
getWM
().
getProtocols
(
XLayerProtocol
.
class
))
{
if
(
proto
.
supportsLayer
(
XLayerProtocol
.
LAYER_ALWAYS_ON_TOP
))
{
return
true
;
}
...
...
src/solaris/classes/sun/awt/X11/XWM.java
浏览文件 @
ece4d22e
/*
* Copyright 2003-200
6
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-200
8
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
...
...
@@ -31,20 +31,23 @@
package
sun.awt.X11
;
import
sun.misc.Unsafe
;
import
java.
util.regex.*
;
import
java.
awt.Insets
;
import
java.awt.Frame
;
import
java.awt.Rectangle
;
import
java.util.*
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.logging.Level
;
import
java.util.logging.LogManager
;
import
java.util.logging.Logger
;
import
java.awt.Insets
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* Class incapsulating knowledge about window managers in general
* Descendants should provide some information about specific window manager.
*/
class
XWM
implements
MWMConstants
,
XUtilConstants
{
final
class
XWM
implements
MWMConstants
,
XUtilConstants
{
private
final
static
Logger
log
=
Logger
.
getLogger
(
"sun.awt.X11.XWM"
);
private
final
static
Logger
insLog
=
Logger
.
getLogger
(
"sun.awt.X11.insets.XWM"
);
...
...
@@ -1026,21 +1029,21 @@ class XWM implements MWMConstants, XUtilConstants {
/*****************************************************************************\
* Protocols support
*/
HashMap
<
Class
<?>,
Collection
<
XProtocol
>>
protocolsMap
=
new
HashMap
<
Class
<?>,
Collection
<
XProtocol
>>();
private
HashMap
<
Class
<?>,
Collection
<?>>
protocolsMap
=
new
HashMap
<
Class
<?>,
Collection
<?
>>();
/**
* Returns all protocols supporting given protocol interface
*/
Collection
<
XProtocol
>
getProtocols
(
Class
protocolInterface
)
{
Collection
<
XProtocol
>
res
=
protocolsMap
.
get
(
protocolInterface
);
<
T
>
Collection
<
T
>
getProtocols
(
Class
<
T
>
protocolInterface
)
{
Collection
<
T
>
res
=
(
Collection
<
T
>)
protocolsMap
.
get
(
protocolInterface
);
if
(
res
!=
null
)
{
return
(
Collection
<
XProtocol
>)
res
;
return
res
;
}
else
{
return
new
LinkedList
<
XProtocol
>();
return
new
LinkedList
<
T
>();
}
}
void
addProtocol
(
Class
protocolInterface
,
XProtocol
protocol
)
{
Collection
<
XProtocol
>
protocols
=
getProtocols
(
protocolInterface
);
private
<
T
>
void
addProtocol
(
Class
<
T
>
protocolInterface
,
T
protocol
)
{
Collection
<
T
>
protocols
=
getProtocols
(
protocolInterface
);
protocols
.
add
(
protocol
);
protocolsMap
.
put
(
protocolInterface
,
protocols
);
}
...
...
@@ -1085,9 +1088,7 @@ class XWM implements MWMConstants, XUtilConstants {
}
/* FALLTROUGH */
case
Frame
.
MAXIMIZED_BOTH
:
Iterator
iter
=
getProtocols
(
XStateProtocol
.
class
).
iterator
();
while
(
iter
.
hasNext
())
{
XStateProtocol
proto
=
(
XStateProtocol
)
iter
.
next
();
for
(
XStateProtocol
proto
:
getProtocols
(
XStateProtocol
.
class
))
{
if
(
proto
.
supportsState
(
state
))
{
return
true
;
}
...
...
@@ -1105,10 +1106,8 @@ class XWM implements MWMConstants, XUtilConstants {
int
getExtendedState
(
XWindowPeer
window
)
{
Iterator
iter
=
getProtocols
(
XStateProtocol
.
class
).
iterator
();
int
state
=
0
;
while
(
iter
.
hasNext
())
{
XStateProtocol
proto
=
(
XStateProtocol
)
iter
.
next
();
for
(
XStateProtocol
proto
:
getProtocols
(
XStateProtocol
.
class
))
{
state
|=
proto
.
getState
(
window
);
}
if
(
state
!=
0
)
{
...
...
@@ -1127,18 +1126,17 @@ class XWM implements MWMConstants, XUtilConstants {
/*
* Check if property change is a window state protocol message.
* If it is - return the new state as Integer, otherwise return null
*/
Integer
isStateChange
(
XDecoratedPeer
window
,
XPropertyEvent
e
)
{
boolean
isStateChange
(
XDecoratedPeer
window
,
XPropertyEvent
e
)
{
if
(!
window
.
isShowing
())
{
stateLog
.
finer
(
"Window is not showing"
);
return
null
;
return
false
;
}
int
wm_state
=
window
.
getWMState
();
if
(
wm_state
==
XlibWrapper
.
WithdrawnState
)
{
stateLog
.
finer
(
"WithdrawnState"
);
return
null
;
return
false
;
}
else
{
stateLog
.
finer
(
"Window WM_STATE is "
+
wm_state
);
}
...
...
@@ -1147,26 +1145,26 @@ class XWM implements MWMConstants, XUtilConstants {
is_state_change
=
true
;
}
Iterator
iter
=
getProtocols
(
XStateProtocol
.
class
).
iterator
();
while
(
iter
.
hasNext
())
{
XStateProtocol
proto
=
(
XStateProtocol
)
iter
.
next
();
for
(
XStateProtocol
proto
:
getProtocols
(
XStateProtocol
.
class
))
{
is_state_change
|=
proto
.
isStateChange
(
e
);
stateLog
.
finest
(
proto
+
": is state changed = "
+
is_state_change
);
}
int
res
=
0
;
return
is_state_change
;
}
if
(
is_state_change
)
{
if
(
wm_state
==
XlibWrapper
.
IconicState
)
{
res
=
Frame
.
ICONIFIED
;
}
else
{
res
=
Frame
.
NORMAL
;
}
res
|=
getExtendedState
(
window
);
}
if
(
is_state_change
)
{
return
Integer
.
valueOf
(
res
);
/*
* Returns current state (including extended) of a given window.
*/
int
getState
(
XDecoratedPeer
window
)
{
int
res
=
0
;
final
int
wm_state
=
window
.
getWMState
();
if
(
wm_state
==
XlibWrapper
.
IconicState
)
{
res
=
Frame
.
ICONIFIED
;
}
else
{
re
turn
null
;
re
s
=
Frame
.
NORMAL
;
}
res
|=
getExtendedState
(
window
);
return
res
;
}
/*****************************************************************************\
...
...
@@ -1180,9 +1178,7 @@ class XWM implements MWMConstants, XUtilConstants {
* in XLayerProtocol
*/
void
setLayer
(
XWindowPeer
window
,
int
layer
)
{
Iterator
iter
=
getProtocols
(
XLayerProtocol
.
class
).
iterator
();
while
(
iter
.
hasNext
())
{
XLayerProtocol
proto
=
(
XLayerProtocol
)
iter
.
next
();
for
(
XLayerProtocol
proto
:
getProtocols
(
XLayerProtocol
.
class
))
{
if
(
proto
.
supportsLayer
(
layer
))
{
proto
.
setLayer
(
window
,
layer
);
}
...
...
@@ -1191,9 +1187,7 @@ class XWM implements MWMConstants, XUtilConstants {
}
void
setExtendedState
(
XWindowPeer
window
,
int
state
)
{
Iterator
iter
=
getProtocols
(
XStateProtocol
.
class
).
iterator
();
while
(
iter
.
hasNext
())
{
XStateProtocol
proto
=
(
XStateProtocol
)
iter
.
next
();
for
(
XStateProtocol
proto
:
getProtocols
(
XStateProtocol
.
class
))
{
if
(
proto
.
supportsState
(
state
))
{
proto
.
setState
(
window
,
state
);
break
;
...
...
@@ -1239,9 +1233,7 @@ class XWM implements MWMConstants, XUtilConstants {
void
unshadeKludge
(
XDecoratedPeer
window
)
{
assert
(
window
.
isShowing
());
Iterator
iter
=
getProtocols
(
XStateProtocol
.
class
).
iterator
();
while
(
iter
.
hasNext
())
{
XStateProtocol
proto
=
(
XStateProtocol
)
iter
.
next
();
for
(
XStateProtocol
proto
:
getProtocols
(
XStateProtocol
.
class
))
{
proto
.
unshadeKludge
(
window
);
}
XToolkit
.
XSync
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录