Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
e5f16da9
E
engine
项目概览
qq_34031325
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
e5f16da9
编写于
2月 23, 2017
作者:
J
Jêrôme Poichet
提交者:
GitHub
2月 23, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New mozart input events. (#3439)
* New mozart input events. * Adding TODO for keyrepeat
上级
df9e9560
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
25 deletion
+31
-25
content_handler/runtime_holder.cc
content_handler/runtime_holder.cc
+30
-24
content_handler/runtime_holder.h
content_handler/runtime_holder.h
+1
-1
未找到文件。
content_handler/runtime_holder.cc
浏览文件 @
e5f16da9
...
...
@@ -41,26 +41,28 @@ constexpr int kMaxPipelineDepth = 3;
// to recover before acknowleding the invalidation and scheduling more frames.
constexpr
int
kRecoveryPipelineDepth
=
1
;
blink
::
PointerData
::
Change
GetChangeFromEventType
(
mozart
::
EventType
type
)
{
switch
(
type
)
{
case
mozart
::
EventType
::
POINTER_CANCEL
:
blink
::
PointerData
::
Change
GetChangeFromPointerEventPhase
(
mozart
::
PointerEvent
::
Phase
phase
)
{
switch
(
phase
)
{
case
mozart
::
PointerEvent
::
Phase
::
CANCEL
:
return
blink
::
PointerData
::
Change
::
kCancel
;
case
mozart
::
EventType
::
POINTER_
DOWN
:
case
mozart
::
PointerEvent
::
Phase
::
DOWN
:
return
blink
::
PointerData
::
Change
::
kDown
;
case
mozart
::
EventType
::
POINTER_
MOVE
:
case
mozart
::
PointerEvent
::
Phase
::
MOVE
:
return
blink
::
PointerData
::
Change
::
kMove
;
case
mozart
::
EventType
::
POINTER_
UP
:
case
mozart
::
PointerEvent
::
Phase
::
UP
:
return
blink
::
PointerData
::
Change
::
kUp
;
default:
return
blink
::
PointerData
::
Change
::
kCancel
;
}
}
blink
::
PointerData
::
DeviceKind
GetKindFromEventKind
(
mozart
::
PointerKind
kind
)
{
switch
(
kind
)
{
case
mozart
::
PointerKind
::
TOUCH
:
blink
::
PointerData
::
DeviceKind
GetKindFromPointerType
(
mozart
::
PointerEvent
::
Type
type
)
{
switch
(
type
)
{
case
mozart
::
PointerEvent
::
Type
::
TOUCH
:
return
blink
::
PointerData
::
DeviceKind
::
kTouch
;
case
mozart
::
Pointer
Kind
::
MOUSE
:
case
mozart
::
Pointer
Event
::
Type
::
MOUSE
:
return
blink
::
PointerData
::
DeviceKind
::
kMouse
;
default:
return
blink
::
PointerData
::
DeviceKind
::
kTouch
;
...
...
@@ -268,17 +270,18 @@ blink::UnzipperProvider RuntimeHolder::GetUnzipperProviderForRootBundle() {
};
}
void
RuntimeHolder
::
OnEvent
(
mozart
::
EventPtr
event
,
void
RuntimeHolder
::
OnEvent
(
mozart
::
Input
EventPtr
event
,
const
OnEventCallback
&
callback
)
{
bool
handled
=
false
;
if
(
event
->
pointer_data
)
{
if
(
event
->
is_pointer
())
{
const
mozart
::
PointerEventPtr
&
pointer
=
event
->
get_pointer
();
blink
::
PointerData
pointer_data
;
pointer_data
.
time_stamp
=
event
->
time_stamp
;
pointer_data
.
change
=
GetChangeFrom
EventType
(
event
->
action
);
pointer_data
.
kind
=
GetKindFrom
EventKind
(
event
->
pointer_data
->
kind
);
pointer_data
.
device
=
event
->
pointer_data
->
pointer_id
;
pointer_data
.
physical_x
=
event
->
pointer_data
->
x
;
pointer_data
.
physical_y
=
event
->
pointer_data
->
y
;
pointer_data
.
time_stamp
=
pointer
->
event_time
;
pointer_data
.
change
=
GetChangeFrom
PointerEventPhase
(
pointer
->
phase
);
pointer_data
.
kind
=
GetKindFrom
PointerType
(
pointer
->
type
);
pointer_data
.
device
=
pointer
->
pointer_id
;
pointer_data
.
physical_x
=
pointer
->
x
;
pointer_data
.
physical_y
=
pointer
->
y
;
switch
(
pointer_data
.
change
)
{
case
blink
::
PointerData
::
Change
::
kDown
:
...
...
@@ -304,11 +307,14 @@ void RuntimeHolder::OnEvent(mozart::EventPtr event,
runtime_
->
DispatchPointerDataPacket
(
packet
);
handled
=
true
;
}
else
if
(
event
->
key_data
)
{
}
else
if
(
event
->
is_keyboard
())
{
const
mozart
::
KeyboardEventPtr
&
keyboard
=
event
->
get_keyboard
();
const
char
*
type
=
nullptr
;
if
(
event
->
action
==
mozart
::
EventType
::
KEY_
PRESSED
)
if
(
keyboard
->
phase
==
mozart
::
KeyboardEvent
::
Phase
::
PRESSED
)
type
=
"keydown"
;
else
if
(
event
->
action
==
mozart
::
EventType
::
KEY_RELEASED
)
else
if
(
keyboard
->
phase
==
mozart
::
KeyboardEvent
::
Phase
::
REPEAT
)
type
=
"keydown"
;
// TODO change this to keyrepeat
else
if
(
keyboard
->
phase
==
mozart
::
KeyboardEvent
::
Phase
::
RELEASED
)
type
=
"keyup"
;
if
(
type
)
{
...
...
@@ -318,9 +324,9 @@ void RuntimeHolder::OnEvent(mozart::EventPtr event,
document
.
AddMember
(
"type"
,
rapidjson
::
Value
(
type
,
strlen
(
type
)),
allocator
);
document
.
AddMember
(
"keymap"
,
rapidjson
::
Value
(
"fuchsia"
),
allocator
);
document
.
AddMember
(
"hidUsage"
,
event
->
key_data
->
hid_usage
,
allocator
);
document
.
AddMember
(
"codePoint"
,
event
->
key_data
->
code_point
,
allocator
);
document
.
AddMember
(
"modifiers"
,
event
->
key_data
->
modifiers
,
allocator
);
document
.
AddMember
(
"hidUsage"
,
keyboard
->
hid_usage
,
allocator
);
document
.
AddMember
(
"codePoint"
,
keyboard
->
code_point
,
allocator
);
document
.
AddMember
(
"modifiers"
,
keyboard
->
modifiers
,
allocator
);
rapidjson
::
StringBuffer
buffer
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
buffer
);
document
.
Accept
(
writer
);
...
...
content_handler/runtime_holder.h
浏览文件 @
e5f16da9
...
...
@@ -55,7 +55,7 @@ class RuntimeHolder : public blink::RuntimeDelegate,
void
DidCreateMainIsolate
(
Dart_Isolate
isolate
)
override
;
// |mozart::InputListener| implementation:
void
OnEvent
(
mozart
::
EventPtr
event
,
void
OnEvent
(
mozart
::
Input
EventPtr
event
,
const
OnEventCallback
&
callback
)
override
;
// |mozart::ViewListener| implementation:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录