Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e3118301
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看板
提交
e3118301
编写于
3月 13, 2014
作者:
P
pchelko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8029868: Fix KSS issues in sun.lwawt.macosx
Reviewed-by: anthony, serb
上级
054e8f42
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
184 addition
and
139 deletion
+184
-139
src/macosx/classes/sun/lwawt/macosx/CClipboard.java
src/macosx/classes/sun/lwawt/macosx/CClipboard.java
+25
-17
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+0
-1
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
+2
-2
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
+1
-2
src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
+22
-3
src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java
src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java
+3
-2
src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java
src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java
+3
-2
src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java
src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java
+3
-3
src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
+1
-2
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
+38
-38
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
+8
-19
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
+28
-27
src/macosx/native/sun/awt/AWTEvent.m
src/macosx/native/sun/awt/AWTEvent.m
+11
-11
src/macosx/native/sun/awt/AWTView.m
src/macosx/native/sun/awt/AWTView.m
+4
-4
src/macosx/native/sun/awt/CTrayIcon.m
src/macosx/native/sun/awt/CTrayIcon.m
+3
-3
src/share/classes/java/awt/SystemColor.java
src/share/classes/java/awt/SystemColor.java
+5
-2
src/share/classes/sun/awt/AWTAccessor.java
src/share/classes/sun/awt/AWTAccessor.java
+27
-1
未找到文件。
src/macosx/classes/sun/lwawt/macosx/CClipboard.java
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -40,20 +40,23 @@ import sun.awt.datatransfer.*;
* sun.awt.datatransfer.DataTransferer.
*/
public
class
CClipboard
extends
SunClipboard
{
final
class
CClipboard
extends
SunClipboard
{
public
CClipboard
(
String
name
)
{
super
(
name
);
}
@Override
public
long
getID
()
{
return
0
;
}
@Override
protected
void
clearNativeContext
()
{
// Leaving Empty, as WClipboard.clearNativeContext is empty as well.
}
@Override
protected
void
setContentsNative
(
Transferable
contents
)
{
// Don't use delayed Clipboard rendering for the Transferable's data.
...
...
@@ -89,27 +92,19 @@ public class CClipboard extends SunClipboard {
notifyChanged
();
}
private
void
notifyLostOwnership
()
{
lostOwnershipImpl
();
}
private
static
void
notifyChanged
()
{
CClipboard
clipboard
=
(
CClipboard
)
Toolkit
.
getDefaultToolkit
().
getSystemClipboard
();
if
(!
clipboard
.
areFlavorListenersRegistered
())
{
return
;
}
clipboard
.
checkChange
(
clipboard
.
getClipboardFormats
());
}
@Override
protected
native
long
[]
getClipboardFormats
();
@Override
protected
native
byte
[]
getClipboardData
(
long
format
)
throws
IOException
;
// 1.5 peer method
@Override
protected
void
unregisterClipboardViewerChecked
()
{
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
// 1.5 peer method
@Override
protected
void
registerClipboardViewerChecked
()
{
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
...
...
@@ -118,8 +113,8 @@ public class CClipboard extends SunClipboard {
// no-op. This appears to be win32 specific. Filed 4048790 for investigation
//protected Transferable createLocaleTransferable(long[] formats) throws IOException;
p
ublic
native
void
declareTypes
(
long
[]
formats
,
SunClipboard
newOwner
);
p
ublic
native
void
setData
(
byte
[]
data
,
long
format
);
p
rivate
native
void
declareTypes
(
long
[]
formats
,
SunClipboard
newOwner
);
p
rivate
native
void
setData
(
byte
[]
data
,
long
format
);
/**
* Invokes native check whether a change count on the general pasteboard is different
...
...
@@ -127,5 +122,18 @@ public class CClipboard extends SunClipboard {
* pasteboard ownership and someone else put data on the clipboard.
* @since 1.7
*/
public
native
void
checkPasteboard
();
native
void
checkPasteboard
();
/*** Native Callbacks ***/
private
void
notifyLostOwnership
()
{
lostOwnershipImpl
();
}
private
static
void
notifyChanged
()
{
CClipboard
clipboard
=
(
CClipboard
)
Toolkit
.
getDefaultToolkit
().
getSystemClipboard
();
if
(!
clipboard
.
areFlavorListenersRegistered
())
{
return
;
}
clipboard
.
checkChange
(
clipboard
.
getClipboardFormats
());
}
}
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
浏览文件 @
e3118301
...
...
@@ -28,7 +28,6 @@ package sun.lwawt.macosx;
import
sun.lwawt.LWToolkit
;
import
sun.lwawt.LWWindowPeer
;
import
sun.lwawt.macosx.CocoaConstants
;
import
sun.lwawt.macosx.event.NSEvent
;
import
sun.awt.EmbeddedFrame
;
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -28,7 +28,7 @@ package sun.lwawt.macosx;
import
sun.awt.SunToolkit
;
import
sun.lwawt.LWWindowPeer
;
import
sun.lwawt.PlatformEventNotifier
;
import
sun.lwawt.macosx.event.NSEvent
;
import
java.awt.Toolkit
;
import
java.awt.event.MouseEvent
;
import
java.awt.event.InputEvent
;
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -31,7 +31,6 @@ import java.awt.geom.Rectangle2D;
import
sun.awt.CGraphicsConfig
;
import
sun.awt.CGraphicsEnvironment
;
import
sun.lwawt.LWWindowPeer
;
import
sun.lwawt.macosx.event.NSEvent
;
import
sun.java2d.SurfaceData
;
import
sun.java2d.opengl.CGLLayer
;
...
...
src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -41,7 +41,7 @@ import javax.print.attribute.standard.PageRanges;
import
sun.java2d.*
;
import
sun.print.*
;
public
class
CPrinterJob
extends
RasterPrinterJob
{
final
class
CPrinterJob
extends
RasterPrinterJob
{
// NOTE: This uses RasterPrinterJob as a base, but it doesn't use
// all of the RasterPrinterJob functions. RasterPrinterJob will
// break down printing to pieces that aren't necessary under MacOSX
...
...
@@ -89,6 +89,7 @@ public class CPrinterJob extends RasterPrinterJob {
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
*/
@Override
public
boolean
printDialog
()
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
())
{
throw
new
HeadlessException
();
...
...
@@ -131,6 +132,7 @@ public class CPrinterJob extends RasterPrinterJob {
* @see java.awt.GraphicsEnvironment#isHeadless
* @since 1.2
*/
@Override
public
PageFormat
pageDialog
(
PageFormat
page
)
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
())
{
throw
new
HeadlessException
();
...
...
@@ -156,12 +158,14 @@ public class CPrinterJob extends RasterPrinterJob {
* @return clone of <code>page</code>, altered to describe a default
* <code>PageFormat</code>.
*/
@Override
public
PageFormat
defaultPage
(
PageFormat
page
)
{
PageFormat
newPage
=
(
PageFormat
)
page
.
clone
();
getDefaultPage
(
newPage
);
return
newPage
;
}
@Override
protected
void
setAttributes
(
PrintRequestAttributeSet
attributes
)
throws
PrinterException
{
super
.
setAttributes
(
attributes
);
...
...
@@ -216,7 +220,7 @@ public class CPrinterJob extends RasterPrinterJob {
}
}
@Override
public
void
print
(
PrintRequestAttributeSet
attributes
)
throws
PrinterException
{
// NOTE: Some of this code is copied from RasterPrinterJob.
...
...
@@ -343,6 +347,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Returns the resolution in dots per inch across the width
* of the page.
*/
@Override
protected
double
getXRes
()
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -352,6 +357,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Returns the resolution in dots per inch down the height
* of the page.
*/
@Override
protected
double
getYRes
()
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -362,6 +368,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPrintableX
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -372,6 +379,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPrintableY
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -382,6 +390,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPrintableWidth
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -392,6 +401,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPrintableHeight
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -402,6 +412,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPageWidth
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -412,6 +423,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPageHeight
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -429,6 +441,7 @@ public class CPrinterJob extends RasterPrinterJob {
/**
* End a page.
*/
@Override
protected
void
endPage
(
PageFormat
format
,
Printable
painter
,
int
index
)
throws
PrinterException
{
// NOTE: This is not used in the CPrinterJob code path.
throw
new
PrinterException
(
sShouldNotReachHere
);
...
...
@@ -441,6 +454,7 @@ public class CPrinterJob extends RasterPrinterJob {
* page. The width and height of the band is
* specified by the caller.
*/
@Override
protected
void
printBand
(
byte
[]
data
,
int
x
,
int
y
,
int
width
,
int
height
)
throws
PrinterException
{
// NOTE: This is not used in the CPrinterJob code path.
throw
new
PrinterException
(
sShouldNotReachHere
);
...
...
@@ -450,6 +464,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Called by the print() method at the start of
* a print job.
*/
@Override
protected
void
startDoc
()
throws
PrinterException
{
// NOTE: This is not used in the CPrinterJob code path.
throw
new
PrinterException
(
sShouldNotReachHere
);
...
...
@@ -459,12 +474,14 @@ public class CPrinterJob extends RasterPrinterJob {
* Called by the print() method at the end of
* a print job.
*/
@Override
protected
void
endDoc
()
throws
PrinterException
{
// NOTE: This is not used in the CPrinterJob code path.
throw
new
PrinterException
(
sShouldNotReachHere
);
}
/* Called by cancelDoc */
@Override
protected
native
void
abortDoc
();
/**
...
...
@@ -502,10 +519,12 @@ public class CPrinterJob extends RasterPrinterJob {
/**
* validate the paper size against the current printer.
*/
@Override
protected
native
void
validatePaper
(
Paper
origPaper
,
Paper
newPaper
);
// The following methods are CPrinterJob specific.
@Override
protected
void
finalize
()
{
if
(
fNSPrintInfo
!=
-
1
)
{
dispose
(
fNSPrintInfo
);
...
...
src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -29,7 +29,7 @@ package sun.lwawt.macosx;
import
java.awt.*
;
import
java.awt.print.*
;
public
class
CPrinterJobDialog
extends
CPrinterDialog
{
final
class
CPrinterJobDialog
extends
CPrinterDialog
{
private
Pageable
fPageable
;
private
boolean
fAllowPrintToFile
;
...
...
@@ -39,5 +39,6 @@ public class CPrinterJobDialog extends CPrinterDialog {
fAllowPrintToFile
=
allowPrintToFile
;
}
@Override
protected
native
boolean
showDialog
();
}
src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -29,7 +29,7 @@ package sun.lwawt.macosx;
import
java.awt.*
;
import
java.awt.print.*
;
public
class
CPrinterPageDialog
extends
CPrinterDialog
{
final
class
CPrinterPageDialog
extends
CPrinterDialog
{
private
PageFormat
fPage
;
private
Printable
fPainter
;
...
...
@@ -39,5 +39,6 @@ public class CPrinterPageDialog extends CPrinterDialog {
fPainter
=
painter
;
}
@Override
protected
native
boolean
showDialog
();
}
src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -40,11 +40,11 @@ public class CPrinterSurfaceData extends OSXSurfaceData{
// public static final SurfaceType IntArgbPQ = SurfaceType.IntArgb.deriveSubType(DESC_INT_ARGB_PQ);
public
static
final
SurfaceType
IntRgbPQ
=
SurfaceType
.
IntRgb
.
deriveSubType
(
DESC_INT_RGB_PQ
);
public
static
SurfaceData
createData
(
PageFormat
pf
,
long
context
)
{
static
SurfaceData
createData
(
PageFormat
pf
,
long
context
)
{
return
new
CPrinterSurfaceData
(
CPrinterGraphicsConfig
.
getConfig
(
pf
),
context
);
}
p
ublic
CPrinterSurfaceData
(
GraphicsConfiguration
gc
,
long
context
)
{
p
rivate
CPrinterSurfaceData
(
GraphicsConfiguration
gc
,
long
context
)
{
super
(
IntRgbPQ
,
gc
.
getColorModel
(),
gc
,
gc
.
getBounds
());
initOps
(
context
,
this
.
fGraphicsStates
,
this
.
fGraphicsStatesObject
,
gc
.
getBounds
().
width
,
gc
.
getBounds
().
height
);
}
...
...
src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -27,7 +27,6 @@ package sun.lwawt.macosx;
import
sun.awt.AWTAccessor
;
import
sun.awt.SunToolkit
;
import
sun.lwawt.macosx.event.NSEvent
;
import
javax.swing.*
;
import
java.awt.*
;
...
...
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
浏览文件 @
e3118301
...
...
@@ -25,65 +25,65 @@
package
sun.lwawt.macosx
;
public
final
class
CWrapper
{
final
class
CWrapper
{
private
CWrapper
()
{
}
public
static
final
class
NSWindow
{
static
final
class
NSWindow
{
// NSWindowOrderingMode
public
static
final
int
NSWindowAbove
=
1
;
public
static
final
int
NSWindowBelow
=
-
1
;
public
static
final
int
NSWindowOut
=
0
;
static
final
int
NSWindowAbove
=
1
;
static
final
int
NSWindowBelow
=
-
1
;
static
final
int
NSWindowOut
=
0
;
// Window level constants
// The number of supported levels: (we'll use more in the future)
public
static
final
int
MAX_WINDOW_LEVELS
=
3
;
static
final
int
MAX_WINDOW_LEVELS
=
3
;
// The levels: (these are NOT real constants, these are keys. See native code.)
public
static
final
int
NSNormalWindowLevel
=
0
;
public
static
final
int
NSFloatingWindowLevel
=
1
;
public
static
final
int
NSPopUpMenuWindowLevel
=
2
;
static
final
int
NSNormalWindowLevel
=
0
;
static
final
int
NSFloatingWindowLevel
=
1
;
static
final
int
NSPopUpMenuWindowLevel
=
2
;
// 'level' is one of the keys defined above
public
static
native
void
setLevel
(
long
window
,
int
level
);
static
native
void
setLevel
(
long
window
,
int
level
);
public
static
native
void
makeKeyAndOrderFront
(
long
window
);
public
static
native
void
makeKeyWindow
(
long
window
);
public
static
native
void
makeMainWindow
(
long
window
);
public
static
native
boolean
canBecomeMainWindow
(
long
window
);
public
static
native
boolean
isKeyWindow
(
long
window
);
static
native
void
makeKeyAndOrderFront
(
long
window
);
static
native
void
makeKeyWindow
(
long
window
);
static
native
void
makeMainWindow
(
long
window
);
static
native
boolean
canBecomeMainWindow
(
long
window
);
static
native
boolean
isKeyWindow
(
long
window
);
public
static
native
void
orderFront
(
long
window
);
public
static
native
void
orderFrontRegardless
(
long
window
);
public
static
native
void
orderWindow
(
long
window
,
int
ordered
,
long
relativeTo
);
public
static
native
void
orderOut
(
long
window
);
static
native
void
orderFront
(
long
window
);
static
native
void
orderFrontRegardless
(
long
window
);
static
native
void
orderWindow
(
long
window
,
int
ordered
,
long
relativeTo
);
static
native
void
orderOut
(
long
window
);
public
static
native
void
addChildWindow
(
long
parent
,
long
child
,
int
ordered
);
public
static
native
void
removeChildWindow
(
long
parent
,
long
child
);
static
native
void
addChildWindow
(
long
parent
,
long
child
,
int
ordered
);
static
native
void
removeChildWindow
(
long
parent
,
long
child
);
public
static
native
void
setAlphaValue
(
long
window
,
float
alpha
);
public
static
native
void
setOpaque
(
long
window
,
boolean
opaque
);
public
static
native
void
setBackgroundColor
(
long
window
,
long
color
);
static
native
void
setAlphaValue
(
long
window
,
float
alpha
);
static
native
void
setOpaque
(
long
window
,
boolean
opaque
);
static
native
void
setBackgroundColor
(
long
window
,
long
color
);
public
static
native
void
miniaturize
(
long
window
);
public
static
native
void
deminiaturize
(
long
window
);
public
static
native
boolean
isZoomed
(
long
window
);
public
static
native
void
zoom
(
long
window
);
static
native
void
miniaturize
(
long
window
);
static
native
void
deminiaturize
(
long
window
);
static
native
boolean
isZoomed
(
long
window
);
static
native
void
zoom
(
long
window
);
public
static
native
void
makeFirstResponder
(
long
window
,
long
responder
);
static
native
void
makeFirstResponder
(
long
window
,
long
responder
);
}
public
static
final
class
NSView
{
public
static
native
void
addSubview
(
long
view
,
long
subview
);
public
static
native
void
removeFromSuperview
(
long
view
);
static
final
class
NSView
{
static
native
void
addSubview
(
long
view
,
long
subview
);
static
native
void
removeFromSuperview
(
long
view
);
public
static
native
void
setFrame
(
long
view
,
int
x
,
int
y
,
int
w
,
int
h
);
public
static
native
long
window
(
long
view
);
static
native
void
setFrame
(
long
view
,
int
x
,
int
y
,
int
w
,
int
h
);
static
native
long
window
(
long
view
);
public
static
native
void
setHidden
(
long
view
,
boolean
hidden
);
static
native
void
setHidden
(
long
view
,
boolean
hidden
);
public
static
native
void
setToolTip
(
long
view
,
String
msg
);
static
native
void
setToolTip
(
long
view
,
String
msg
);
}
public
static
final
class
NSColor
{
public
static
native
long
clearColor
();
static
final
class
NSColor
{
static
native
long
clearColor
();
}
}
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
浏览文件 @
e3118301
...
...
@@ -158,25 +158,14 @@ public final class LWCToolkit extends LWToolkit {
return
new
AppleSpecificColor
(
color
);
}
// This is only called from native code.
static
void
systemColorsChanged
()
{
// This is only called from native code.
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Object
>()
{
public
Object
run
()
{
try
{
final
Method
updateColorsMethod
=
SystemColor
.
class
.
getDeclaredMethod
(
"updateSystemColors"
,
new
Class
[
0
]);
updateColorsMethod
.
setAccessible
(
true
);
updateColorsMethod
.
invoke
(
null
,
new
Object
[
0
]);
}
catch
(
final
Throwable
e
)
{
e
.
printStackTrace
();
// swallow this if something goes horribly wrong
}
return
null
;
}
});
}
});
EventQueue
.
invokeLater
(()
->
{
AccessController
.
doPrivileged
((
PrivilegedAction
<
Object
>)
()
->
{
AWTAccessor
.
getSystemColorAccessor
().
updateSystemColors
();
return
null
;
});
});
}
public
static
LWCToolkit
getLWCToolkit
()
{
...
...
@@ -736,7 +725,7 @@ public final class LWCToolkit extends LWToolkit {
/*
* Returns true if the application (one of its windows) owns keyboard focus.
*/
public
native
boolean
isApplicationActive
();
native
boolean
isApplicationActive
();
/************************
* Native methods section
...
...
src/macosx/classes/sun/lwawt/macosx/
event/
NSEvent.java
→
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -23,16 +23,15 @@
* questions.
*/
package
sun.lwawt.macosx
.event
;
package
sun.lwawt.macosx
;
import
sun.lwawt.macosx.CocoaConstants
;
import
java.awt.event.*
;
/**
* A class representing Cocoa NSEvent class with the fields only necessary for
* JDK functionality.
*/
public
final
class
NSEvent
{
final
class
NSEvent
{
private
int
type
;
private
int
modifierFlags
;
...
...
@@ -50,14 +49,16 @@ public final class NSEvent {
private
short
keyCode
;
private
String
charactersIgnoringModifiers
;
public
NSEvent
(
int
type
,
int
modifierFlags
,
short
keyCode
,
String
charactersIgnoringModifiers
)
{
// Called from native
NSEvent
(
int
type
,
int
modifierFlags
,
short
keyCode
,
String
charactersIgnoringModifiers
)
{
this
.
type
=
type
;
this
.
modifierFlags
=
modifierFlags
;
this
.
keyCode
=
keyCode
;
this
.
charactersIgnoringModifiers
=
charactersIgnoringModifiers
;
}
public
NSEvent
(
int
type
,
int
modifierFlags
,
int
clickCount
,
int
buttonNumber
,
// Called from native
NSEvent
(
int
type
,
int
modifierFlags
,
int
clickCount
,
int
buttonNumber
,
int
x
,
int
y
,
int
absX
,
int
absY
,
double
scrollDeltaY
,
double
scrollDeltaX
)
{
this
.
type
=
type
;
...
...
@@ -72,51 +73,51 @@ public final class NSEvent {
this
.
scrollDeltaX
=
scrollDeltaX
;
}
public
int
getType
()
{
int
getType
()
{
return
type
;
}
public
int
getModifierFlags
()
{
int
getModifierFlags
()
{
return
modifierFlags
;
}
public
int
getClickCount
()
{
int
getClickCount
()
{
return
clickCount
;
}
public
int
getButtonNumber
()
{
int
getButtonNumber
()
{
return
buttonNumber
;
}
public
int
getX
()
{
int
getX
()
{
return
x
;
}
public
int
getY
()
{
int
getY
()
{
return
y
;
}
public
double
getScrollDeltaY
()
{
double
getScrollDeltaY
()
{
return
scrollDeltaY
;
}
public
double
getScrollDeltaX
()
{
double
getScrollDeltaX
()
{
return
scrollDeltaX
;
}
public
int
getAbsX
()
{
int
getAbsX
()
{
return
absX
;
}
public
int
getAbsY
()
{
int
getAbsY
()
{
return
absY
;
}
public
short
getKeyCode
()
{
short
getKeyCode
()
{
return
keyCode
;
}
public
String
getCharactersIgnoringModifiers
()
{
String
getCharactersIgnoringModifiers
()
{
return
charactersIgnoringModifiers
;
}
...
...
@@ -131,7 +132,7 @@ public final class NSEvent {
/*
* Converts an NSEvent button number to a MouseEvent constant.
*/
public
static
int
nsToJavaButton
(
int
buttonNumber
)
{
static
int
nsToJavaButton
(
int
buttonNumber
)
{
int
jbuttonNumber
=
buttonNumber
+
1
;
switch
(
buttonNumber
)
{
case
CocoaConstants
.
kCGMouseButtonLeft
:
...
...
@@ -150,7 +151,7 @@ public final class NSEvent {
/*
* Converts NPCocoaEvent types to AWT event types.
*/
public
static
int
npToJavaEventType
(
int
npEventType
)
{
static
int
npToJavaEventType
(
int
npEventType
)
{
int
jeventType
=
0
;
switch
(
npEventType
)
{
case
CocoaConstants
.
NPCocoaEventMouseDown
:
...
...
@@ -184,7 +185,7 @@ public final class NSEvent {
/*
* Converts NSEvent types to AWT event types.
*/
public
static
int
nsToJavaEventType
(
int
nsEventType
)
{
static
int
nsToJavaEventType
(
int
nsEventType
)
{
int
jeventType
=
0
;
switch
(
nsEventType
)
{
case
CocoaConstants
.
NSLeftMouseDown
:
...
...
@@ -227,31 +228,31 @@ public final class NSEvent {
/*
* Converts NSEvent mouse modifiers to AWT mouse modifiers.
*/
public
static
native
int
nsToJavaMouseModifiers
(
int
buttonNumber
,
static
native
int
nsToJavaMouseModifiers
(
int
buttonNumber
,
int
modifierFlags
);
/*
* Converts NSEvent key modifiers to AWT key modifiers.
*/
public
static
native
int
nsToJavaKeyModifiers
(
int
modifierFlags
);
static
native
int
nsToJavaKeyModifiers
(
int
modifierFlags
);
/*
* Converts NSEvent key info to AWT key info.
*/
public
static
native
boolean
nsToJavaKeyInfo
(
int
[]
in
,
int
[]
out
);
static
native
boolean
nsToJavaKeyInfo
(
int
[]
in
,
int
[]
out
);
/*
* Converts NSEvent key modifiers to AWT key info.
*/
public
static
native
void
nsKeyModifiersToJavaKeyInfo
(
int
[]
in
,
int
[]
out
);
static
native
void
nsKeyModifiersToJavaKeyInfo
(
int
[]
in
,
int
[]
out
);
/*
* There is a small number of NS characters that need to be converted
* into other characters before we pass them to AWT.
*/
public
static
native
char
nsToJavaChar
(
char
nsChar
,
int
modifierFlags
);
static
native
char
nsToJavaChar
(
char
nsChar
,
int
modifierFlags
);
public
static
boolean
isPopupTrigger
(
int
jmodifiers
)
{
static
boolean
isPopupTrigger
(
int
jmodifiers
)
{
final
boolean
isRightButtonDown
=
((
jmodifiers
&
InputEvent
.
BUTTON3_DOWN_MASK
)
!=
0
);
final
boolean
isLeftButtonDown
=
((
jmodifiers
&
InputEvent
.
BUTTON1_DOWN_MASK
)
!=
0
);
final
boolean
isControlDown
=
((
jmodifiers
&
InputEvent
.
CTRL_DOWN_MASK
)
!=
0
);
...
...
src/macosx/native/sun/awt/AWTEvent.m
浏览文件 @
e3118301
/*
*
Copyright
(
c
)
2011
,
201
3
,
Oracle
and
/
or
its
affiliates
.
All
rights
reserved
.
*
Copyright
(
c
)
2011
,
201
4
,
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
...
...
@@ -633,12 +633,12 @@ Java_java_awt_AWTEvent_nativeSetSource
}
/*
*
Class
:
sun
_
lwawt
_
macosx
_
event
_
NSEvent
*
Class
:
sun
_
lwawt
_
macosx
_
NSEvent
*
Method
:
nsToJavaMouseModifiers
*
Signature
:
(
II
)
I
*/
JNIEXPORT
jint
JNICALL
Java
_
sun
_
lwawt
_
macosx
_
event
_
NSEvent
_
nsToJavaMouseModifiers
Java
_
sun
_
lwawt
_
macosx
_
NSEvent
_
nsToJavaMouseModifiers
(
JNIEnv
*
env
,
jclass
cls
,
jint
buttonNumber
,
jint
modifierFlags
)
{
jint
jmodifiers
=
0
;
...
...
@@ -653,12 +653,12 @@ JNF_COCOA_EXIT(env);
}
/*
*
Class
:
sun
_
lwawt
_
macosx
_
event
_
NSEvent
*
Class
:
sun
_
lwawt
_
macosx
_
NSEvent
*
Method
:
nsToJavaKeyModifiers
*
Signature
:
(
I
)
I
*/
JNIEXPORT
jint
JNICALL
Java
_
sun
_
lwawt
_
macosx
_
event
_
NSEvent
_
nsToJavaKeyModifiers
Java
_
sun
_
lwawt
_
macosx
_
NSEvent
_
nsToJavaKeyModifiers
(
JNIEnv
*
env
,
jclass
cls
,
jint
modifierFlags
)
{
jint
jmodifiers
=
0
;
...
...
@@ -673,12 +673,12 @@ JNF_COCOA_EXIT(env);
}
/*
*
Class
:
sun
_
lwawt
_
macosx
_
event
_
NSEvent
*
Class
:
sun
_
lwawt
_
macosx
_
NSEvent
*
Method
:
nsToJavaKeyInfo
*
Signature
:
([
I
[
I
)
Z
*/
JNIEXPORT
jboolean
JNICALL
Java
_
sun
_
lwawt
_
macosx
_
event
_
NSEvent
_
nsToJavaKeyInfo
Java
_
sun
_
lwawt
_
macosx
_
NSEvent
_
nsToJavaKeyInfo
(
JNIEnv
*
env
,
jclass
cls
,
jintArray
inData
,
jintArray
outData
)
{
BOOL
postsTyped
=
NO
;
...
...
@@ -715,12 +715,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_
event_
NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsKeyModifiersToJavaKeyInfo
* Signature: ([I[I)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_
event_
NSEvent_nsKeyModifiersToJavaKeyInfo
Java_sun_lwawt_macosx_NSEvent_nsKeyModifiersToJavaKeyInfo
(JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
{
JNF_COCOA_ENTER(env);
...
...
@@ -753,12 +753,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_
event_
NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaChar
* Signature: (CI)C
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_
event_
NSEvent_nsToJavaChar
Java_sun_lwawt_macosx_NSEvent_nsToJavaChar
(JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags)
{
jchar javaChar = 0;
...
...
src/macosx/native/sun/awt/AWTView.m
浏览文件 @
e3118301
...
...
@@ -380,7 +380,7 @@ AWT_ASSERT_APPKIT_THREAD;
clickCount
=
[
event
clickCount
];
}
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/
event/
NSEvent"
);
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/NSEvent"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IIIIIIIIDD)V"
);
jobject
jEvent
=
JNFNewObject
(
env
,
jctor_NSEvent
,
[
event
type
],
...
...
@@ -397,7 +397,7 @@ AWT_ASSERT_APPKIT_THREAD;
}
static
JNF_CLASS_CACHE
(
jc_PlatformView
,
"sun/lwawt/macosx/CPlatformView"
);
static
JNF_MEMBER_CACHE
(
jm_deliverMouseEvent
,
jc_PlatformView
,
"deliverMouseEvent"
,
"(Lsun/lwawt/macosx/
event/
NSEvent;)V"
);
static
JNF_MEMBER_CACHE
(
jm_deliverMouseEvent
,
jc_PlatformView
,
"deliverMouseEvent"
,
"(Lsun/lwawt/macosx/NSEvent;)V"
);
JNFCallVoidMethod
(
env
,
m_cPlatformView
,
jm_deliverMouseEvent
,
jEvent
);
}
...
...
@@ -445,7 +445,7 @@ AWT_ASSERT_APPKIT_THREAD;
characters
=
JNFNSToJavaString
(
env
,
[
event
characters
]);
}
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/
event/
NSEvent"
);
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/NSEvent"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IISLjava/lang/String;)V"
);
jobject
jevent
=
JNFNewObject
(
env
,
jctor_NSEvent
,
[
event
type
],
...
...
@@ -455,7 +455,7 @@ AWT_ASSERT_APPKIT_THREAD;
static
JNF_CLASS_CACHE
(
jc_PlatformView
,
"sun/lwawt/macosx/CPlatformView"
);
static
JNF_MEMBER_CACHE
(
jm_deliverKeyEvent
,
jc_PlatformView
,
"deliverKeyEvent"
,
"(Lsun/lwawt/macosx/
event/
NSEvent;)V"
);
"deliverKeyEvent"
,
"(Lsun/lwawt/macosx/NSEvent;)V"
);
JNFCallVoidMethod
(
env
,
m_cPlatformView
,
jm_deliverKeyEvent
,
jevent
);
if
(
characters
!=
NULL
)
{
...
...
src/macosx/native/sun/awt/CTrayIcon.m
浏览文件 @
e3118301
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -135,7 +135,7 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
clickCount
=
[
event
clickCount
];
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/
event/
NSEvent"
);
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/NSEvent"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IIIIIIIIDD)V"
);
jobject
jEvent
=
JNFNewObject
(
env
,
jctor_NSEvent
,
[
event
type
],
...
...
@@ -152,7 +152,7 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
}
static
JNF_CLASS_CACHE
(
jc_TrayIcon
,
"sun/lwawt/macosx/CTrayIcon"
);
static
JNF_MEMBER_CACHE
(
jm_handleMouseEvent
,
jc_TrayIcon
,
"handleMouseEvent"
,
"(Lsun/lwawt/macosx/
event/
NSEvent;)V"
);
static
JNF_MEMBER_CACHE
(
jm_handleMouseEvent
,
jc_TrayIcon
,
"handleMouseEvent"
,
"(Lsun/lwawt/macosx/NSEvent;)V"
);
JNFCallVoidMethod
(
env
,
peer
,
jm_handleMouseEvent
,
jEvent
);
}
...
...
src/share/classes/java/awt/SystemColor.java
浏览文件 @
e3118301
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
4
, 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
...
...
@@ -24,6 +24,8 @@
*/
package
java.awt
;
import
sun.awt.AWTAccessor
;
import
java.io.ObjectStreamException
;
import
java.lang.annotation.Native
;
...
...
@@ -459,7 +461,8 @@ public final class SystemColor extends Color implements java.io.Serializable {
};
static
{
updateSystemColors
();
AWTAccessor
.
setSystemColorAccessor
(
SystemColor:
:
updateSystemColors
);
updateSystemColors
();
}
/**
...
...
src/share/classes/sun/awt/AWTAccessor.java
浏览文件 @
e3118301
/*
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
4
, 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
...
...
@@ -728,6 +728,13 @@ public final class AWTAccessor {
void
dispose
(
InvocationEvent
event
);
}
/*
* An accessor object for the SystemColor class
*/
public
interface
SystemColorAccessor
{
void
updateSystemColors
();
}
/*
* Accessor instances are initialized in the static initializers of
* corresponding AWT classes by using setters defined below.
...
...
@@ -757,6 +764,7 @@ public final class AWTAccessor {
private
static
SequencedEventAccessor
sequencedEventAccessor
;
private
static
ToolkitAccessor
toolkitAccessor
;
private
static
InvocationEventAccessor
invocationEventAccessor
;
private
static
SystemColorAccessor
systemColorAccessor
;
/*
* Set an accessor object for the java.awt.Component class.
...
...
@@ -1182,4 +1190,22 @@ public final class AWTAccessor {
public
static
InvocationEventAccessor
getInvocationEventAccessor
()
{
return
invocationEventAccessor
;
}
/*
* Get the accessor object for the java.awt.SystemColor class.
*/
public
static
SystemColorAccessor
getSystemColorAccessor
()
{
if
(
systemColorAccessor
==
null
)
{
unsafe
.
ensureClassInitialized
(
SystemColor
.
class
);
}
return
systemColorAccessor
;
}
/*
* Set the accessor object for the java.awt.SystemColor class.
*/
public
static
void
setSystemColorAccessor
(
SystemColorAccessor
systemColorAccessor
)
{
AWTAccessor
.
systemColorAccessor
=
systemColorAccessor
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录