Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
38f9ad22
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看板
提交
38f9ad22
编写于
3月 21, 2012
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
64aeda6c
ea2580ba
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
325 addition
and
60 deletion
+325
-60
src/macosx/classes/sun/lwawt/LWToolkit.java
src/macosx/classes/sun/lwawt/LWToolkit.java
+0
-5
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+1
-5
src/macosx/classes/sun/lwawt/PlatformWindow.java
src/macosx/classes/sun/lwawt/PlatformWindow.java
+3
-0
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+29
-0
src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
...cosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
+19
-0
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+34
-11
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
+1
-0
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
+4
-1
src/macosx/native/sun/awt/AWTView.m
src/macosx/native/sun/awt/AWTView.m
+1
-1
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+6
-5
src/macosx/native/sun/awt/CWrapper.m
src/macosx/native/sun/awt/CWrapper.m
+20
-0
src/macosx/native/sun/awt/LWCToolkit.m
src/macosx/native/sun/awt/LWCToolkit.m
+7
-4
src/macosx/native/sun/awt/OSVersion.m
src/macosx/native/sun/awt/OSVersion.m
+20
-22
src/share/classes/javax/swing/DefaultListSelectionModel.java
src/share/classes/javax/swing/DefaultListSelectionModel.java
+6
-6
src/windows/native/sun/windows/awt_Component.cpp
src/windows/native/sun/windows/awt_Component.cpp
+1
-0
test/java/awt/Frame/WindowDragTest/WindowDragTest.java
test/java/awt/Frame/WindowDragTest/WindowDragTest.java
+107
-0
test/javax/swing/JTable/7027139/bug7027139.java
test/javax/swing/JTable/7027139/bug7027139.java
+66
-0
未找到文件。
src/macosx/classes/sun/lwawt/LWToolkit.java
浏览文件 @
38f9ad22
...
@@ -522,11 +522,6 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
...
@@ -522,11 +522,6 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
postEvent
(
targetToAppContext
(
event
.
getSource
()),
event
);
postEvent
(
targetToAppContext
(
event
.
getSource
()),
event
);
}
}
/*
* Returns true if the application (one of its windows) owns keyboard focus.
*/
public
abstract
boolean
isApplicationActive
();
// use peer's back buffer to implement non-opaque windows.
// use peer's back buffer to implement non-opaque windows.
@Override
@Override
public
boolean
needUpdateWindow
()
{
public
boolean
needUpdateWindow
()
{
...
...
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
38f9ad22
...
@@ -1067,11 +1067,7 @@ public class LWWindowPeer
...
@@ -1067,11 +1067,7 @@ public class LWWindowPeer
return
false
;
return
false
;
}
}
// Cross-app activation requests are not allowed.
if
(
platformWindow
.
rejectFocusRequest
(
cause
))
{
if
(
cause
!=
CausedFocusEvent
.
Cause
.
MOUSE_EVENT
&&
!((
LWToolkit
)
Toolkit
.
getDefaultToolkit
()).
isApplicationActive
())
{
focusLog
.
fine
(
"the app is inactive, so the request is rejected"
);
return
false
;
return
false
;
}
}
...
...
src/macosx/classes/sun/lwawt/PlatformWindow.java
浏览文件 @
38f9ad22
...
@@ -27,6 +27,7 @@ package sun.lwawt;
...
@@ -27,6 +27,7 @@ package sun.lwawt;
import
java.awt.*
;
import
java.awt.*
;
import
sun.awt.CausedFocusEvent
;
import
sun.java2d.SurfaceData
;
import
sun.java2d.SurfaceData
;
// TODO Is it worth to generify this interface, like that:
// TODO Is it worth to generify this interface, like that:
...
@@ -117,6 +118,8 @@ public interface PlatformWindow {
...
@@ -117,6 +118,8 @@ public interface PlatformWindow {
public
void
updateFocusableWindowState
();
public
void
updateFocusableWindowState
();
public
boolean
rejectFocusRequest
(
CausedFocusEvent
.
Cause
cause
);
public
boolean
requestWindowFocus
();
public
boolean
requestWindowFocus
();
/*
/*
...
...
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
浏览文件 @
38f9ad22
...
@@ -38,6 +38,8 @@ import java.awt.event.*;
...
@@ -38,6 +38,8 @@ import java.awt.event.*;
public
class
CEmbeddedFrame
extends
EmbeddedFrame
{
public
class
CEmbeddedFrame
extends
EmbeddedFrame
{
private
CPlatformResponder
responder
;
private
CPlatformResponder
responder
;
private
boolean
focused
=
true
;
private
boolean
parentWindowActive
=
true
;
public
CEmbeddedFrame
()
{
public
CEmbeddedFrame
()
{
show
();
show
();
...
@@ -94,4 +96,31 @@ public class CEmbeddedFrame extends EmbeddedFrame {
...
@@ -94,4 +96,31 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public
void
handleInputEvent
(
String
text
)
{
public
void
handleInputEvent
(
String
text
)
{
new
RuntimeException
(
"Not implemented"
);
new
RuntimeException
(
"Not implemented"
);
}
}
public
void
handleFocusEvent
(
boolean
focused
)
{
this
.
focused
=
focused
;
updateOverlayWindowActiveState
();
}
public
void
handleWindowFocusEvent
(
boolean
parentWindowActive
)
{
this
.
parentWindowActive
=
parentWindowActive
;
updateOverlayWindowActiveState
();
}
public
boolean
isParentWindowActive
()
{
return
parentWindowActive
;
}
/*
* May change appearance of contents of window, and generate a
* WINDOW_ACTIVATED event.
*/
private
void
updateOverlayWindowActiveState
()
{
final
boolean
showAsFocused
=
parentWindowActive
&&
focused
;
dispatchEvent
(
new
FocusEvent
(
this
,
showAsFocused
?
FocusEvent
.
FOCUS_GAINED
:
FocusEvent
.
FOCUS_LOST
));
}
}
}
src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java
浏览文件 @
38f9ad22
...
@@ -33,17 +33,23 @@ import sun.java2d.SurfaceData;
...
@@ -33,17 +33,23 @@ import sun.java2d.SurfaceData;
import
sun.awt.CGraphicsConfig
;
import
sun.awt.CGraphicsConfig
;
import
sun.awt.CGraphicsDevice
;
import
sun.awt.CGraphicsDevice
;
import
sun.awt.CausedFocusEvent
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.BufferCapabilities.FlipContents
;
import
java.awt.BufferCapabilities.FlipContents
;
import
sun.util.logging.PlatformLogger
;
/*
/*
* Provides a lightweight implementation of the EmbeddedFrame.
* Provides a lightweight implementation of the EmbeddedFrame.
*/
*/
public
class
CPlatformEmbeddedFrame
implements
PlatformWindow
{
public
class
CPlatformEmbeddedFrame
implements
PlatformWindow
{
private
static
final
PlatformLogger
focusLogger
=
PlatformLogger
.
getLogger
(
"sun.lwawt.macosx.focus.CPlatformEmbeddedFrame"
);
private
CGLLayer
windowLayer
;
private
CGLLayer
windowLayer
;
private
LWWindowPeer
peer
;
private
LWWindowPeer
peer
;
private
CEmbeddedFrame
target
;
private
volatile
int
screenX
=
0
;
private
volatile
int
screenX
=
0
;
private
volatile
int
screenY
=
0
;
private
volatile
int
screenY
=
0
;
...
@@ -52,6 +58,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
...
@@ -52,6 +58,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
public
void
initialize
(
Window
target
,
final
LWWindowPeer
peer
,
PlatformWindow
owner
)
{
public
void
initialize
(
Window
target
,
final
LWWindowPeer
peer
,
PlatformWindow
owner
)
{
this
.
peer
=
peer
;
this
.
peer
=
peer
;
this
.
windowLayer
=
new
CGLLayer
(
peer
);
this
.
windowLayer
=
new
CGLLayer
(
peer
);
this
.
target
=
(
CEmbeddedFrame
)
target
;
}
}
@Override
@Override
...
@@ -148,6 +155,18 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
...
@@ -148,6 +155,18 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
@Override
@Override
public
void
updateFocusableWindowState
()
{}
public
void
updateFocusableWindowState
()
{}
@Override
public
boolean
rejectFocusRequest
(
CausedFocusEvent
.
Cause
cause
)
{
// Cross-app activation requests are not allowed.
if
(
cause
!=
CausedFocusEvent
.
Cause
.
MOUSE_EVENT
&&
!
target
.
isParentWindowActive
())
{
focusLogger
.
fine
(
"the embedder is inactive, so the request is rejected"
);
return
true
;
}
return
false
;
}
@Override
@Override
public
boolean
requestWindowFocus
()
{
public
boolean
requestWindowFocus
()
{
return
true
;
return
true
;
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
38f9ad22
...
@@ -65,6 +65,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -65,6 +65,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Loger to report issues happened during execution but that do not affect functionality
// Loger to report issues happened during execution but that do not affect functionality
private
static
final
PlatformLogger
logger
=
PlatformLogger
.
getLogger
(
"sun.lwawt.macosx.CPlatformWindow"
);
private
static
final
PlatformLogger
logger
=
PlatformLogger
.
getLogger
(
"sun.lwawt.macosx.CPlatformWindow"
);
private
static
final
PlatformLogger
focusLogger
=
PlatformLogger
.
getLogger
(
"sun.lwawt.macosx.focus.CPlatformWindow"
);
// for client properties
// for client properties
public
static
final
String
WINDOW_BRUSH_METAL_LOOK
=
"apple.awt.brushMetalLook"
;
public
static
final
String
WINDOW_BRUSH_METAL_LOOK
=
"apple.awt.brushMetalLook"
;
...
@@ -112,6 +113,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -112,6 +113,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static
final
int
MINIMIZABLE
=
1
<<
8
;
static
final
int
MINIMIZABLE
=
1
<<
8
;
static
final
int
RESIZABLE
=
1
<<
9
;
// both a style bit and prop bit
static
final
int
RESIZABLE
=
1
<<
9
;
// both a style bit and prop bit
static
final
int
NONACTIVATING
=
1
<<
24
;
static
final
int
_STYLE_PROP_BITMASK
=
DECORATED
|
TEXTURED
|
UNIFIED
|
UTILITY
|
HUD
|
SHEET
|
CLOSEABLE
|
MINIMIZABLE
|
RESIZABLE
;
static
final
int
_STYLE_PROP_BITMASK
=
DECORATED
|
TEXTURED
|
UNIFIED
|
UTILITY
|
HUD
|
SHEET
|
CLOSEABLE
|
MINIMIZABLE
|
RESIZABLE
;
...
@@ -127,9 +129,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -127,9 +129,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static
final
int
_METHOD_PROP_BITMASK
=
RESIZABLE
|
HAS_SHADOW
|
ZOOMABLE
|
ALWAYS_ON_TOP
|
HIDES_ON_DEACTIVATE
|
DRAGGABLE_BACKGROUND
|
DOCUMENT_MODIFIED
|
FULLSCREENABLE
;
static
final
int
_METHOD_PROP_BITMASK
=
RESIZABLE
|
HAS_SHADOW
|
ZOOMABLE
|
ALWAYS_ON_TOP
|
HIDES_ON_DEACTIVATE
|
DRAGGABLE_BACKGROUND
|
DOCUMENT_MODIFIED
|
FULLSCREENABLE
;
// not sure
static
final
int
POPUP
=
1
<<
14
;
// corresponds to callback-based properties
// corresponds to callback-based properties
static
final
int
SHOULD_BECOME_KEY
=
1
<<
12
;
static
final
int
SHOULD_BECOME_KEY
=
1
<<
12
;
static
final
int
SHOULD_BECOME_MAIN
=
1
<<
13
;
static
final
int
SHOULD_BECOME_MAIN
=
1
<<
13
;
...
@@ -264,10 +263,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -264,10 +263,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// defaults style bits
// defaults style bits
int
styleBits
=
DECORATED
|
HAS_SHADOW
|
CLOSEABLE
|
MINIMIZABLE
|
ZOOMABLE
|
RESIZABLE
;
int
styleBits
=
DECORATED
|
HAS_SHADOW
|
CLOSEABLE
|
MINIMIZABLE
|
ZOOMABLE
|
RESIZABLE
;
if
(
target
.
getName
()
==
"###overrideRedirect###"
)
{
styleBits
=
SET
(
styleBits
,
POPUP
,
true
);
}
if
(
isNativelyFocusableWindow
())
{
if
(
isNativelyFocusableWindow
())
{
styleBits
=
SET
(
styleBits
,
SHOULD_BECOME_KEY
,
true
);
styleBits
=
SET
(
styleBits
,
SHOULD_BECOME_KEY
,
true
);
styleBits
=
SET
(
styleBits
,
SHOULD_BECOME_MAIN
,
true
);
styleBits
=
SET
(
styleBits
,
SHOULD_BECOME_MAIN
,
true
);
...
@@ -275,6 +270,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -275,6 +270,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
final
boolean
isFrame
=
(
target
instanceof
Frame
);
final
boolean
isFrame
=
(
target
instanceof
Frame
);
final
boolean
isDialog
=
(
target
instanceof
Dialog
);
final
boolean
isDialog
=
(
target
instanceof
Dialog
);
final
boolean
isPopup
=
(
target
.
getType
()
==
Window
.
Type
.
POPUP
);
if
(
isDialog
)
{
if
(
isDialog
)
{
styleBits
=
SET
(
styleBits
,
MINIMIZABLE
,
false
);
styleBits
=
SET
(
styleBits
,
MINIMIZABLE
,
false
);
}
}
...
@@ -304,8 +300,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -304,8 +300,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
}
// If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look.
// If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look.
if
(
!
isDialog
&&
IS
(
styleBits
,
POPUP
)
)
{
if
(
isPopup
)
{
styleBits
=
SET
(
styleBits
,
TEXTURED
,
true
);
styleBits
=
SET
(
styleBits
,
TEXTURED
,
true
);
// Popups in applets don't activate applet's process
styleBits
=
SET
(
styleBits
,
NONACTIVATING
,
true
);
}
}
if
(
target
instanceof
javax
.
swing
.
RootPaneContainer
)
{
if
(
target
instanceof
javax
.
swing
.
RootPaneContainer
)
{
...
@@ -498,12 +496,19 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -498,12 +496,19 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// If it ain't blocked, or is being hidden, go regular way
// If it ain't blocked, or is being hidden, go regular way
if
(
visible
)
{
if
(
visible
)
{
CWrapper
.
NSWindow
.
makeFirstResponder
(
nsWindowPtr
,
contentView
.
getAWTView
());
CWrapper
.
NSWindow
.
makeFirstResponder
(
nsWindowPtr
,
contentView
.
getAWTView
());
boolean
isKeyWindow
=
CWrapper
.
NSWindow
.
isKeyWindow
(
nsWindowPtr
);
if
(!
isKeyWindow
)
{
boolean
isPopup
=
(
target
.
getType
()
==
Window
.
Type
.
POPUP
);
CWrapper
.
NSWindow
.
makeKeyAndOrderFront
(
nsWindowPtr
);
if
(
isPopup
)
{
// Popups in applets don't activate applet's process
CWrapper
.
NSWindow
.
orderFrontRegardless
(
nsWindowPtr
);
}
else
{
}
else
{
CWrapper
.
NSWindow
.
orderFront
(
nsWindowPtr
);
CWrapper
.
NSWindow
.
orderFront
(
nsWindowPtr
);
}
}
boolean
isKeyWindow
=
CWrapper
.
NSWindow
.
isKeyWindow
(
nsWindowPtr
);
if
(!
isKeyWindow
)
{
CWrapper
.
NSWindow
.
makeKeyWindow
(
nsWindowPtr
);
}
}
else
{
}
else
{
CWrapper
.
NSWindow
.
orderOut
(
nsWindowPtr
);
CWrapper
.
NSWindow
.
orderOut
(
nsWindowPtr
);
}
}
...
@@ -599,8 +604,21 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -599,8 +604,21 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
nativeSetNSWindowMinMax
(
nsWindowPtr
,
min
.
getWidth
(),
min
.
getHeight
(),
max
.
getWidth
(),
max
.
getHeight
());
nativeSetNSWindowMinMax
(
nsWindowPtr
,
min
.
getWidth
(),
min
.
getHeight
(),
max
.
getWidth
(),
max
.
getHeight
());
}
}
@Override
public
boolean
rejectFocusRequest
(
CausedFocusEvent
.
Cause
cause
)
{
// Cross-app activation requests are not allowed.
if
(
cause
!=
CausedFocusEvent
.
Cause
.
MOUSE_EVENT
&&
!((
LWCToolkit
)
Toolkit
.
getDefaultToolkit
()).
isApplicationActive
())
{
focusLogger
.
fine
(
"the app is inactive, so the request is rejected"
);
return
true
;
}
return
false
;
}
@Override
@Override
public
boolean
requestWindowFocus
()
{
public
boolean
requestWindowFocus
()
{
long
ptr
=
getNSWindowPtr
();
long
ptr
=
getNSWindowPtr
();
if
(
CWrapper
.
NSWindow
.
canBecomeMainWindow
(
ptr
))
{
if
(
CWrapper
.
NSWindow
.
canBecomeMainWindow
(
ptr
))
{
CWrapper
.
NSWindow
.
makeMainWindow
(
ptr
);
CWrapper
.
NSWindow
.
makeMainWindow
(
ptr
);
...
@@ -751,6 +769,11 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -751,6 +769,11 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
* Callbacks from the AWTWindow and AWTView objc classes.
* Callbacks from the AWTWindow and AWTView objc classes.
*************************************************************/
*************************************************************/
private
void
deliverWindowFocusEvent
(
boolean
gained
){
private
void
deliverWindowFocusEvent
(
boolean
gained
){
// Fix for 7150349: ingore "gained" notifications when the app is inactive.
if
(
gained
&&
!((
LWCToolkit
)
Toolkit
.
getDefaultToolkit
()).
isApplicationActive
())
{
focusLogger
.
fine
(
"the app is inactive, so the notification is ignored"
);
return
;
}
peer
.
notifyActivation
(
gained
);
peer
.
notifyActivation
(
gained
);
}
}
...
...
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
浏览文件 @
38f9ad22
...
@@ -47,6 +47,7 @@ public final class CWrapper {
...
@@ -47,6 +47,7 @@ public final class CWrapper {
public
static
native
void
setLevel
(
long
window
,
int
level
);
public
static
native
void
setLevel
(
long
window
,
int
level
);
public
static
native
void
makeKeyAndOrderFront
(
long
window
);
public
static
native
void
makeKeyAndOrderFront
(
long
window
);
public
static
native
void
makeKeyWindow
(
long
window
);
public
static
native
void
makeMainWindow
(
long
window
);
public
static
native
void
makeMainWindow
(
long
window
);
public
static
native
boolean
canBecomeMainWindow
(
long
window
);
public
static
native
boolean
canBecomeMainWindow
(
long
window
);
public
static
native
boolean
isKeyWindow
(
long
window
);
public
static
native
boolean
isKeyWindow
(
long
window
);
...
...
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
浏览文件 @
38f9ad22
...
@@ -686,7 +686,10 @@ public class LWCToolkit extends LWToolkit {
...
@@ -686,7 +686,10 @@ public class LWCToolkit extends LWToolkit {
return
sunAwtDisableCALayers
.
booleanValue
();
return
sunAwtDisableCALayers
.
booleanValue
();
}
}
@Override
/*
* Returns true if the application (one of its windows) owns keyboard focus.
*/
public
native
boolean
isApplicationActive
();
public
native
boolean
isApplicationActive
();
/************************
/************************
...
...
src/macosx/native/sun/awt/AWTView.m
浏览文件 @
38f9ad22
...
@@ -812,7 +812,7 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod");
...
@@ -812,7 +812,7 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod");
// Unicode value.
// Unicode value.
NSUInteger
utf8Length
=
[
aString
lengthOfBytesUsingEncoding
:
NSUTF8StringEncoding
];
NSUInteger
utf8Length
=
[
aString
lengthOfBytesUsingEncoding
:
NSUTF8StringEncoding
];
if
([
self
hasMarkedText
]
||
!
fProcessingKeystroke
||
(
utf8Length
>
2
))
{
if
([
self
hasMarkedText
]
||
!
fProcessingKeystroke
||
(
utf8Length
>
1
))
{
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
static
JNF_MEMBER_CACHE
(
jm_selectPreviousGlyph
,
jc_CInputMethod
,
"selectPreviousGlyph"
,
"()V"
);
static
JNF_MEMBER_CACHE
(
jm_selectPreviousGlyph
,
jc_CInputMethod
,
"selectPreviousGlyph"
,
"()V"
);
...
...
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
38f9ad22
...
@@ -102,11 +102,12 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
...
@@ -102,11 +102,12 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
type
|=
NSBorderlessWindowMask
;
type
|=
NSBorderlessWindowMask
;
}
}
if
(
IS
(
styleBits
,
TEXTURED
))
type
|=
NSTexturedBackgroundWindowMask
;
if
(
IS
(
styleBits
,
TEXTURED
))
type
|=
NSTexturedBackgroundWindowMask
;
if
(
IS
(
styleBits
,
UNIFIED
))
type
|=
NSUnifiedTitleAndToolbarWindowMask
;
if
(
IS
(
styleBits
,
UNIFIED
))
type
|=
NSUnifiedTitleAndToolbarWindowMask
;
if
(
IS
(
styleBits
,
UTILITY
))
type
|=
NSUtilityWindowMask
;
if
(
IS
(
styleBits
,
UTILITY
))
type
|=
NSUtilityWindowMask
;
if
(
IS
(
styleBits
,
HUD
))
type
|=
NSHUDWindowMask
;
if
(
IS
(
styleBits
,
HUD
))
type
|=
NSHUDWindowMask
;
if
(
IS
(
styleBits
,
SHEET
))
type
|=
NSDocModalWindowMask
;
if
(
IS
(
styleBits
,
SHEET
))
type
|=
NSDocModalWindowMask
;
if
(
IS
(
styleBits
,
NONACTIVATING
))
type
|=
NSNonactivatingPanelMask
;
return
type
;
return
type
;
}
}
...
...
src/macosx/native/sun/awt/CWrapper.m
浏览文件 @
38f9ad22
...
@@ -74,6 +74,26 @@ JNF_COCOA_ENTER(env);
...
@@ -74,6 +74,26 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT
(
env
);
JNF_COCOA_EXIT
(
env
);
}
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: makeKeyWindow
* Signature: (J)V
*/
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeKeyWindow
(
JNIEnv
*
env
,
jclass
cls
,
jlong
windowPtr
)
{
JNF_COCOA_ENTER
(
env
);
NSWindow
*
window
=
(
NSWindow
*
)
jlong_to_ptr
(
windowPtr
);
[
JNFRunLoop
performOnMainThread
:
@selector
(
makeKeyWindow
)
on:
window
withObject:
nil
waitUntilDone:
NO
];
JNF_COCOA_EXIT
(
env
);
}
/*
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: makeMainWindow
* Method: makeMainWindow
...
...
src/macosx/native/sun/awt/LWCToolkit.m
浏览文件 @
38f9ad22
...
@@ -401,18 +401,21 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isCapsLockOn
...
@@ -401,18 +401,21 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isCapsLockOn
JNIEXPORT
jboolean
JNICALL
Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
JNIEXPORT
jboolean
JNICALL
Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
(
JNIEnv
*
env
,
jclass
clazz
)
(
JNIEnv
*
env
,
jclass
clazz
)
{
{
__block
jboolean
active
=
JNI_FALSE
;
__block
jboolean
active
=
JNI_FALSE
;
AWT_ASSERT_NOT_APPKIT_THREAD
;
JNF_COCOA_ENTER
(
env
);
JNF_COCOA_ENTER
(
env
);
if
([
NSThread
isMainThread
])
{
active
=
(
jboolean
)[
NSRunningApplication
currentApplication
].
active
;
}
else
{
[
JNFRunLoop
performOnMainThreadWaiting
:
YES
withBlock
:
^
()
{
[
JNFRunLoop
performOnMainThreadWaiting
:
YES
withBlock
:
^
()
{
active
=
(
jboolean
)[
NSRunningApplication
currentApplication
].
active
;
active
=
(
jboolean
)[
NSRunningApplication
currentApplication
].
active
;
}];
}];
}
JNF_COCOA_EXIT
(
env
);
JNF_COCOA_EXIT
(
env
);
return
active
;
return
active
;
}
}
...
...
src/macosx/native/sun/awt/OSVersion.m
浏览文件 @
38f9ad22
...
@@ -31,33 +31,31 @@
...
@@ -31,33 +31,31 @@
#import
<JavaRuntimeSupport
/
JavaRuntimeSupport.h
>
#import
<JavaRuntimeSupport
/
JavaRuntimeSupport.h
>
// returns 10.7 for Lion, 10.6 for SnowLeopard etc.
// returns 107 for Lion, 106 for SnowLeopard etc.
double getOSXMajorVersion() {
int getOSXMajorVersion() {
char *version = JRSCopyOSVersion();
char *ver = JRSCopyOSVersion();
if (ver == NULL) {
if (version == NULL) return 0.0;
return 0;
char temp[32];
strlcpy(temp, version, sizeof(temp));
free(version);
if (strlen(temp)
<
3)
{
return
0.0;
}
}
if
(
temp
[2]
!=
'.')
{
//
Third
char
must
be
a
'.'
int len = strlen(ver);
return
0.0;
int v = 0;
// Third char must be a '.'
if (len >= 3
&&
ver[2] == '.') {
int i;
v = (ver[0] - '0') * 10 + (ver[1] - '0');
for (i = 3; i
<
len
&&
isdigit
(
ver
[
i
]);
++
i
)
{
v =
v
*
10
+
(
ver
[
i
]
-
'0');
}
}
}
char
*ptr =
strchr(temp+3,
'.');
//
remove
the
second
.
if
one
exists.
free
(
ver
);
if
(
ptr
!=
NULL
)
{
*ptr =
0;
return
v
;
}
return
atof
(
temp
);
}
}
BOOL
isSnowLeopardOrLower
()
{
BOOL
isSnowLeopardOrLower
()
{
return
(
getOSXMajorVersion
()
<
10
.
7);
return
(
getOSXMajorVersion
()
<
107);
}
}
src/share/classes/javax/swing/DefaultListSelectionModel.java
浏览文件 @
38f9ad22
...
@@ -252,6 +252,10 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable,
...
@@ -252,6 +252,10 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable,
// Updates first and last change indices
// Updates first and last change indices
private
void
markAsDirty
(
int
r
)
{
private
void
markAsDirty
(
int
r
)
{
if
(
r
==
-
1
)
{
return
;
}
firstAdjustedIndex
=
Math
.
min
(
firstAdjustedIndex
,
r
);
firstAdjustedIndex
=
Math
.
min
(
firstAdjustedIndex
,
r
);
lastAdjustedIndex
=
Math
.
max
(
lastAdjustedIndex
,
r
);
lastAdjustedIndex
=
Math
.
max
(
lastAdjustedIndex
,
r
);
}
}
...
@@ -358,16 +362,12 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable,
...
@@ -358,16 +362,12 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable,
private
void
updateLeadAnchorIndices
(
int
anchorIndex
,
int
leadIndex
)
{
private
void
updateLeadAnchorIndices
(
int
anchorIndex
,
int
leadIndex
)
{
if
(
leadAnchorNotificationEnabled
)
{
if
(
leadAnchorNotificationEnabled
)
{
if
(
this
.
anchorIndex
!=
anchorIndex
)
{
if
(
this
.
anchorIndex
!=
anchorIndex
)
{
if
(
this
.
anchorIndex
!=
-
1
)
{
// The unassigned state.
markAsDirty
(
this
.
anchorIndex
);
markAsDirty
(
this
.
anchorIndex
);
}
markAsDirty
(
anchorIndex
);
markAsDirty
(
anchorIndex
);
}
}
if
(
this
.
leadIndex
!=
leadIndex
)
{
if
(
this
.
leadIndex
!=
leadIndex
)
{
if
(
this
.
leadIndex
!=
-
1
)
{
// The unassigned state.
markAsDirty
(
this
.
leadIndex
);
markAsDirty
(
this
.
leadIndex
);
}
markAsDirty
(
leadIndex
);
markAsDirty
(
leadIndex
);
}
}
}
}
...
...
src/windows/native/sun/windows/awt_Component.cpp
浏览文件 @
38f9ad22
...
@@ -302,6 +302,7 @@ void AwtComponent::Dispose()
...
@@ -302,6 +302,7 @@ void AwtComponent::Dispose()
delete
m_childList
;
delete
m_childList
;
DestroyDropTarget
();
DestroyDropTarget
();
ReleaseDragCapture
(
0
);
if
(
m_myControlID
!=
0
)
{
if
(
m_myControlID
!=
0
)
{
AwtComponent
*
parent
=
GetParent
();
AwtComponent
*
parent
=
GetParent
();
...
...
test/java/awt/Frame/WindowDragTest/WindowDragTest.java
0 → 100644
浏览文件 @
38f9ad22
/*
* 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 7128738
@summary dragged dialog freezes system on dispose
@author Oleg Pekhovskiy: area=awt.toplevel
@library ../../regtesthelpers
@run main WindowDragTest
*/
import
java.awt.Frame
;
import
java.awt.event.InputEvent
;
import
java.awt.AWTException
;
import
test.java.awt.regtesthelpers.Util
;
import
java.awt.Robot
;
import
java.awt.Point
;
import
java.awt.Dimension
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
public
class
WindowDragTest
{
static
boolean
passed
=
false
;
public
static
void
main
(
String
[]
args
)
{
try
{
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
1000
);
Frame
frame1
=
new
Frame
();
frame1
.
setBounds
(
50
,
50
,
300
,
200
);
frame1
.
setVisible
(
true
);
frame1
.
toFront
();
frame1
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseClicked
(
MouseEvent
e
)
{
// Clicking frame1 succeeded - mouse is not captured
passed
=
true
;
}
});
robot
.
delay
(
1000
);
Frame
frame2
=
new
Frame
();
frame2
.
setBounds
(
100
,
100
,
300
,
200
);
frame2
.
setVisible
(
true
);
frame2
.
toFront
();
robot
.
delay
(
1000
);
Point
p
=
frame2
.
getLocationOnScreen
();
Dimension
d
=
frame2
.
getSize
();
// Move cursor to frame2 title bar to drag
robot
.
mouseMove
(
p
.
x
+
(
int
)(
d
.
getWidth
()
/
2
),
p
.
y
+
(
int
)
frame2
.
getInsets
().
top
/
2
);
Util
.
waitForIdle
(
robot
);
// Start window dragging
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
Util
.
waitForIdle
(
robot
);
// Dispose window being dragged
frame2
.
dispose
();
Util
.
waitForIdle
(
robot
);
// Release mouse button to be able to get MOUSE_CLICKED event on Util.clickOnComp()
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
Util
.
waitForIdle
(
robot
);
// Click frame1 to check whether mouse is not captured by frame2
Util
.
clickOnComp
(
frame1
,
robot
);
Util
.
waitForIdle
(
robot
);
frame1
.
dispose
();
if
(
passed
)
{
System
.
out
.
println
(
"Test passed."
);
}
else
{
System
.
out
.
println
(
"Test failed."
);
throw
new
RuntimeException
(
"Test failed."
);
}
}
catch
(
AWTException
e
)
{
throw
new
RuntimeException
(
"AWTException occurred - problem creating robot!"
);
}
}
}
test/javax/swing/JTable/7027139/bug7027139.java
0 → 100644
浏览文件 @
38f9ad22
/*
* 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 7027139
@summary getFirstIndex() does not return the first index that has changed
@author Pavel Porvatov
*/
import
javax.swing.*
;
import
javax.swing.event.ListSelectionEvent
;
import
javax.swing.event.ListSelectionListener
;
public
class
bug7027139
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
JTable
orderTable
=
new
JTable
(
new
String
[][]{
{
"Item 1 1"
,
"Item 1 2"
},
{
"Item 2 1"
,
"Item 2 2"
},
{
"Item 3 1"
,
"Item 3 2"
},
{
"Item 4 1"
,
"Item 4 2"
},
},
new
String
[]{
"Col 1"
,
"Col 2"
});
ListSelectionModel
selectionModel
=
orderTable
.
getSelectionModel
();
selectionModel
.
setSelectionMode
(
ListSelectionModel
.
MULTIPLE_INTERVAL_SELECTION
);
selectionModel
.
addListSelectionListener
(
new
ListSelectionListener
()
{
public
void
valueChanged
(
ListSelectionEvent
e
)
{
if
(
e
.
getValueIsAdjusting
())
{
return
;
}
if
(
e
.
getFirstIndex
()
<
0
)
{
throw
new
RuntimeException
(
"Test bug7027139 failed"
);
}
}
});
orderTable
.
selectAll
();
}
});
System
.
out
.
println
(
"Test bug7027139 passed"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录