Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
9ea3e8e6
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,体验更适合开发者的 AI 搜索 >>
提交
9ea3e8e6
编写于
7月 27, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
7月 27, 2020
浏览文件
操作
浏览文件
下载
差异文件
!55 window: solve problem in commit-
475ca1c8
u
Merge pull request !55 from Night/master
上级
9e5312c1
bcb826ff
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
13 deletion
+23
-13
src/anbox/platform/base_platform.h
src/anbox/platform/base_platform.h
+2
-2
src/anbox/platform/sdl/platform.cpp
src/anbox/platform/sdl/platform.cpp
+19
-10
src/anbox/platform/sdl/platform.h
src/anbox/platform/sdl/platform.h
+1
-0
tests/anbox/wm/multi_window_manager_tests.cpp
tests/anbox/wm/multi_window_manager_tests.cpp
+1
-1
未找到文件。
src/anbox/platform/base_platform.h
浏览文件 @
9ea3e8e6
...
...
@@ -44,11 +44,11 @@ enum User_Event {
};
struct
manager_window_param
{
int
window
Id
=
0
;
int
task
Id
=
0
;
graphics
::
Rect
rect
;
std
::
string
title
;
manager_window_param
(
int
id
,
graphics
::
Rect
r
,
std
::
string
t
)
:
window
Id
(
id
),
task
Id
(
id
),
rect
(
r
),
title
(
t
)
{}
...
...
src/anbox/platform/sdl/platform.cpp
浏览文件 @
9ea3e8e6
...
...
@@ -265,19 +265,24 @@ void Platform::user_event_function(const SDL_Event &event) {
manager_window_param
*
param
=
(
manager_window_param
*
)
event
.
user
.
data1
;
if
(
param
)
{
if
(
event_type
==
USER_CREATE_WINDOW
)
{
if
(
windows_
.
find
(
param
->
windowId
)
!=
window
s_
.
end
())
{
if
(
tasks_
.
find
(
param
->
taskId
)
!=
task
s_
.
end
())
{
return
;
}
auto
w
=
create_window
(
param
->
window
Id
,
param
->
rect
,
param
->
title
);
auto
w
=
create_window
(
param
->
task
Id
,
param
->
rect
,
param
->
title
);
if
(
w
)
{
w
->
attach
();
window_manager_
->
insert_task
(
param
->
window
Id
,
w
);
window_manager_
->
insert_task
(
param
->
task
Id
,
w
);
}
else
{
WARNING
(
"create window failed! remove task on android!"
);
window_manager_
->
remove_task
(
param
->
window
Id
);
window_manager_
->
remove_task
(
param
->
task
Id
);
}
}
else
if
(
event_type
==
USER_DESTROY_WINDOW
)
{
window_manager_
->
erase_task
(
param
->
windowId
);
window_manager_
->
erase_task
(
param
->
taskId
);
auto
it
=
tasks_
.
find
(
param
->
taskId
);
if
(
it
!=
tasks_
.
end
())
{
windows_
.
erase
(
it
->
second
);
tasks_
.
erase
(
it
);
}
}
delete
param
;
param
=
nullptr
;
...
...
@@ -418,7 +423,7 @@ void Platform::process_input_event(const SDL_Event &event) {
touch_
->
send_events
(
touch_events
);
}
int
Platform
::
find_touch_slot
(
int
id
){
int
Platform
::
find_touch_slot
(
int
id
)
{
for
(
int
i
=
0
;
i
<
MAX_FINGERS
;
i
++
)
{
if
(
touch_slots
[
i
]
==
id
)
return
i
;
...
...
@@ -426,14 +431,14 @@ int Platform::find_touch_slot(int id){
return
-
1
;
}
void
Platform
::
push_slot
(
std
::
vector
<
input
::
Event
>
&
touch_events
,
int
slot
){
void
Platform
::
push_slot
(
std
::
vector
<
input
::
Event
>
&
touch_events
,
int
slot
)
{
if
(
last_slot
!=
slot
)
{
touch_events
.
push_back
({
EV_ABS
,
ABS_MT_SLOT
,
slot
});
last_slot
=
slot
;
}
}
void
Platform
::
push_finger_down
(
int
x
,
int
y
,
int
finger_id
,
std
::
vector
<
input
::
Event
>
&
touch_events
){
void
Platform
::
push_finger_down
(
int
x
,
int
y
,
int
finger_id
,
std
::
vector
<
input
::
Event
>
&
touch_events
)
{
int
slot
=
find_touch_slot
(
-
1
);
if
(
slot
==
-
1
)
{
DEBUG
(
"no free slot!"
);
...
...
@@ -447,7 +452,7 @@ void Platform::push_finger_down(int x, int y, int finger_id, std::vector<input::
touch_events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
}
void
Platform
::
push_finger_up
(
int
finger_id
,
std
::
vector
<
input
::
Event
>
&
touch_events
){
void
Platform
::
push_finger_up
(
int
finger_id
,
std
::
vector
<
input
::
Event
>
&
touch_events
)
{
int
slot
=
find_touch_slot
(
finger_id
);
if
(
slot
==
-
1
)
return
;
...
...
@@ -457,7 +462,7 @@ void Platform::push_finger_up(int finger_id, std::vector<input::Event> &touch_ev
touch_slots
[
slot
]
=
-
1
;
}
void
Platform
::
push_finger_motion
(
int
x
,
int
y
,
int
finger_id
,
std
::
vector
<
input
::
Event
>
&
touch_events
){
void
Platform
::
push_finger_motion
(
int
x
,
int
y
,
int
finger_id
,
std
::
vector
<
input
::
Event
>
&
touch_events
)
{
int
slot
=
find_touch_slot
(
finger_id
);
if
(
slot
==
-
1
)
return
;
...
...
@@ -544,6 +549,7 @@ std::shared_ptr<wm::Window> Platform::create_window(
auto
w
=
std
::
make_shared
<
Window
>
(
renderer_
,
id
,
task
,
shared_from_this
(),
frame
,
title
,
!
window_size_immutable_
);
focused_sdl_window_id_
=
w
->
window_id
();
windows_
.
insert
({
id
,
w
});
tasks_
.
insert
({
task
,
id
});
return
w
;
}
...
...
@@ -554,7 +560,10 @@ void Platform::window_deleted(const Window::Id &id) {
return
;
}
if
(
auto
window
=
w
->
second
.
lock
())
{
tasks_
.
erase
(
window
->
task
());
window_manager_
->
remove_task
(
window
->
task
());
}
windows_
.
erase
(
w
);
}
...
...
src/anbox/platform/sdl/platform.h
浏览文件 @
9ea3e8e6
...
...
@@ -93,6 +93,7 @@ class Platform : public std::enable_shared_from_this<Platform>,
// We don't own the windows anymore after the got created by us so we
// need to be careful once we try to use them again.
std
::
map
<
Window
::
Id
,
std
::
weak_ptr
<
Window
>>
windows_
;
std
::
map
<
wm
::
Task
::
Id
,
Window
::
Id
>
tasks_
;
std
::
shared_ptr
<
Window
>
current_window_
;
std
::
thread
event_thread_
;
std
::
thread
ime_thread_
;
...
...
tests/anbox/wm/multi_window_manager_tests.cpp
浏览文件 @
9ea3e8e6
...
...
@@ -58,7 +58,7 @@ bool InList(SDL_Event event, vector<SDL_Event>& eventList) {
for
(
auto
ele
=
eventList
.
begin
();
ele
!=
eventList
.
end
();
)
{
auto
manager_param2
=
(
platform
::
manager_window_param
*
)(
ele
->
user
.
data1
);
if
(
event
.
user
.
code
==
ele
->
user
.
code
&&
manager_param
->
windowId
==
manager_param2
->
window
Id
&&
manager_param
->
taskId
==
manager_param2
->
task
Id
&&
manager_param
->
rect
==
manager_param2
->
rect
&&
manager_param
->
title
==
manager_param2
->
title
)
{
delete
manager_param2
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录