Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
9cddabcb
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看板
提交
9cddabcb
编写于
7月 29, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
7月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
!63 input: Ensure sockets are accessible from within the container & code style
Merge pull request !63 from Night/master
上级
1913017f
22958fbd
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
37 addition
and
21 deletion
+37
-21
src/anbox/input/device.cpp
src/anbox/input/device.cpp
+4
-0
src/anbox/input/manager.cpp
src/anbox/input/manager.cpp
+6
-1
src/anbox/platform/null/platform.cpp
src/anbox/platform/null/platform.cpp
+2
-0
src/anbox/platform/null/platform.h
src/anbox/platform/null/platform.h
+1
-0
src/anbox/platform/sdl/platform.cpp
src/anbox/platform/sdl/platform.cpp
+4
-0
src/anbox/platform/sdl/window.cpp
src/anbox/platform/sdl/window.cpp
+17
-9
src/anbox/platform/sdl/window.h
src/anbox/platform/sdl/window.h
+3
-11
未找到文件。
src/anbox/input/device.cpp
浏览文件 @
9cddabcb
...
...
@@ -38,6 +38,10 @@ std::shared_ptr<Device> Device::create(
sp
->
connector_
=
std
::
make_shared
<
network
::
PublishedSocketConnector
>
(
path
,
runtime
,
delegate_connector
);
// The socket is created with user permissions (e.g. rwx------),
// which prevents the container from accessing it. Make sure it is writable.
::
chmod
(
path
.
c_str
(),
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
|
S_IWOTH
);
return
sp
;
}
...
...
src/anbox/input/manager.cpp
浏览文件 @
9cddabcb
...
...
@@ -26,7 +26,12 @@
namespace
anbox
{
namespace
input
{
Manager
::
Manager
(
const
std
::
shared_ptr
<
Runtime
>
&
runtime
)
:
runtime_
(
runtime
)
{
utils
::
ensure_paths
({
SystemConfiguration
::
instance
().
input_device_dir
()});
const
auto
dir
=
SystemConfiguration
::
instance
().
input_device_dir
();
utils
::
ensure_paths
({
dir
});
// The directory is bind-mounted into the container but might have user
// permissions only (rwx------). Make sure it is accessible.
::
chmod
(
dir
.
c_str
(),
S_IRWXU
|
S_IRGRP
|
S_IXGRP
|
S_IROTH
|
S_IXOTH
);
}
Manager
::~
Manager
()
{}
...
...
src/anbox/platform/null/platform.cpp
浏览文件 @
9cddabcb
...
...
@@ -33,6 +33,8 @@ namespace anbox {
namespace
platform
{
NullPlatform
::
NullPlatform
()
{}
NullPlatform
::~
NullPlatform
()
{}
std
::
shared_ptr
<
wm
::
Window
>
NullPlatform
::
create_window
(
const
anbox
::
wm
::
Task
::
Id
&
task
,
const
anbox
::
graphics
::
Rect
&
frame
,
const
std
::
string
&
title
)
{
return
std
::
make_shared
<::
NullWindow
>
(
task
,
frame
,
title
);
...
...
src/anbox/platform/null/platform.h
浏览文件 @
9cddabcb
...
...
@@ -25,6 +25,7 @@ namespace platform {
class
NullPlatform
:
public
BasePlatform
{
public:
NullPlatform
();
~
NullPlatform
();
std
::
shared_ptr
<
wm
::
Window
>
create_window
(
const
anbox
::
wm
::
Task
::
Id
&
task
,
const
anbox
::
graphics
::
Rect
&
frame
,
...
...
src/anbox/platform/sdl/platform.cpp
浏览文件 @
9cddabcb
...
...
@@ -174,6 +174,10 @@ void Platform::create_ime_socket() {
return
;
}
socket_addr
.
sun_family
=
AF_UNIX
;
if
(
ime_socket_file_
.
length
()
>=
strlen
(
socket_addr
.
sun_path
)
-
1
)
{
ERROR
(
"Create ime failed, socket path too long"
);
return
;
}
strcpy
(
socket_addr
.
sun_path
,
ime_socket_file_
.
c_str
());
unlink
(
ime_socket_file_
.
c_str
());
rc
=
bind
(
ime_socket
,
reinterpret_cast
<
struct
sockaddr
*>
(
&
socket_addr
),
sizeof
(
socket_addr
));
...
...
src/anbox/platform/sdl/window.cpp
浏览文件 @
9cddabcb
...
...
@@ -38,12 +38,20 @@ constexpr const int button_padding{0};
namespace
anbox
{
namespace
platform
{
namespace
sdl
{
Window
::
Id
Window
::
Invalid
{
-
1
};
const
std
::
map
<
std
::
string
,
Window
::
window_property
>
Window
::
property_map
=
{
{
"喜马拉雅"
,
Window
::
HIDE_MAXIMIZE
},
{
"i深圳"
,
Window
::
HIDE_MAXIMIZE
}
static
const
std
::
uint32_t
HIDE_BACK
=
0x01
;
static
const
std
::
uint32_t
HIDE_MINIMIZE
=
0x02
;
static
const
std
::
uint32_t
HIDE_MAXIMIZE
=
0x04
;
static
const
std
::
uint32_t
HIDE_CLOSE
=
0x08
;
static
const
std
::
uint32_t
SHOW_ALL
=
0x00
;
const
std
::
map
<
std
::
string
,
std
::
uint32_t
>
Window
::
property_map
=
{
{
"喜马拉雅"
,
HIDE_MAXIMIZE
},
{
"i深圳"
,
HIDE_MAXIMIZE
}
};
Window
::
Id
Window
::
Invalid
{
-
1
};
Window
::
Observer
::~
Observer
()
{}
Window
::
Window
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
,
...
...
@@ -56,7 +64,8 @@ Window::Window(const std::shared_ptr<Renderer> &renderer,
id_
(
id
),
lastClickTime
(
0
),
observer_
(
observer
),
native_display_
(
0
){
native_display_
(
0
),
visible_property
(
SHOW_ALL
)
{
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MAJOR_VERSION
,
1
);
// NOTE: We don't furce GL initialization of the window as this will
...
...
@@ -68,12 +77,11 @@ Window::Window(const std::shared_ptr<Renderer> &renderer,
auto
property_itr
=
property_map
.
find
(
title
);
if
(
property_itr
!=
property_map
.
end
())
{
visible_property
=
property_itr
->
second
;
if
(
!
(
visible_property
&
HIDE_MAXIMIZE
)
&&
resizable
)
{
flags
|=
SDL_WINDOW_RESIZABLE
;
}
}
else
if
(
resizable
)
{
if
(
!
(
visible_property
&
HIDE_MAXIMIZE
)
&&
resizable
)
{
flags
|=
SDL_WINDOW_RESIZABLE
;
}
window_
=
SDL_CreateWindow
(
title
.
c_str
(),
frame
.
left
(),
frame
.
top
(),
frame
.
width
(),
frame
.
height
(),
...
...
src/anbox/platform/sdl/window.h
浏览文件 @
9cddabcb
...
...
@@ -42,15 +42,7 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
static
const
long
long
APP_START_MAX_TIME
=
15
*
USEC_PER_SEC
;
static
const
long
long
timespan_db_click
=
500000
;
enum
window_property
{
HIDE_BACK
=
0x01
,
HIDE_MINIMIZE
=
0x02
,
HIDE_MAXIMIZE
=
0x04
,
HIDE_CLOSE
=
0x08
,
SHOW_ALL
=
0x00
};
static
const
std
::
map
<
std
::
string
,
window_property
>
property_map
;
static
const
std
::
map
<
std
::
string
,
std
::
uint32_t
>
property_map
;
class
Observer
{
public:
...
...
@@ -82,7 +74,7 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
Id
id
()
const
;
std
::
uint32_t
window_id
()
const
;
Uint32
GetWindowFlags
(){
return
SDL_GetWindowFlags
(
window_
);}
inline
window_property
get_property
()
{
inline
std
::
uint32_t
get_property
()
{
return
visible_property
;
}
...
...
@@ -102,7 +94,7 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
int
last_point_y
{
0
};
int
last_wnd_x
{
0
};
int
last_wnd_y
{
0
};
window_property
visible_property
{
SHOW_ALL
}
;
std
::
uint32_t
visible_property
;
};
}
// namespace sdl
}
// namespace platform
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录