Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0a9a69b6
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0a9a69b6
编写于
10月 30, 2013
作者:
L
leonidr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8013581: [macosx] Key Bindings break with awt GraphicsEnvironment setFullScreenWindow
Reviewed-by: anthony, serb
上级
bd5f4455
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
172 addition
and
80 deletion
+172
-80
src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java
src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java
+0
-8
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
+0
-8
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+5
-20
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
+0
-3
src/macosx/native/sun/awt/AWTWindow.h
src/macosx/native/sun/awt/AWTWindow.h
+3
-1
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+56
-0
src/macosx/native/sun/awt/CWrapper.m
src/macosx/native/sun/awt/CWrapper.m
+0
-40
test/java/awt/FullScreen/8013581/bug8013581.java
test/java/awt/FullScreen/8013581/bug8013581.java
+108
-0
未找到文件。
src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java
浏览文件 @
0a9a69b6
...
...
@@ -53,14 +53,6 @@ public class CPlatformLWView extends CPlatformView {
public
void
setBounds
(
int
x
,
int
y
,
int
width
,
int
height
)
{
}
@Override
public
void
enterFullScreenMode
()
{
}
@Override
public
void
exitFullScreenMode
()
{
}
@Override
public
SurfaceData
replaceSurfaceData
()
{
return
null
;
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
浏览文件 @
0a9a69b6
...
...
@@ -96,14 +96,6 @@ public class CPlatformView extends CFRetainedResource {
return
peer
;
}
public
void
enterFullScreenMode
()
{
CWrapper
.
NSView
.
enterFullScreenMode
(
ptr
);
}
public
void
exitFullScreenMode
()
{
CWrapper
.
NSView
.
exitFullScreenMode
(
ptr
);
}
public
void
setToolTip
(
String
msg
)
{
CWrapper
.
NSView
.
setToolTip
(
ptr
,
msg
);
}
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
0a9a69b6
...
...
@@ -63,6 +63,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private
static
native
void
nativeSynthesizeMouseEnteredExitedEvents
();
private
static
native
void
nativeDispose
(
long
nsWindowPtr
);
private
static
native
CPlatformWindow
nativeGetTopmostPlatformWindowUnderMouse
();
private
static
native
void
nativeEnterFullScreenMode
(
long
nsWindowPtr
);
private
static
native
void
nativeExitFullScreenMode
(
long
nsWindowPtr
);
// Loger to report issues happened during execution but that do not affect functionality
private
static
final
PlatformLogger
logger
=
PlatformLogger
.
getLogger
(
"sun.lwawt.macosx.CPlatformWindow"
);
...
...
@@ -440,10 +442,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
// PlatformWindow
public
Insets
getInsets
()
{
if
(!
isFullScreenMode
)
{
return
nativeGetNSWindowInsets
(
getNSWindowPtr
());
}
return
new
Insets
(
0
,
0
,
0
,
0
);
return
nativeGetNSWindowInsets
(
getNSWindowPtr
());
}
@Override
// PlatformWindow
...
...
@@ -764,18 +763,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
public
void
enterFullScreenMode
()
{
isFullScreenMode
=
true
;
contentView
.
enterFullScreenMode
();
// the move/size notification from the underlying system comes
// but it contains a bounds smaller than the whole screen
// and therefore we need to create the synthetic notifications
Rectangle
screenBounds
=
getPeer
().
getGraphicsConfiguration
().
getBounds
();
peer
.
notifyReshape
(
screenBounds
.
x
,
screenBounds
.
y
,
screenBounds
.
width
,
screenBounds
.
height
);
nativeEnterFullScreenMode
(
getNSWindowPtr
());
}
@Override
public
void
exitFullScreenMode
()
{
contentView
.
exitFullScreenMode
(
);
nativeExitFullScreenMode
(
getNSWindowPtr
()
);
isFullScreenMode
=
false
;
}
...
...
@@ -933,14 +926,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
protected
void
deliverMoveResizeEvent
(
int
x
,
int
y
,
int
width
,
int
height
,
boolean
byUser
)
{
// when the content view enters the full-screen mode, the native
// move/resize notifications contain a bounds smaller than
// the whole screen and therefore we ignore the native notifications
// and the content view itself creates correct synthetic notifications
if
(
isFullScreenMode
)
{
return
;
}
checkZoom
();
final
Rectangle
oldB
=
nativeBounds
;
...
...
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
浏览文件 @
0a9a69b6
...
...
@@ -82,9 +82,6 @@ public final class CWrapper {
public
static
native
Rectangle2D
frame
(
long
view
);
public
static
native
long
window
(
long
view
);
public
static
native
void
enterFullScreenMode
(
long
view
);
public
static
native
void
exitFullScreenMode
(
long
view
);
public
static
native
void
setHidden
(
long
view
,
boolean
hidden
);
public
static
native
void
setToolTip
(
long
view
,
String
msg
);
...
...
src/macosx/native/sun/awt/AWTWindow.h
浏览文件 @
0a9a69b6
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
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
...
...
@@ -45,6 +45,7 @@
BOOL
isEnabled
;
NSWindow
*
nsWindow
;
AWTWindow
*
ownerWindow
;
jint
preFullScreenLevel
;
}
// An instance of either AWTWindow_Normal or AWTWindow_Panel
...
...
@@ -57,6 +58,7 @@
@property
(
nonatomic
)
NSSize
javaMaxSize
;
@property
(
nonatomic
)
jint
styleBits
;
@property
(
nonatomic
)
BOOL
isEnabled
;
@property
(
nonatomic
)
jint
preFullScreenLevel
;
-
(
id
)
initWithPlatformWindow
:(
JNFWeakJObjectWrapper
*
)
javaPlatformWindow
...
...
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
0a9a69b6
...
...
@@ -122,6 +122,7 @@ AWT_NS_WINDOW_IMPLEMENTATION
@synthesize
styleBits
;
@synthesize
isEnabled
;
@synthesize
ownerWindow
;
@synthesize
preFullScreenLevel
;
-
(
void
)
updateMinMaxSize
:(
BOOL
)
resizable
{
if
(
resizable
)
{
...
...
@@ -1212,3 +1213,58 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT
(
env
);
}
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CPlatformWindow_nativeEnterFullScreenMode
(
JNIEnv
*
env
,
jclass
clazz
,
jlong
windowPtr
)
{
JNF_COCOA_ENTER
(
env
);
NSWindow
*
nsWindow
=
OBJC
(
windowPtr
);
[
ThreadUtilities
performOnMainThreadWaiting
:
NO
block
:
^
(){
AWTWindow
*
window
=
(
AWTWindow
*
)[
nsWindow
delegate
];
NSNumber
*
screenID
=
[
AWTWindow
getNSWindowDisplayID_AppKitThread
:
nsWindow
];
CGDirectDisplayID
aID
=
[
screenID
intValue
];
if
(
CGDisplayCapture
(
aID
)
==
kCGErrorSuccess
)
{
// remove window decoration
NSUInteger
styleMask
=
[
AWTWindow
styleMaskForStyleBits
:
window
.
styleBits
];
[
nsWindow
setStyleMask
:(
styleMask
&
~
NSTitledWindowMask
)
|
NSBorderlessWindowMask
];
int
shieldLevel
=
CGShieldingWindowLevel
();
window
.
preFullScreenLevel
=
[
nsWindow
level
];
[
nsWindow
setLevel
:
shieldLevel
];
NSRect
screenRect
=
[[
nsWindow
screen
]
frame
];
[
nsWindow
setFrame
:
screenRect
display
:
YES
];
}
else
{
[
JNFException
raise
:
env
as
:
kRuntimeException
reason
:
"Failed to enter full screen."
];
}
}];
JNF_COCOA_EXIT
(
env
);
}
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CPlatformWindow_nativeExitFullScreenMode
(
JNIEnv
*
env
,
jclass
clazz
,
jlong
windowPtr
)
{
JNF_COCOA_ENTER
(
env
);
NSWindow
*
nsWindow
=
OBJC
(
windowPtr
);
[
ThreadUtilities
performOnMainThreadWaiting
:
NO
block
:
^
(){
AWTWindow
*
window
=
(
AWTWindow
*
)[
nsWindow
delegate
];
NSNumber
*
screenID
=
[
AWTWindow
getNSWindowDisplayID_AppKitThread
:
nsWindow
];
CGDirectDisplayID
aID
=
[
screenID
intValue
];
if
(
CGDisplayRelease
(
aID
)
==
kCGErrorSuccess
)
{
NSUInteger
styleMask
=
[
AWTWindow
styleMaskForStyleBits
:
window
.
styleBits
];
[
nsWindow
setStyleMask
:
styleMask
];
[
nsWindow
setLevel
:
window
.
preFullScreenLevel
];
// GraphicsDevice takes care of restoring pre full screen bounds
}
else
{
[
JNFException
raise
:
env
as
:
kRuntimeException
reason
:
"Failed to exit full screen."
];
}
}];
JNF_COCOA_EXIT
(
env
);
}
src/macosx/native/sun/awt/CWrapper.m
浏览文件 @
0a9a69b6
...
...
@@ -585,46 +585,6 @@ JNF_COCOA_EXIT(env);
return
jRect
;
}
/
*
*
Class:
sun_lwawt_macosx_CWrapper
$
NSView
*
Method:
enterFullScreenMode
*
Signature:
(
J
)
V
*
/
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSView_enterFullScreenMode
(
JNIEnv
*env
,
jclass
cls
,
jlong
viewPtr
)
{
JNF_COCOA_ENTER
(
env
);
NSView
*view =
(NSView
*
)
jlong_to_ptr
(
viewPtr
);
[
ThreadUtilities
performOnMainThreadWaiting:NO
block:
^(){
NSScreen
*screen =
[[view
window
]
screen
];
NSDictionary
*opts =
[NSDictionary
dictionaryWithObjectsAndKeys:
[
NSNumber
numberWithBool:NO
],
NSFullScreenModeAllScreens
,
nil
];
[
view
enterFullScreenMode:screen
withOptions:opts
];
}];
JNF_COCOA_EXIT
(
env
);
}
/
*
*
Class:
sun_lwawt_macosx_CWrapper
$
NSView
*
Method:
exitFullScreenMode
*
Signature:
(
J
)
V
*
/
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSView_exitFullScreenMode
(
JNIEnv
*env
,
jclass
cls
,
jlong
viewPtr
)
{
JNF_COCOA_ENTER
(
env
);
NSView
*view =
(NSView
*
)
jlong_to_ptr
(
viewPtr
);
[
ThreadUtilities
performOnMainThreadWaiting:NO
block:
^(){
[
view
exitFullScreenModeWithOptions:nil
];
}];
JNF_COCOA_EXIT
(
env
);
}
/
*
*
Class:
sun_lwawt_macosx_CWrapper
$
NSView
*
Method:
window
...
...
test/java/awt/FullScreen/8013581/bug8013581.java
0 → 100644
浏览文件 @
0a9a69b6
/*
* Copyright (c) 2013, 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 8013581
* @summary [macosx] Key Bindings break with awt GraphicsEnvironment setFullScreenWindow
* @author leonid.romanov@oracle.com
* @run main bug8013581
*/
import
sun.awt.*
;
import
java.awt.*
;
import
java.awt.event.*
;
public
class
bug8013581
{
private
static
Frame
frame
;
private
static
volatile
int
listenerCallCounter
=
0
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
final
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
final
GraphicsDevice
[]
devices
=
ge
.
getScreenDevices
();
final
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
final
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
50
);
createAndShowGUI
();
toolkit
.
realSync
();
Exception
error
=
null
;
for
(
final
GraphicsDevice
device
:
devices
)
{
if
(!
device
.
isFullScreenSupported
())
{
continue
;
}
device
.
setFullScreenWindow
(
frame
);
sleep
();
robot
.
keyPress
(
KeyEvent
.
VK_A
);
robot
.
keyRelease
(
KeyEvent
.
VK_A
);
toolkit
.
realSync
();
device
.
setFullScreenWindow
(
null
);
sleep
();
if
(
listenerCallCounter
!=
2
)
{
error
=
new
Exception
(
"Test failed: KeyListener called "
+
listenerCallCounter
+
" times instead of 2!"
);
break
;
}
listenerCallCounter
=
0
;
}
frame
.
dispose
();
if
(
error
!=
null
)
{
throw
error
;
}
}
private
static
void
createAndShowGUI
()
{
frame
=
new
Frame
(
"Test"
);
frame
.
addKeyListener
(
new
KeyAdapter
()
{
@Override
public
void
keyPressed
(
KeyEvent
e
)
{
listenerCallCounter
++;
}
@Override
public
void
keyReleased
(
KeyEvent
e
)
{
listenerCallCounter
++;
}
});
frame
.
setUndecorated
(
true
);
frame
.
setVisible
(
true
);
}
private
static
void
sleep
()
{
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
ignored
)
{
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录