Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
4c6a7dc1
A
anbox
项目概览
openeuler
/
anbox
通知
24
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
anbox
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4c6a7dc1
编写于
8月 10, 2018
作者:
S
Simon Fels
提交者:
GitHub
8月 10, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #857 from morphis/disable-touch-input
sdl: disable touch input support by default
上级
37818f27
348ff8a3
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
21 addition
and
3 deletion
+21
-3
CMakeLists.txt
CMakeLists.txt
+5
-0
src/anbox/platform/sdl/platform.cpp
src/anbox/platform/sdl/platform.cpp
+16
-3
未找到文件。
CMakeLists.txt
浏览文件 @
4c6a7dc1
...
@@ -136,3 +136,8 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
...
@@ -136,3 +136,8 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
add_custom_target
(
uninstall
"
${
CMAKE_COMMAND
}
"
add_custom_target
(
uninstall
"
${
CMAKE_COMMAND
}
"
-P
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake"
)
-P
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake"
)
option
(
TOUCH_INPUT
"Enable touch input support"
OFF
)
if
(
TOUCH_INPUT
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DENABLE_TOUCH_INPUT"
)
endif
()
src/anbox/platform/sdl/platform.cpp
浏览文件 @
4c6a7dc1
...
@@ -101,6 +101,7 @@ Platform::Platform(
...
@@ -101,6 +101,7 @@ Platform::Platform(
keyboard_
->
set_key_bit
(
BTN_MISC
);
keyboard_
->
set_key_bit
(
BTN_MISC
);
keyboard_
->
set_key_bit
(
KEY_OK
);
keyboard_
->
set_key_bit
(
KEY_OK
);
#ifdef ENABLE_TOUCH_INPUT
touch_
=
input_manager
->
create_device
();
touch_
=
input_manager
->
create_device
();
touch_
->
set_name
(
"anbox-touch"
);
touch_
->
set_name
(
"anbox-touch"
);
touch_
->
set_driver_version
(
1
);
touch_
->
set_driver_version
(
1
);
...
@@ -122,6 +123,7 @@ Platform::Platform(
...
@@ -122,6 +123,7 @@ Platform::Platform(
touch_
->
set_abs_bit
(
ABS_MT_TRACKING_ID
);
touch_
->
set_abs_bit
(
ABS_MT_TRACKING_ID
);
touch_
->
set_abs_max
(
ABS_MT_TRACKING_ID
,
10
);
touch_
->
set_abs_max
(
ABS_MT_TRACKING_ID
,
10
);
touch_
->
set_prop_bit
(
INPUT_PROP_DIRECT
);
touch_
->
set_prop_bit
(
INPUT_PROP_DIRECT
);
#endif
event_thread_
=
std
::
thread
(
&
Platform
::
process_events
,
this
);
event_thread_
=
std
::
thread
(
&
Platform
::
process_events
,
this
);
}
}
...
@@ -189,8 +191,10 @@ void Platform::process_input_event(const SDL_Event &event) {
...
@@ -189,8 +191,10 @@ void Platform::process_input_event(const SDL_Event &event) {
std
::
int32_t
x
=
0
;
std
::
int32_t
x
=
0
;
std
::
int32_t
y
=
0
;
std
::
int32_t
y
=
0
;
#ifdef ENABLE_TOUCH_INPUT
std
::
int32_t
rel_x
=
0
;
std
::
int32_t
rel_x
=
0
;
std
::
int32_t
rel_y
=
0
;
std
::
int32_t
rel_y
=
0
;
#endif
SDL_Window
*
window
=
nullptr
;
SDL_Window
*
window
=
nullptr
;
...
@@ -251,6 +255,7 @@ void Platform::process_input_event(const SDL_Event &event) {
...
@@ -251,6 +255,7 @@ void Platform::process_input_event(const SDL_Event &event) {
keyboard_events
.
push_back
({
EV_KEY
,
code
,
0
});
keyboard_events
.
push_back
({
EV_KEY
,
code
,
0
});
break
;
break
;
}
}
#ifdef ENABLE_TOUCH_INPUT
// Touch screen
// Touch screen
case
SDL_FINGERDOWN
:
{
case
SDL_FINGERDOWN
:
{
touch_events
.
push_back
({
EV_ABS
,
ABS_MT_TRACKING_ID
,
static_cast
<
std
::
int32_t
>
(
event
.
tfinger
.
fingerId
)});
touch_events
.
push_back
({
EV_ABS
,
ABS_MT_TRACKING_ID
,
static_cast
<
std
::
int32_t
>
(
event
.
tfinger
.
fingerId
)});
...
@@ -343,13 +348,21 @@ void Platform::process_input_event(const SDL_Event &event) {
...
@@ -343,13 +348,21 @@ void Platform::process_input_event(const SDL_Event &event) {
touch_events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
touch_events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
break
;
break
;
}
}
#endif
default:
default:
break
;
break
;
}
}
if
(
mouse_events
.
size
()
>
0
)
pointer_
->
send_events
(
mouse_events
);
if
(
mouse_events
.
size
()
>
0
)
if
(
keyboard_events
.
size
()
>
0
)
keyboard_
->
send_events
(
keyboard_events
);
pointer_
->
send_events
(
mouse_events
);
if
(
touch_events
.
size
()
>
0
)
touch_
->
send_events
(
touch_events
);
if
(
keyboard_events
.
size
()
>
0
)
keyboard_
->
send_events
(
keyboard_events
);
#ifdef ENABLE_TOUCH_INPUT
if
(
touch_events
.
size
()
>
0
)
touch_
->
send_events
(
touch_events
);
#endif
}
}
Window
::
Id
Platform
::
next_window_id
()
{
Window
::
Id
Platform
::
next_window_id
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录