Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
bb32b256
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,发现更多精彩内容 >>
提交
bb32b256
编写于
8月 10, 2016
作者:
S
Simon Fels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use SDL for window creation and management
上级
5ee8c02b
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
440 addition
and
217 deletion
+440
-217
CMakeLists.txt
CMakeLists.txt
+1
-3
src/CMakeLists.txt
src/CMakeLists.txt
+2
-1
src/anbox/ubuntu/window.cpp
src/anbox/ubuntu/window.cpp
+374
-192
src/anbox/ubuntu/window.h
src/anbox/ubuntu/window.h
+7
-13
src/anbox/ubuntu/window_creator.cpp
src/anbox/ubuntu/window_creator.cpp
+49
-7
src/anbox/ubuntu/window_creator.h
src/anbox/ubuntu/window_creator.h
+7
-1
未找到文件。
CMakeLists.txt
浏览文件 @
bb32b256
...
...
@@ -62,9 +62,7 @@ find_package(EGL REQUIRED)
find_package
(
GLESv2 REQUIRED
)
find_package
(
Protobuf REQUIRED
)
# TODO(morphis): make mir an optional requirement so we can also add support
# for X11, wayland, ... at a later point if needed.
pkg_check_modules
(
MIRCLIENT REQUIRED mirclient
)
pkg_check_modules
(
SDL2 sdl2
)
pkg_check_modules
(
DBUS_CPP dbus-cpp REQUIRED
)
pkg_check_modules
(
DBUS dbus-1 REQUIRED
)
...
...
src/CMakeLists.txt
浏览文件 @
bb32b256
...
...
@@ -6,6 +6,7 @@ include_directories(
${
MIRCLIENT_INCLUDE_DIRS
}
${
DBUS_CPP_INCLUDE_DIRS
}
${
DBUS_INCLUDE_DIRS
}
${
SDL2_INCLUDE_DIRS
}
${
CMAKE_CURRENT_BINARY_DIR
}
${
CMAKE_SOURCE_DIR
}
${
CMAKE_SOURCE_DIR
}
/src
...
...
@@ -90,7 +91,6 @@ set(SOURCES
anbox/bridge/android_api_stub.cpp
anbox/ubuntu/platform_api_skeleton.cpp
anbox/ubuntu/mir_display_connection.cpp
anbox/ubuntu/window_creator.cpp
anbox/ubuntu/window.cpp
...
...
@@ -117,6 +117,7 @@ target_link_libraries(anbox-core
${
MIRCLIENT_LDFLAGS
}
${
MIRCLIENT_LIBRARIES
}
${
DBUS_CPP_LIBRARIES
}
${
SDL2_LIBRARIES
}
pthread
process-cpp
OpenglRender
...
...
src/anbox/ubuntu/window.cpp
浏览文件 @
bb32b256
此差异已折叠。
点击以展开。
src/anbox/ubuntu/window.h
浏览文件 @
bb32b256
...
...
@@ -23,7 +23,7 @@
#include <memory>
#include <vector>
#include <
mirclient/mir_toolkit/mir_client_library
.h>
#include <
SDL
.h>
namespace
anbox
{
namespace
input
{
...
...
@@ -32,29 +32,23 @@ class Device;
class
Event
;
}
// namespace input
namespace
ubuntu
{
class
MirDisplayConnection
;
class
Window
{
public:
Window
(
const
std
::
shared_ptr
<
MirDisplayConnection
>
&
display
,
const
std
::
shared_ptr
<
input
::
Manager
>
&
input_manager
,
Window
(
const
std
::
shared_ptr
<
input
::
Manager
>
&
input_manager
,
int
width
,
int
height
);
~
Window
();
void
process_input_event
(
const
SDL_Event
&
event
);
EGLNativeWindowType
native_window
()
const
;
private:
static
void
handle_surface_event
(
MirSurface
*
surface
,
MirEvent
const
*
event
,
void
*
context
);
void
handle_input_event
(
MirInputEvent
const
*
input_event
);
void
handle_touch_event
(
MirTouchEvent
const
*
touch_event
);
void
handle_pointer_event
(
MirPointerEvent
const
*
pointer_event
);
void
handle_pointer_button_event
(
std
::
vector
<
input
::
Event
>
&
events
,
MirPointerEvent
const
*
pointer_event
,
bool
pressed
);
std
::
shared_ptr
<
input
::
Device
>
touchpanel_
;
std
::
shared_ptr
<
input
::
Device
>
pointer_
;
std
::
shared_ptr
<
input
::
Device
>
keyboard_
;
EGLNativeDisplayType
native_display_
;
EGLNativeWindowType
native_window_
;
MirSurface
*
surface
_
;
SDL_Window
*
window
_
;
};
}
// namespace bridge
}
// namespace anbox
...
...
src/anbox/ubuntu/window_creator.cpp
浏览文件 @
bb32b256
...
...
@@ -17,7 +17,6 @@
#include "anbox/ubuntu/window_creator.h"
#include "anbox/ubuntu/window.h"
#include "anbox/ubuntu/mir_display_connection.h"
#include "anbox/logger.h"
#include <boost/throw_exception.hpp>
...
...
@@ -26,20 +25,62 @@ namespace anbox {
namespace
ubuntu
{
WindowCreator
::
WindowCreator
(
const
std
::
shared_ptr
<
input
::
Manager
>
&
input_manager
)
:
graphics
::
WindowCreator
(
input_manager
),
input_manager_
(
input_manager
),
display_
(
std
::
make_shared
<
MirDisplayConnection
>
())
{
input_manager_
(
input_manager
)
{
if
(
SDL_Init
(
SDL_INIT_VIDEO
|
SDL_INIT_EVENTS
)
<
0
)
BOOST_THROW_EXCEPTION
(
std
::
runtime_error
(
"Failed to initialize SDL"
));
event_thread
=
std
::
thread
(
&
WindowCreator
::
process_events
,
this
);
}
WindowCreator
::~
WindowCreator
()
{
}
void
WindowCreator
::
process_window_event
(
const
SDL_Event
&
event
)
{
}
void
WindowCreator
::
process_events
()
{
while
(
true
)
{
SDL_Event
event
;
while
(
SDL_WaitEvent
(
&
event
))
{
switch
(
event
.
type
)
{
case
SDL_QUIT
:
// FIXME once one of our windows is closed we need to decide what
// to do base on the configuration we're running in.
break
;
case
SDL_WINDOWEVENT
:
process_window_event
(
event
);
break
;
case
SDL_FINGERUP
:
case
SDL_FINGERMOTION
:
case
SDL_FINGERDOWN
:
case
SDL_MOUSEMOTION
:
case
SDL_MOUSEBUTTONDOWN
:
case
SDL_MOUSEBUTTONUP
:
case
SDL_MOUSEWHEEL
:
case
SDL_KEYDOWN
:
case
SDL_KEYUP
:
if
(
current_window_
)
current_window_
->
process_input_event
(
event
);
break
;
}
}
}
}
EGLNativeWindowType
WindowCreator
::
create_window
(
int
x
,
int
y
,
int
width
,
int
height
)
{
DEBUG
(
"x %i y %i width %i height %i"
,
x
,
y
,
width
,
height
);
auto
window
=
std
::
make_shared
<
Window
>
(
display_
,
input_manager_
,
width
,
height
);
if
(
windows_
.
size
()
==
1
)
{
WARNING
(
"Tried to create another window but we currently only allow one"
);
return
0
;
}
auto
window
=
std
::
make_shared
<
Window
>
(
input_manager_
,
width
,
height
);
windows_
.
insert
({
window
->
native_window
(),
window
});
current_window_
=
window
;
return
window
->
native_window
();
}
...
...
@@ -52,11 +93,12 @@ void WindowCreator::destroy_window(EGLNativeWindowType win) {
}
WindowCreator
::
DisplayInfo
WindowCreator
::
display_info
()
const
{
return
{
display_
->
horizontal_resolution
(),
display_
->
vertical_resolution
()};
// FIXME: force for now until we have real detection for this
return
{
1280
,
720
};
}
EGLNativeDisplayType
WindowCreator
::
native_display
()
const
{
return
display_
->
native_display
()
;
return
0
;
}
}
// namespace bridge
}
// namespace anbox
src/anbox/ubuntu/window_creator.h
浏览文件 @
bb32b256
...
...
@@ -21,8 +21,10 @@
#include "anbox/graphics/window_creator.h"
#include <map>
#include <thread>
#include <EGL/egl.h>
#include <SDL.h>
namespace
anbox
{
namespace
ubuntu
{
...
...
@@ -40,9 +42,13 @@ public:
EGLNativeDisplayType
native_display
()
const
override
;
private:
void
process_events
();
void
process_window_event
(
const
SDL_Event
&
event
);
std
::
shared_ptr
<
input
::
Manager
>
input_manager_
;
std
::
shared_ptr
<
MirDisplayConnection
>
display_
;
std
::
map
<
EGLNativeWindowType
,
std
::
shared_ptr
<
Window
>>
windows_
;
std
::
shared_ptr
<
Window
>
current_window_
;
std
::
thread
event_thread
;
};
}
// namespace bridge
}
// namespace anbox
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录