Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
5c861119
E
engine
项目概览
weixin_43355755
/
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,发现更多精彩内容 >>
未验证
提交
5c861119
编写于
9月 12, 2019
作者:
F
Francisco Magdaleno
提交者:
GitHub
9月 12, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[glfw/windows] Stops keeping track of input models (#12234)
上级
9c846592
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
40 deletion
+8
-40
shell/platform/glfw/text_input_plugin.cc
shell/platform/glfw/text_input_plugin.cc
+3
-16
shell/platform/glfw/text_input_plugin.h
shell/platform/glfw/text_input_plugin.h
+1
-4
shell/platform/windows/text_input_plugin.cc
shell/platform/windows/text_input_plugin.cc
+3
-16
shell/platform/windows/text_input_plugin.h
shell/platform/windows/text_input_plugin.h
+1
-4
未找到文件。
shell/platform/glfw/text_input_plugin.cc
浏览文件 @
5c861119
...
...
@@ -32,8 +32,6 @@ static constexpr char kBadArgumentError[] = "Bad Arguments";
static
constexpr
char
kInternalConsistencyError
[]
=
"Internal Consistency Error"
;
static
constexpr
uint32_t
kInputModelLimit
=
256
;
namespace
flutter
{
void
TextInputPlugin
::
CharHook
(
GLFWwindow
*
window
,
unsigned
int
code_point
)
{
...
...
@@ -83,7 +81,7 @@ void TextInputPlugin::KeyboardHook(GLFWwindow* window,
}
break
;
case
GLFW_KEY_ENTER
:
EnterPressed
(
active_model_
);
EnterPressed
(
active_model_
.
get
()
);
break
;
default:
break
;
...
...
@@ -138,19 +136,8 @@ void TextInputPlugin::HandleMethodCall(
"Could not set client, missing arguments."
);
}
int
client_id
=
client_id_json
.
GetInt
();
if
(
input_models_
.
find
(
client_id
)
==
input_models_
.
end
())
{
// Skips out on adding a new input model once over the limit.
if
(
input_models_
.
size
()
>
kInputModelLimit
)
{
result
->
Error
(
kInternalConsistencyError
,
"Input models over limit. Aborting creation of new text model."
);
return
;
}
input_models_
.
insert
(
std
::
make_pair
(
client_id
,
std
::
make_unique
<
TextInputModel
>
(
client_id
,
client_config
)));
}
active_model_
=
input_models_
[
client_id
].
get
();
active_model_
=
std
::
make_unique
<
TextInputModel
>
(
client_id
,
client_config
);
}
else
if
(
method
.
compare
(
kSetEditingStateMethod
)
==
0
)
{
if
(
active_model_
==
nullptr
)
{
result
->
Error
(
...
...
shell/platform/glfw/text_input_plugin.h
浏览文件 @
5c861119
...
...
@@ -50,11 +50,8 @@ class TextInputPlugin : public KeyboardHookHandler {
// The MethodChannel used for communication with the Flutter engine.
std
::
unique_ptr
<
flutter
::
MethodChannel
<
rapidjson
::
Document
>>
channel_
;
// Mapping of client IDs to text input models.
std
::
map
<
int
,
std
::
unique_ptr
<
TextInputModel
>>
input_models_
;
// The active model. nullptr if not set.
TextInputModel
*
active_model_
;
std
::
unique_ptr
<
TextInputModel
>
active_model_
;
};
}
// namespace flutter
...
...
shell/platform/windows/text_input_plugin.cc
浏览文件 @
5c861119
...
...
@@ -34,8 +34,6 @@ static constexpr char kBadArgumentError[] = "Bad Arguments";
static
constexpr
char
kInternalConsistencyError
[]
=
"Internal Consistency Error"
;
static
constexpr
uint32_t
kInputModelLimit
=
256
;
namespace
flutter
{
void
TextInputPlugin
::
CharHook
(
Win32FlutterWindow
*
window
,
...
...
@@ -86,7 +84,7 @@ void TextInputPlugin::KeyboardHook(Win32FlutterWindow* window,
}
break
;
case
VK_RETURN
:
EnterPressed
(
active_model_
);
EnterPressed
(
active_model_
.
get
()
);
break
;
default:
break
;
...
...
@@ -140,19 +138,8 @@ void TextInputPlugin::HandleMethodCall(
return
;
}
int
client_id
=
client_id_json
.
GetInt
();
if
(
input_models_
.
find
(
client_id
)
==
input_models_
.
end
())
{
// Skips out on adding a new input model once over the limit.
if
(
input_models_
.
size
()
>
kInputModelLimit
)
{
result
->
Error
(
kInternalConsistencyError
,
"Input models over limit. Aborting creation of new text model."
);
return
;
}
input_models_
.
insert
(
std
::
make_pair
(
client_id
,
std
::
make_unique
<
TextInputModel
>
(
client_id
,
client_config
)));
}
active_model_
=
input_models_
[
client_id
].
get
();
active_model_
=
std
::
make_unique
<
TextInputModel
>
(
client_id
,
client_config
);
}
else
if
(
method
.
compare
(
kSetEditingStateMethod
)
==
0
)
{
if
(
active_model_
==
nullptr
)
{
result
->
Error
(
...
...
shell/platform/windows/text_input_plugin.h
浏览文件 @
5c861119
...
...
@@ -52,11 +52,8 @@ class TextInputPlugin : public KeyboardHookHandler {
// The MethodChannel used for communication with the Flutter engine.
std
::
unique_ptr
<
flutter
::
MethodChannel
<
rapidjson
::
Document
>>
channel_
;
// Mapping of client IDs to text input models.
std
::
map
<
int
,
std
::
unique_ptr
<
TextInputModel
>>
input_models_
;
// The active model. nullptr if not set.
TextInputModel
*
active_model_
;
std
::
unique_ptr
<
TextInputModel
>
active_model_
;
};
}
// namespace flutter
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录