Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
97d1be10
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看板
提交
97d1be10
编写于
2月 24, 2017
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8173876: Fast precise scrolling and DeltaAccumulator fix for macOS Sierra 10.12.2
Reviewed-by: serb, alexsch
上级
ad8c22f1
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
62 addition
and
33 deletion
+62
-33
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
+11
-14
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
+2
-2
src/macosx/native/sun/awt/AWTView.m
src/macosx/native/sun/awt/AWTView.m
+9
-2
src/macosx/native/sun/awt/CTrayIcon.m
src/macosx/native/sun/awt/CTrayIcon.m
+9
-2
src/macosx/native/sun/awt/LWCToolkit.h
src/macosx/native/sun/awt/LWCToolkit.h
+1
-0
src/macosx/native/sun/awt/LWCToolkit.m
src/macosx/native/sun/awt/LWCToolkit.m
+29
-12
test/javax/swing/plaf/basic/BasicScrollPaneUI/8166591/TooMuchWheelRotationEventsTest.java
...cScrollPaneUI/8166591/TooMuchWheelRotationEventsTest.java
+1
-1
未找到文件。
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
浏览文件 @
97d1be10
...
...
@@ -262,9 +262,8 @@ final class CPlatformResponder {
static
class
DeltaAccumulator
{
static
final
double
MIN_THRESHOLD
=
0.1
;
static
final
double
MAX_THRESHOLD
=
0.5
;
double
accumulatedDelta
;
boolean
accumulate
;
int
getRoundedDelta
(
double
delta
,
int
scrollPhase
)
{
...
...
@@ -275,25 +274,23 @@ final class CPlatformResponder {
roundDelta
=
delta
>
0
?
1
:
-
1
;
}
}
else
{
// trackpad
boolean
begin
=
scrollPhase
==
NSEvent
.
SCROLL_PHASE_BEGAN
;
boolean
end
=
scrollPhase
==
NSEvent
.
SCROLL_MASK_PHASE_ENDED
||
scrollPhase
==
NSEvent
.
SCROLL_MASK_PHASE_CANCELLED
;
if
(
begin
)
{
if
(
scrollPhase
==
NSEvent
.
SCROLL_PHASE_BEGAN
)
{
accumulatedDelta
=
0
;
accumulate
=
true
;
}
else
if
(
scrollPhase
==
NSEvent
.
SCROLL_PHASE_MOMENTUM_BEGAN
)
{
accumulate
=
true
;
}
if
(
accumulate
)
{
accumulatedDelta
+=
delta
;
double
absAccumulatedDelta
=
Math
.
abs
(
accumulatedDelta
);
if
(
absAccumulatedDelta
>
MAX_THRESHOLD
)
{
roundDelta
=
(
int
)
Math
.
round
(
accumulatedDelta
);
accumulatedDelta
-=
roundDelta
;
}
if
(
end
)
{
if
(
roundDelta
==
0
&&
absAccumulatedDelta
>
MIN_THRESHOLD
)
{
roundDelta
=
accumulatedDelta
>
0
?
1
:
-
1
;
if
(
scrollPhase
==
NSEvent
.
SCROLL_PHASE_ENDED
)
{
accumulate
=
false
;
}
}
}
...
...
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
浏览文件 @
97d1be10
...
...
@@ -36,8 +36,8 @@ final class NSEvent {
static
final
int
SCROLL_PHASE_UNSUPPORTED
=
1
;
static
final
int
SCROLL_PHASE_BEGAN
=
2
;
static
final
int
SCROLL_PHASE_CONTINUED
=
3
;
static
final
int
SCROLL_
MASK_PHASE_CANCELLED
=
4
;
static
final
int
SCROLL_
MASK_
PHASE_ENDED
=
5
;
static
final
int
SCROLL_
PHASE_MOMENTUM_BEGAN
=
4
;
static
final
int
SCROLL_PHASE_ENDED
=
5
;
private
int
type
;
private
int
modifierFlags
;
...
...
src/macosx/native/sun/awt/AWTView.m
浏览文件 @
97d1be10
...
...
@@ -385,6 +385,13 @@ AWT_ASSERT_APPKIT_THREAD;
clickCount
=
[
event
clickCount
];
}
jdouble
deltaX
=
[
event
deltaX
];
jdouble
deltaY
=
[
event
deltaY
];
if
([
AWTToolkit
hasPreciseScrollingDeltas
:
event
])
{
deltaX
=
[
event
scrollingDeltaX
]
*
0
.
1
;
deltaY
=
[
event
scrollingDeltaY
]
*
0
.
1
;
}
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/NSEvent"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IIIIIIIIDDI)V"
);
jobject
jEvent
=
JNFNewObject
(
env
,
jctor_NSEvent
,
...
...
@@ -394,8 +401,8 @@ AWT_ASSERT_APPKIT_THREAD;
[
event
buttonNumber
],
(
jint
)
localPoint
.
x
,
(
jint
)
localPoint
.
y
,
(
jint
)
absP
.
x
,
(
jint
)
absP
.
y
,
[
event
deltaY
]
,
[
event
deltaX
]
,
deltaY
,
deltaX
,
[
AWTToolkit
scrollStateWithEvent
:
event
]);
if
(
jEvent
==
nil
)
{
// Unable to create event by some reason.
...
...
src/macosx/native/sun/awt/CTrayIcon.m
浏览文件 @
97d1be10
...
...
@@ -135,6 +135,13 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
clickCount
=
[
event
clickCount
];
jdouble
deltaX
=
[
event
deltaX
];
jdouble
deltaY
=
[
event
deltaY
];
if
([
AWTToolkit
hasPreciseScrollingDeltas
:
event
])
{
deltaX
=
[
event
scrollingDeltaX
]
*
0
.
1
;
deltaY
=
[
event
scrollingDeltaY
]
*
0
.
1
;
}
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/NSEvent"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IIIIIIIIDDI)V"
);
jobject
jEvent
=
JNFNewObject
(
env
,
jctor_NSEvent
,
...
...
@@ -144,8 +151,8 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
[
event
buttonNumber
],
(
jint
)
localPoint
.
x
,
(
jint
)
localPoint
.
y
,
(
jint
)
absP
.
x
,
(
jint
)
absP
.
y
,
[
event
deltaY
]
,
[
event
deltaX
]
,
deltaY
,
deltaX
,
[
AWTToolkit
scrollStateWithEvent
:
event
]);
if
(
jEvent
==
nil
)
{
// Unable to create event by some reason.
...
...
src/macosx/native/sun/awt/LWCToolkit.h
浏览文件 @
97d1be10
...
...
@@ -41,6 +41,7 @@ extern jint* gButtonDownMasks;
+
(
long
)
getEventCount
;
+
(
void
)
eventCountPlusPlus
;
+
(
jint
)
scrollStateWithEvent
:
(
NSEvent
*
)
event
;
+
(
BOOL
)
hasPreciseScrollingDeltas
:
(
NSEvent
*
)
event
;
@end
/*
...
...
src/macosx/native/sun/awt/LWCToolkit.m
浏览文件 @
97d1be10
...
...
@@ -43,7 +43,7 @@
#define SCROLL_PHASE_UNSUPPORTED 1
#define SCROLL_PHASE_BEGAN 2
#define SCROLL_PHASE_CONTINUED 3
#define SCROLL_PHASE_
CANCELLED
4
#define SCROLL_PHASE_
MOMENTUM_BEGAN
4
#define SCROLL_PHASE_ENDED 5
int
gNumberOfButtons
;
...
...
@@ -67,16 +67,33 @@ static long eventCount;
return
0
;
}
NSEventPhase
phase
=
[
event
phase
];
NSEventPhase
momentumPhase
=
[
event
momentumPhase
];
if
(
!
phase
&&
!
momentumPhase
)
return
SCROLL_PHASE_UNSUPPORTED
;
switch
(
phase
)
{
if
([
event
phase
])
{
// process a phase of manual scrolling
switch
([
event
phase
])
{
case
NSEventPhaseBegan
:
return
SCROLL_PHASE_BEGAN
;
case
NSEventPhaseCancelled
:
return
SCROLL_PHASE_CANCELLED
;
case
NSEventPhaseCancelled
:
return
SCROLL_PHASE_ENDED
;
case
NSEventPhaseEnded
:
return
SCROLL_PHASE_ENDED
;
default:
return
SCROLL_PHASE_CONTINUED
;
}
}
if
([
event
momentumPhase
])
{
// process a phase of automatic scrolling
switch
([
event
momentumPhase
])
{
case
NSEventPhaseBegan
:
return
SCROLL_PHASE_MOMENTUM_BEGAN
;
case
NSEventPhaseCancelled
:
return
SCROLL_PHASE_ENDED
;
case
NSEventPhaseEnded
:
return
SCROLL_PHASE_ENDED
;
default:
return
SCROLL_PHASE_CONTINUED
;
}
}
return
SCROLL_PHASE_CONTINUED
;
// phase and momentum phase both are not set
return
SCROLL_PHASE_UNSUPPORTED
;
}
+
(
BOOL
)
hasPreciseScrollingDeltas
:
(
NSEvent
*
)
event
{
return
[
event
type
]
==
NSScrollWheel
&&
[
event
respondsToSelector
:
@selector
(
hasPreciseScrollingDeltas
)]
&&
[
event
hasPreciseScrollingDeltas
];
}
@end
...
...
test/javax/swing/plaf/basic/BasicScrollPaneUI/8166591/TooMuchWheelRotationEventsTest.java
浏览文件 @
97d1be10
...
...
@@ -40,7 +40,7 @@ import javax.swing.SwingUtilities;
/*
* @test
* @bug 8166591
* @bug 8166591
8173876
* @summary [macos 10.12] Trackpad scrolling of text on OS X 10.12 Sierra
* is very fast (Trackpad, Retina only)
* @run main/manual/othervm TooMuchWheelRotationEventsTest
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录