Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
83b161d5
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 搜索 >>
提交
83b161d5
编写于
6月 10, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
6月 10, 2020
浏览文件
操作
浏览文件
下载
差异文件
!14 Pull Request
Merge pull request !14 from Night/master
上级
545ec0b2
fff7c0a3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
60 addition
and
4 deletion
+60
-4
CMakeLists.txt
CMakeLists.txt
+1
-1
src/anbox/platform/sdl/window.cpp
src/anbox/platform/sdl/window.cpp
+54
-2
src/anbox/platform/sdl/window.h
src/anbox/platform/sdl/window.h
+4
-0
src/anbox/wm/window.h
src/anbox/wm/window.h
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
83b161d5
...
...
@@ -152,7 +152,7 @@ if (SNAP_CONFINEMENT)
endif
()
install
(
FILES data/ui/loading-screen.png DESTINATION
${
ANBOX_RESOURCE_DIR
}
/ui
)
install
(
FILES data/ui/
kpandroid
.png DESTINATION
${
ANBOX_RESOURCE_DIR
}
/ui
)
install
(
FILES data/ui/
logo
.png DESTINATION
${
ANBOX_RESOURCE_DIR
}
/ui
)
install
(
PROGRAMS scripts/anbox-bridge.sh DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
install
(
PROGRAMS scripts/anbox-launch.sh DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
...
...
src/anbox/platform/sdl/window.cpp
浏览文件 @
83b161d5
...
...
@@ -78,7 +78,7 @@ Window::Window(const std::shared_ptr<Renderer> &renderer,
if
(
SDL_SetWindowHitTest
(
window_
,
&
Window
::
on_window_hit
,
this
)
<
0
)
BOOST_THROW_EXCEPTION
(
std
::
runtime_error
(
"Failed to register for window hit test"
));
std
::
string
strPath
=
SystemConfiguration
::
instance
().
resource_dir
()
+
"/ui/
kpandroid
.png"
;
std
::
string
strPath
=
SystemConfiguration
::
instance
().
resource_dir
()
+
"/ui/
logo
.png"
;
SDL_Surface
*
icon
=
IMG_Load
(
strPath
.
c_str
());
SDL_SetWindowIcon
(
window_
,
icon
);
...
...
@@ -114,7 +114,8 @@ Window::Window(const std::shared_ptr<Renderer> &renderer,
struct
timeval
now
=
(
struct
timeval
)
{
0
};
gettimeofday
(
&
now
,
NULL
);
lastClickTime
=
USEC_PER_SEC
*
(
now
.
tv_sec
)
+
now
.
tv_usec
;
last_update_time
=
USEC_PER_SEC
*
(
now
.
tv_sec
)
+
now
.
tv_usec
;
lastClickTime
=
last_update_time
;
SDL_ShowWindow
(
window_
);
}
...
...
@@ -157,10 +158,19 @@ SDL_HitTestResult Window::on_window_hit(SDL_Window *window, const SDL_Point *pt,
else
break
;
if
(
!
platform_window
->
initialized
.
load
())
{
INFO
(
"window initialized by resize"
);
platform_window
->
initialized
=
true
;
}
return
result
;
}
if
(
pt
->
y
<
top_drag_area_height
)
{
if
(
!
platform_window
->
initialized
.
load
())
{
INFO
(
"window initialized by click top"
);
platform_window
->
initialized
=
true
;
}
if
(
pt
->
x
>
0
&&
pt
->
x
<
button_area_width
)
{
std
::
shared_ptr
<
anbox
::
platform
::
sdl
::
Window
::
Observer
>
observer_temp
=
platform_window
->
observer_
;
if
(
observer_temp
)
{
...
...
@@ -270,6 +280,48 @@ EGLNativeWindowType Window::native_handle() const { return native_window_; }
Window
::
Id
Window
::
id
()
const
{
return
id_
;
}
std
::
uint32_t
Window
::
window_id
()
const
{
return
SDL_GetWindowID
(
window_
);
}
void
Window
::
update_state
(
const
wm
::
WindowState
::
List
&
states
)
{
if
(
!
initialized
.
load
()
&&
!
states
.
empty
())
{
int
w
=
0
;
int
h
=
0
;
int
x
=
0
;
int
y
=
0
;
SDL_GetWindowSize
(
window_
,
&
w
,
&
h
);
SDL_GetWindowPosition
(
window_
,
&
x
,
&
y
);
graphics
::
Rect
rect
;
int
area
=
w
*
h
;
for
(
auto
ws
:
states
)
{
int
temp
=
ws
.
frame
().
width
()
*
ws
.
frame
().
height
();
if
(
temp
>=
area
)
{
rect
=
ws
.
frame
();
}
}
if
(
w
==
rect
.
width
()
&&
h
==
rect
.
height
()
&&
x
==
rect
.
left
()
&&
y
==
rect
.
top
())
{
return
;
}
struct
timeval
now
=
(
struct
timeval
)
{
0
};
gettimeofday
(
&
now
,
NULL
);
long
long
current_time
=
USEC_PER_SEC
*
(
now
.
tv_sec
)
+
now
.
tv_usec
;
if
(
current_time
-
last_update_time
>=
APP_START_MAX_TIME
)
{
INFO
(
"window initialized by timeout"
);
initialized
=
true
;
return
;
}
last_update_time
=
current_time
;
SDL_SetWindowSize
(
window_
,
rect
.
width
(),
rect
.
height
());
SDL_SetWindowPosition
(
window_
,
rect
.
left
(),
rect
.
top
());
update_frame
(
rect
);
}
}
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
src/anbox/platform/sdl/window.h
浏览文件 @
83b161d5
...
...
@@ -70,6 +70,8 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
void
process_event
(
const
SDL_Event
&
event
);
bool
check_min_state
()
{
return
SDL_GetWindowFlags
(
window_
)
&
SDL_WINDOW_MINIMIZED
;}
void
update_state
(
const
wm
::
WindowState
::
List
&
states
)
override
;
bool
check_db_clicked
(
int
x
,
int
y
);
EGLNativeWindowType
native_handle
()
const
override
;
...
...
@@ -82,6 +84,8 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
void
close
();
void
switch_window_state
();
std
::
atomic
<
bool
>
initialized
{
false
};
long
long
last_update_time
{
0
};
Id
id_
;
std
::
shared_ptr
<
Observer
>
observer_
;
EGLNativeDisplayType
native_display_
;
...
...
src/anbox/wm/window.h
浏览文件 @
83b161d5
...
...
@@ -51,7 +51,7 @@ class Window {
bool
attach
();
void
release
();
void
update_state
(
const
WindowState
::
List
&
states
);
v
irtual
v
oid
update_state
(
const
WindowState
::
List
&
states
);
void
update_frame
(
const
graphics
::
Rect
&
frame
);
virtual
EGLNativeWindowType
native_handle
()
const
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录