Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
b08167ba
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b08167ba
编写于
8月 07, 2017
作者:
C
Chinmay Garde
提交者:
GitHub
8月 07, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement all known blink::PointerData fields on iOS. (#3955)
上级
cc7e71ea
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
127 addition
and
11 deletion
+127
-11
DEPS
DEPS
+1
-1
fml/BUILD.gn
fml/BUILD.gn
+2
-0
fml/platform/darwin/platform_version.h
fml/platform/darwin/platform_version.h
+17
-0
fml/platform/darwin/platform_version.mm
fml/platform/darwin/platform_version.mm
+19
-0
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
...form/darwin/ios/framework/Source/FlutterViewController.mm
+86
-10
travis/licenses_golden/licenses_flutter
travis/licenses_golden/licenses_flutter
+2
-0
未找到文件。
DEPS
浏览文件 @
b08167ba
...
@@ -75,7 +75,7 @@ allowed_hosts = [
...
@@ -75,7 +75,7 @@ allowed_hosts = [
]
]
deps = {
deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + '
4cf93efdd098f6c3bc26b9f38f2306fa0560ead6
',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '
b0caefa339171dfa48b72b1064652d7c11cfe857
',
# Fuchsia compatibility
# Fuchsia compatibility
#
#
...
...
fml/BUILD.gn
浏览文件 @
b08167ba
...
@@ -42,6 +42,8 @@ source_set("fml") {
...
@@ -42,6 +42,8 @@ source_set("fml") {
"platform/darwin/message_loop_darwin.h",
"platform/darwin/message_loop_darwin.h",
"platform/darwin/message_loop_darwin.mm",
"platform/darwin/message_loop_darwin.mm",
"platform/darwin/paths_darwin.mm",
"platform/darwin/paths_darwin.mm",
"platform/darwin/platform_version.h",
"platform/darwin/platform_version.mm",
"platform/darwin/resource_mapping_darwin.h",
"platform/darwin/resource_mapping_darwin.h",
"platform/darwin/resource_mapping_darwin.mm",
"platform/darwin/resource_mapping_darwin.mm",
"platform/darwin/scoped_block.h",
"platform/darwin/scoped_block.h",
...
...
fml/platform/darwin/platform_version.h
0 → 100644
浏览文件 @
b08167ba
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_FML_PLATFORM_DARWIN_PLATFORM_VERSION_H_
#define FLUTTER_FML_PLATFORM_DARWIN_PLATFORM_VERSION_H_
#include <sys/types.h>
#include "lib/ftl/macros.h"
namespace
fml
{
bool
IsPlatformVersionAtLeast
(
size_t
major
,
size_t
minor
=
0
,
size_t
patch
=
0
);
}
// namespace fml
#endif // FLUTTER_FML_PLATFORM_DARWIN_PLATFORM_VERSION_H_
fml/platform/darwin/platform_version.mm
0 → 100644
浏览文件 @
b08167ba
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/fml/platform/darwin/platform_version.h"
#include <Foundation/NSProcessInfo.h>
namespace
fml
{
bool
IsPlatformVersionAtLeast
(
size_t
major
,
size_t
minor
,
size_t
patch
)
{
const
NSOperatingSystemVersion
version
=
{
.
majorVersion
=
static_cast
<
NSInteger
>
(
major
),
.
minorVersion
=
static_cast
<
NSInteger
>
(
minor
),
.
patchVersion
=
static_cast
<
NSInteger
>
(
patch
),
};
return
[[
NSProcessInfo
processInfo
]
isOperatingSystemAtLeastVersion
:
version
];
}
}
// namespace fml
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
浏览文件 @
b08167ba
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <memory>
#include <memory>
#include "flutter/common/threads.h"
#include "flutter/common/threads.h"
#include "flutter/fml/platform/darwin/platform_version.h"
#include "flutter/fml/platform/darwin/scoped_block.h"
#include "flutter/fml/platform/darwin/scoped_block.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/platform/darwin/common/buffer_conversions.h"
#include "flutter/shell/platform/darwin/common/buffer_conversions.h"
...
@@ -71,6 +72,9 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
...
@@ -71,6 +72,9 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
fml
::
scoped_nsprotocol
<
FlutterMethodChannel
*>
_textInputChannel
;
fml
::
scoped_nsprotocol
<
FlutterMethodChannel
*>
_textInputChannel
;
fml
::
scoped_nsprotocol
<
FlutterBasicMessageChannel
*>
_lifecycleChannel
;
fml
::
scoped_nsprotocol
<
FlutterBasicMessageChannel
*>
_lifecycleChannel
;
fml
::
scoped_nsprotocol
<
FlutterBasicMessageChannel
*>
_systemChannel
;
fml
::
scoped_nsprotocol
<
FlutterBasicMessageChannel
*>
_systemChannel
;
bool
_platformSupportsTouchTypes
;
bool
_platformSupportsTouchPressure
;
bool
_platformSupportsTouchOrientationAndTilt
;
BOOL
_initialized
;
BOOL
_initialized
;
BOOL
_connected
;
BOOL
_connected
;
}
}
...
@@ -116,6 +120,10 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
...
@@ -116,6 +120,10 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
_initialized
=
YES
;
_initialized
=
YES
;
_platformSupportsTouchTypes
=
fml
::
IsPlatformVersionAtLeast
(
9
);
_platformSupportsTouchPressure
=
fml
::
IsPlatformVersionAtLeast
(
9
);
_platformSupportsTouchOrientationAndTilt
=
fml
::
IsPlatformVersionAtLeast
(
9
,
1
);
_orientationPreferences
=
UIInterfaceOrientationMaskAll
;
_orientationPreferences
=
UIInterfaceOrientationMaskAll
;
_statusBarStyle
=
UIStatusBarStyleDefault
;
_statusBarStyle
=
UIStatusBarStyleDefault
;
_platformView
=
_platformView
=
...
@@ -165,7 +173,6 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
...
@@ -165,7 +173,6 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
}];
}];
[
self
setupNotificationCenterObservers
];
[
self
setupNotificationCenterObservers
];
}
}
-
(
void
)
setupNotificationCenterObservers
{
-
(
void
)
setupNotificationCenterObservers
{
...
@@ -226,10 +233,8 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
...
@@ -226,10 +233,8 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
object:
nil
];
object:
nil
];
}
}
-
(
void
)
setInitialRoute
:(
NSString
*
)
route
{
-
(
void
)
setInitialRoute
:(
NSString
*
)
route
{
[
_navigationChannel
.
get
()
invokeMethod
:
@"setInitialRoute"
[
_navigationChannel
.
get
()
invokeMethod
:
@"setInitialRoute"
arguments
:
route
];
arguments:
route
];
}
}
#pragma mark - Initializing the engine
#pragma mark - Initializing the engine
...
@@ -378,6 +383,23 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
...
@@ -378,6 +383,23 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
return
PointerChangeMapperPhase
(
blink
::
PointerData
::
Change
::
kCancel
,
MapperPhase
::
Accessed
);
return
PointerChangeMapperPhase
(
blink
::
PointerData
::
Change
::
kCancel
,
MapperPhase
::
Accessed
);
}
}
static
inline
blink
::
PointerData
::
DeviceKind
DeviceKindFromTouchType
(
UITouch
*
touch
,
bool
touchTypeSupported
)
{
if
(
!
touchTypeSupported
)
{
return
blink
::
PointerData
::
DeviceKind
::
kTouch
;
}
switch
(
touch
.
type
)
{
case
UITouchTypeDirect
:
case
UITouchTypeIndirect
:
return
blink
::
PointerData
::
DeviceKind
::
kTouch
;
case
UITouchTypeStylus
:
return
blink
::
PointerData
::
DeviceKind
::
kStylus
;
}
return
blink
::
PointerData
::
DeviceKind
::
kTouch
;
}
-
(
void
)
dispatchTouches
:(
NSSet
*
)
touches
phase
:(
UITouchPhase
)
phase
{
-
(
void
)
dispatchTouches
:(
NSSet
*
)
touches
phase
:(
UITouchPhase
)
phase
{
// Note: we cannot rely on touch.phase, since in some cases, e.g.,
// Note: we cannot rely on touch.phase, since in some cases, e.g.,
// handleStatusBarTouches, we synthesize touches from existing events.
// handleStatusBarTouches, we synthesize touches from existing events.
...
@@ -412,13 +434,68 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
...
@@ -412,13 +434,68 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
constexpr
int
kMicrosecondsPerSecond
=
1000
*
1000
;
constexpr
int
kMicrosecondsPerSecond
=
1000
*
1000
;
pointer_data
.
time_stamp
=
touch
.
timestamp
*
kMicrosecondsPerSecond
;
pointer_data
.
time_stamp
=
touch
.
timestamp
*
kMicrosecondsPerSecond
;
pointer_data
.
change
=
eventTypePhase
.
first
;
pointer_data
.
change
=
eventTypePhase
.
first
;
pointer_data
.
kind
=
blink
::
PointerData
::
DeviceKind
::
kTouch
;
pointer_data
.
kind
=
DeviceKindFromTouchType
(
touch
,
_platformSupportsTouchTypes
);
pointer_data
.
device
=
device_id
;
pointer_data
.
device
=
device_id
;
pointer_data
.
physical_x
=
windowCoordinates
.
x
*
scale
;
pointer_data
.
physical_x
=
windowCoordinates
.
x
*
scale
;
pointer_data
.
physical_y
=
windowCoordinates
.
y
*
scale
;
pointer_data
.
physical_y
=
windowCoordinates
.
y
*
scale
;
pointer_data
.
pressure
=
1.0
;
pointer_data
.
pressure_max
=
1.0
;
// pressure_min is always 0.0
if
(
_platformSupportsTouchPressure
)
{
// These properties were introduced in iOS 9.0.
pointer_data
.
pressure
=
touch
.
force
;
pointer_data
.
pressure_max
=
touch
.
maximumPossibleForce
;
}
else
{
pointer_data
.
pressure
=
1.0
;
pointer_data
.
pressure_max
=
1.0
;
}
// These properties were introduced in iOS 8.0
pointer_data
.
radius_major
=
touch
.
majorRadius
;
pointer_data
.
radius_min
=
touch
.
majorRadius
-
touch
.
majorRadiusTolerance
;
pointer_data
.
radius_max
=
touch
.
majorRadius
+
touch
.
majorRadiusTolerance
;
// These properties were introduced in iOS 9.1
if
(
_platformSupportsTouchOrientationAndTilt
)
{
// iOS Documentation: altitudeAngle
// A value of 0 radians indicates that the stylus is parallel to the surface. The value of
// this property is Pi/2 when the stylus is perpendicular to the surface.
//
// PointerData Documentation: tilt
// The angle of the stylus, in radians in the range:
// 0 <= tilt <= pi/2
// giving the angle of the axis of the stylus, relative to the axis perpendicular to the input
// surface (thus 0.0 indicates the stylus is orthogonal to the plane of the input surface,
// while pi/2 indicates that the stylus is flat on that surface).
//
// Discussion:
// The ranges are the same. Origins are swapped.
pointer_data
.
tilt
=
M_PI_2
-
touch
.
altitudeAngle
;
// iOS Documentation: azimuthAngleInView:
// With the tip of the stylus touching the screen, the value of this property is 0 radians
// when the cap end of the stylus (that is, the end opposite of the tip) points along the
// positive x axis of the device's screen. The azimuth angle increases as the user swings the
// cap end of the stylus in a clockwise direction around the tip.
//
// PointerData Documentation: orientation
// The angle of the stylus, in radians in the range:
// -pi < orientation <= pi
// giving the angle of the axis of the stylus projected onto the input surface, relative to
// the positive y-axis of that surface (thus 0.0 indicates the stylus, if projected onto that
// surface, would go from the contact point vertically up in the positive y-axis direction, pi
// would indicate that the stylus would go down in the negative y-axis direction; pi/4 would
// indicate that the stylus goes up and to the right, -pi/2 would indicate that the stylus
// goes to the left, etc).
//
// Discussion:
// Sweep direction is the same. Phase of M_PI_2.
pointer_data
.
orientation
=
[
touch
azimuthAngleInView
:
nil
]
-
M_PI_2
;
}
packet
->
SetPointerData
(
i
++
,
pointer_data
);
packet
->
SetPointerData
(
i
++
,
pointer_data
);
}
}
...
@@ -490,8 +567,7 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
...
@@ -490,8 +567,7 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
-
(
void
)
keyboardWillChangeFrame
:(
NSNotification
*
)
notification
{
-
(
void
)
keyboardWillChangeFrame
:(
NSNotification
*
)
notification
{
NSDictionary
*
info
=
[
notification
userInfo
];
NSDictionary
*
info
=
[
notification
userInfo
];
CGFloat
bottom
=
CGFloat
bottom
=
CGRectGetHeight
([[
info
objectForKey
:
UIKeyboardFrameEndUserInfoKey
]
CGRectValue
]);
CGRectGetHeight
([[
info
objectForKey
:
UIKeyboardFrameEndUserInfoKey
]
CGRectValue
]);
CGFloat
scale
=
[
UIScreen
mainScreen
].
scale
;
CGFloat
scale
=
[
UIScreen
mainScreen
].
scale
;
_viewportMetrics
.
physical_padding_bottom
=
bottom
*
scale
;
_viewportMetrics
.
physical_padding_bottom
=
bottom
*
scale
;
[
self
updateViewportMetrics
];
[
self
updateViewportMetrics
];
...
@@ -567,7 +643,7 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
...
@@ -567,7 +643,7 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
#pragma mark - Memory Notifications
#pragma mark - Memory Notifications
-
(
void
)
onMemoryWarning
:(
NSNotification
*
)
notification
{
-
(
void
)
onMemoryWarning
:(
NSNotification
*
)
notification
{
[
_systemChannel
.
get
()
sendMessage
:@{
@"type"
:
@"memoryPressure"
}];
[
_systemChannel
.
get
()
sendMessage
:@{
@"type"
:
@"memoryPressure"
}];
}
}
#pragma mark - Locale updates
#pragma mark - Locale updates
...
...
travis/licenses_golden/licenses_flutter
浏览文件 @
b08167ba
...
@@ -1401,6 +1401,8 @@ FILE: ../../../flutter/fml/platform/darwin/cf_utils.h
...
@@ -1401,6 +1401,8 @@ FILE: ../../../flutter/fml/platform/darwin/cf_utils.h
FILE: ../../../flutter/fml/platform/darwin/message_loop_darwin.h
FILE: ../../../flutter/fml/platform/darwin/message_loop_darwin.h
FILE: ../../../flutter/fml/platform/darwin/message_loop_darwin.mm
FILE: ../../../flutter/fml/platform/darwin/message_loop_darwin.mm
FILE: ../../../flutter/fml/platform/darwin/paths_darwin.mm
FILE: ../../../flutter/fml/platform/darwin/paths_darwin.mm
FILE: ../../../flutter/fml/platform/darwin/platform_version.h
FILE: ../../../flutter/fml/platform/darwin/platform_version.mm
FILE: ../../../flutter/fml/platform/darwin/resource_mapping_darwin.h
FILE: ../../../flutter/fml/platform/darwin/resource_mapping_darwin.h
FILE: ../../../flutter/fml/platform/darwin/resource_mapping_darwin.mm
FILE: ../../../flutter/fml/platform/darwin/resource_mapping_darwin.mm
FILE: ../../../flutter/fml/platform/darwin/scoped_block.mm
FILE: ../../../flutter/fml/platform/darwin/scoped_block.mm
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录