Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
2900829d
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,发现更多精彩内容 >>
提交
2900829d
编写于
6月 20, 2017
作者:
S
Simon Fels
提交者:
GitHub
6月 20, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #326 from morphis/f/platform-abstract
Refactor platform abstraction layer
上级
c5f6776f
fa2c5f20
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
239 addition
and
155 deletion
+239
-155
src/CMakeLists.txt
src/CMakeLists.txt
+9
-7
src/anbox/audio/server.cpp
src/anbox/audio/server.cpp
+3
-3
src/anbox/audio/server.h
src/anbox/audio/server.h
+3
-3
src/anbox/bridge/platform_api_skeleton.cpp
src/anbox/bridge/platform_api_skeleton.cpp
+5
-5
src/anbox/bridge/platform_api_skeleton.h
src/anbox/bridge/platform_api_skeleton.h
+3
-3
src/anbox/cmds/session_manager.cpp
src/anbox/cmds/session_manager.cpp
+13
-8
src/anbox/platform/base_platform.cpp
src/anbox/platform/base_platform.cpp
+40
-0
src/anbox/platform/base_platform.h
src/anbox/platform/base_platform.h
+16
-3
src/anbox/platform/null/platform.cpp
src/anbox/platform/null/platform.cpp
+17
-7
src/anbox/platform/null/platform.h
src/anbox/platform/null/platform.h
+7
-5
src/anbox/platform/sdl/audio_sink.cpp
src/anbox/platform/sdl/audio_sink.cpp
+5
-3
src/anbox/platform/sdl/audio_sink.h
src/anbox/platform/sdl/audio_sink.h
+7
-6
src/anbox/platform/sdl/keycode_converter.cpp
src/anbox/platform/sdl/keycode_converter.cpp
+6
-4
src/anbox/platform/sdl/keycode_converter.h
src/anbox/platform/sdl/keycode_converter.h
+8
-6
src/anbox/platform/sdl/mir_display_connection.cpp
src/anbox/platform/sdl/mir_display_connection.cpp
+3
-3
src/anbox/platform/sdl/mir_display_connection.h
src/anbox/platform/sdl/mir_display_connection.h
+4
-4
src/anbox/platform/sdl/platform.cpp
src/anbox/platform/sdl/platform.cpp
+26
-24
src/anbox/platform/sdl/platform.h
src/anbox/platform/sdl/platform.h
+16
-16
src/anbox/platform/sdl/sdl_wrapper.h
src/anbox/platform/sdl/sdl_wrapper.h
+11
-6
src/anbox/platform/sdl/window.cpp
src/anbox/platform/sdl/window.cpp
+6
-9
src/anbox/platform/sdl/window.h
src/anbox/platform/sdl/window.h
+8
-7
src/anbox/wm/multi_window_manager.cpp
src/anbox/wm/multi_window_manager.cpp
+4
-4
src/anbox/wm/multi_window_manager.h
src/anbox/wm/multi_window_manager.h
+3
-3
src/anbox/wm/single_window_manager.cpp
src/anbox/wm/single_window_manager.cpp
+4
-4
src/anbox/wm/single_window_manager.h
src/anbox/wm/single_window_manager.h
+3
-3
tests/anbox/graphics/layer_composer_tests.cpp
tests/anbox/graphics/layer_composer_tests.cpp
+9
-9
未找到文件。
src/CMakeLists.txt
浏览文件 @
2900829d
...
...
@@ -164,8 +164,15 @@ set(SOURCES
anbox/wm/window_state.cpp
anbox/wm/window.cpp
anbox/platform/policy.cpp
anbox/platform/default_policy.cpp
anbox/platform/base_platform.cpp
anbox/platform/null/platform.cpp
anbox/platform/sdl/sdl_wrapper.h
anbox/platform/sdl/window.cpp
anbox/platform/sdl/keycode_converter.cpp
anbox/platform/sdl/platform.cpp
anbox/platform/sdl/audio_sink.cpp
anbox/input/manager.cpp
anbox/input/device.cpp
...
...
@@ -187,11 +194,6 @@ set(SOURCES
anbox/bridge/platform_api_skeleton.cpp
anbox/bridge/android_api_stub.cpp
anbox/ubuntu/window.cpp
anbox/ubuntu/keycode_converter.cpp
anbox/ubuntu/platform_policy.cpp
anbox/ubuntu/audio_sink.cpp
anbox/dbus/interface.h
anbox/dbus/codecs.h
anbox/dbus/skeleton/service.cpp
...
...
src/anbox/audio/server.cpp
浏览文件 @
2900829d
...
...
@@ -47,8 +47,8 @@ class AudioForwarder : public anbox::network::MessageProcessor {
namespace
anbox
{
namespace
audio
{
Server
::
Server
(
const
std
::
shared_ptr
<
Runtime
>&
rt
,
const
std
::
shared_ptr
<
platform
::
Policy
>
&
platform_policy
)
:
platform_
policy_
(
platform_policy
),
Server
::
Server
(
const
std
::
shared_ptr
<
Runtime
>&
rt
,
const
std
::
shared_ptr
<
platform
::
BasePlatform
>
&
platform
)
:
platform_
(
platform
),
socket_file_
(
utils
::
string_format
(
"%s/anbox_audio"
,
SystemConfiguration
::
instance
().
socket_dir
())),
connector_
(
std
::
make_shared
<
network
::
PublishedSocketConnector
>
(
socket_file_
,
rt
,
...
...
@@ -81,7 +81,7 @@ void Server::create_connection_for(std::shared_ptr<boost::asio::basic_stream_soc
switch
(
client_info
.
type
)
{
case
ClientInfo
::
Type
::
Playback
:
processor
=
std
::
make_shared
<
AudioForwarder
>
(
platform_
policy_
->
create_audio_sink
());
processor
=
std
::
make_shared
<
AudioForwarder
>
(
platform_
->
create_audio_sink
());
break
;
case
ClientInfo
::
Type
::
Recording
:
break
;
...
...
src/anbox/audio/server.h
浏览文件 @
2900829d
...
...
@@ -22,7 +22,7 @@
#include "anbox/audio/client_info.h"
#include "anbox/network/socket_messenger.h"
#include "anbox/network/socket_connection.h"
#include "anbox/platform/
policy
.h"
#include "anbox/platform/
base_platform
.h"
#include <atomic>
...
...
@@ -33,7 +33,7 @@ class PublishedSocketConnector;
namespace
audio
{
class
Server
{
public:
Server
(
const
std
::
shared_ptr
<
Runtime
>&
rt
,
const
std
::
shared_ptr
<
platform
::
Policy
>
&
platform_policy
);
Server
(
const
std
::
shared_ptr
<
Runtime
>&
rt
,
const
std
::
shared_ptr
<
platform
::
BasePlatform
>
&
platform
);
~
Server
();
std
::
string
socket_file
()
const
{
return
socket_file_
;
}
...
...
@@ -44,7 +44,7 @@ class Server {
int
next_id
();
std
::
shared_ptr
<
platform
::
Policy
>
platform_policy
_
;
std
::
shared_ptr
<
platform
::
BasePlatform
>
platform
_
;
std
::
string
socket_file_
;
std
::
shared_ptr
<
network
::
PublishedSocketConnector
>
connector_
;
std
::
shared_ptr
<
network
::
Connections
<
network
::
SocketConnection
>>
const
connections_
;
...
...
src/anbox/bridge/platform_api_skeleton.cpp
浏览文件 @
2900829d
...
...
@@ -17,7 +17,7 @@
#include "anbox/bridge/platform_api_skeleton.h"
#include "anbox/application/database.h"
#include "anbox/platform/
policy
.h"
#include "anbox/platform/
base_platform
.h"
#include "anbox/wm/manager.h"
#include "anbox/wm/window_state.h"
#include "anbox/logger.h"
...
...
@@ -32,11 +32,11 @@ namespace anbox {
namespace
bridge
{
PlatformApiSkeleton
::
PlatformApiSkeleton
(
const
std
::
shared_ptr
<
rpc
::
PendingCallCache
>
&
pending_calls
,
const
std
::
shared_ptr
<
platform
::
Policy
>
&
platform_policy
,
const
std
::
shared_ptr
<
platform
::
BasePlatform
>
&
platform
,
const
std
::
shared_ptr
<
wm
::
Manager
>
&
window_manager
,
const
std
::
shared_ptr
<
application
::
Database
>
&
app_db
)
:
pending_calls_
(
pending_calls
),
platform_
policy_
(
platform_policy
),
platform_
(
platform
),
window_manager_
(
window_manager
),
app_db_
(
app_db
)
{}
...
...
@@ -49,7 +49,7 @@ void PlatformApiSkeleton::set_clipboard_data(anbox::protobuf::bridge::ClipboardD
(
void
)
response
;
if
(
request
->
has_text
())
platform_
policy_
->
set_clipboard_data
(
platform
::
Policy
::
ClipboardData
{
request
->
text
()});
platform_
->
set_clipboard_data
(
platform
::
BasePlatform
::
ClipboardData
{
request
->
text
()});
done
->
Run
();
}
...
...
@@ -59,7 +59,7 @@ void PlatformApiSkeleton::get_clipboard_data(anbox::protobuf::rpc::Void const *r
google
::
protobuf
::
Closure
*
done
)
{
(
void
)
request
;
auto
data
=
platform_
policy_
->
get_clipboard_data
();
auto
data
=
platform_
->
get_clipboard_data
();
if
(
!
data
.
text
.
empty
())
response
->
set_text
(
data
.
text
);
...
...
src/anbox/bridge/platform_api_skeleton.h
浏览文件 @
2900829d
...
...
@@ -40,7 +40,7 @@ class ApplicationListUpdateEvent;
}
// namespace bridge
}
// namespace protobuf
namespace
platform
{
class
Policy
;
class
BasePlatform
;
}
// namespace platform
namespace
rpc
{
class
PendingCallCache
;
...
...
@@ -56,7 +56,7 @@ class PlatformApiSkeleton {
public:
PlatformApiSkeleton
(
const
std
::
shared_ptr
<
rpc
::
PendingCallCache
>
&
pending_calls
,
const
std
::
shared_ptr
<
platform
::
Policy
>
&
platform_policy
,
const
std
::
shared_ptr
<
platform
::
BasePlatform
>
&
platform
,
const
std
::
shared_ptr
<
wm
::
Manager
>
&
window_manager
,
const
std
::
shared_ptr
<
application
::
Database
>
&
app_db
);
virtual
~
PlatformApiSkeleton
();
...
...
@@ -79,7 +79,7 @@ class PlatformApiSkeleton {
private:
std
::
shared_ptr
<
rpc
::
PendingCallCache
>
pending_calls_
;
std
::
shared_ptr
<
platform
::
Policy
>
platform_policy
_
;
std
::
shared_ptr
<
platform
::
BasePlatform
>
platform
_
;
std
::
shared_ptr
<
wm
::
Manager
>
window_manager_
;
std
::
shared_ptr
<
application
::
Database
>
app_db_
;
std
::
function
<
void
()
>
boot_finished_handler_
;
...
...
src/anbox/cmds/session_manager.cpp
浏览文件 @
2900829d
...
...
@@ -45,7 +45,7 @@ std::istream& operator>>(std::istream& in, anbox::graphics::GLRendererServer::Co
#include "anbox/rpc/channel.h"
#include "anbox/rpc/connection_creator.h"
#include "anbox/runtime.h"
#include "anbox/
ubuntu/platform_policy
.h"
#include "anbox/
platform/base_platform
.h"
#include "anbox/wm/multi_window_manager.h"
#include "anbox/wm/single_window_manager.h"
...
...
@@ -176,25 +176,30 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
if
(
single_window_
)
display_frame
=
window_size_
;
auto
policy
=
std
::
make_shared
<
ubuntu
::
PlatformPolicy
>
(
input_manager
,
display_frame
,
single_window_
);
auto
platform
=
platform
::
create
(
utils
::
get_env_value
(
"ANBOX_PLATFORM"
,
"sdl"
),
input_manager
,
display_frame
,
single_window_
);
if
(
!
platform
)
return
EXIT_FAILURE
;
auto
app_db
=
std
::
make_shared
<
application
::
Database
>
();
std
::
shared_ptr
<
wm
::
Manager
>
window_manager
;
if
(
single_window_
)
window_manager
=
std
::
make_shared
<
wm
::
SingleWindowManager
>
(
p
olicy
,
display_frame
,
app_db
);
window_manager
=
std
::
make_shared
<
wm
::
SingleWindowManager
>
(
p
latform
,
display_frame
,
app_db
);
else
window_manager
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
p
olicy
,
android_api_stub
,
app_db
);
window_manager
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
p
latform
,
android_api_stub
,
app_db
);
auto
gl_server
=
std
::
make_shared
<
graphics
::
GLRendererServer
>
(
graphics
::
GLRendererServer
::
Config
{
gles_driver_
,
single_window_
},
window_manager
);
p
olicy
->
set_window_manager
(
window_manager
);
p
olicy
->
set_renderer
(
gl_server
->
renderer
());
p
latform
->
set_window_manager
(
window_manager
);
p
latform
->
set_renderer
(
gl_server
->
renderer
());
window_manager
->
setup
();
auto
audio_server
=
std
::
make_shared
<
audio
::
Server
>
(
rt
,
p
olicy
);
auto
audio_server
=
std
::
make_shared
<
audio
::
Server
>
(
rt
,
p
latform
);
const
auto
socket_path
=
SystemConfiguration
::
instance
().
socket_dir
();
...
...
@@ -219,7 +224,7 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
android_api_stub
->
set_rpc_channel
(
rpc_channel
);
auto
server
=
std
::
make_shared
<
bridge
::
PlatformApiSkeleton
>
(
pending_calls
,
p
olicy
,
window_manager
,
app_db
);
pending_calls
,
p
latform
,
window_manager
,
app_db
);
server
->
register_boot_finished_handler
([
&
]()
{
DEBUG
(
"Android successfully booted"
);
android_api_stub
->
ready
().
set
(
true
);
...
...
src/anbox/platform/base_platform.cpp
0 → 100644
浏览文件 @
2900829d
/*
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "anbox/platform/base_platform.h"
#include "anbox/platform/null/platform.h"
#include "anbox/platform/sdl/platform.h"
#include "anbox/logger.h"
namespace
anbox
{
namespace
platform
{
std
::
shared_ptr
<
BasePlatform
>
create
(
const
std
::
string
&
name
,
const
std
::
shared_ptr
<
input
::
Manager
>
&
input_manager
,
const
graphics
::
Rect
&
display_frame
,
bool
single_window
)
{
if
(
name
.
empty
())
return
std
::
make_shared
<
NullPlatform
>
();
if
(
name
==
"sdl"
)
return
std
::
make_shared
<
sdl
::
Platform
>
(
input_manager
,
display_frame
,
single_window
);
WARNING
(
"Unsupported platfrom '%s'"
,
name
);
return
nullptr
;
}
}
// namespace platform
}
// namespace anbox
src/anbox/platform/
policy
.h
→
src/anbox/platform/
base_platform
.h
浏览文件 @
2900829d
...
...
@@ -23,6 +23,8 @@
#include <memory>
class
Renderer
;
namespace
anbox
{
namespace
audio
{
class
Sink
;
...
...
@@ -30,11 +32,15 @@ class Source;
}
// namespace audio
namespace
wm
{
class
Window
;
class
Manager
;
}
// namespace wm
namespace
input
{
class
Manager
;
}
// namespace input
namespace
platform
{
class
Policy
{
class
BasePlatform
{
public:
virtual
~
Policy
();
virtual
~
BasePlatform
()
{}
virtual
std
::
shared_ptr
<
wm
::
Window
>
create_window
(
const
anbox
::
wm
::
Task
::
Id
&
task
,
const
anbox
::
graphics
::
Rect
&
frame
,
const
std
::
string
&
title
)
=
0
;
...
...
@@ -47,8 +53,15 @@ class Policy {
virtual
std
::
shared_ptr
<
audio
::
Sink
>
create_audio_sink
()
=
0
;
virtual
std
::
shared_ptr
<
audio
::
Source
>
create_audio_source
()
=
0
;
virtual
void
set_renderer
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
)
=
0
;
virtual
void
set_window_manager
(
const
std
::
shared_ptr
<
wm
::
Manager
>
&
window_manager
)
=
0
;
};
}
// namespace wm
std
::
shared_ptr
<
BasePlatform
>
create
(
const
std
::
string
&
name
=
""
,
const
std
::
shared_ptr
<
input
::
Manager
>
&
input_manager
=
nullptr
,
const
graphics
::
Rect
&
display_frame
=
graphics
::
Rect
::
Invalid
,
bool
single_window
=
false
);
}
// namespace platform
}
// namespace anbox
#endif
src/anbox/platform/
default_policy
.cpp
→
src/anbox/platform/
null/platform
.cpp
浏览文件 @
2900829d
...
...
@@ -15,7 +15,7 @@
*
*/
#include "anbox/platform/
default_policy
.h"
#include "anbox/platform/
null/platform
.h"
#include "anbox/wm/window.h"
#include "anbox/logger.h"
...
...
@@ -31,31 +31,41 @@ class NullWindow : public anbox::wm::Window {
namespace
anbox
{
namespace
platform
{
DefaultPolicy
::
DefaultPolicy
()
{}
NullPlatform
::
NullPlatform
()
{}
std
::
shared_ptr
<
wm
::
Window
>
DefaultPolicy
::
create_window
(
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
);
}
void
DefaultPolicy
::
set_clipboard_data
(
const
ClipboardData
&
data
)
{
void
NullPlatform
::
set_clipboard_data
(
const
ClipboardData
&
data
)
{
(
void
)
data
;
ERROR
(
"Not implemented"
);
}
DefaultPolicy
::
ClipboardData
DefaultPolicy
::
get_clipboard_data
()
{
NullPlatform
::
ClipboardData
NullPlatform
::
get_clipboard_data
()
{
ERROR
(
"Not implemented"
);
return
ClipboardData
{};
}
std
::
shared_ptr
<
audio
::
Sink
>
DefaultPolicy
::
create_audio_sink
()
{
std
::
shared_ptr
<
audio
::
Sink
>
NullPlatform
::
create_audio_sink
()
{
ERROR
(
"Not implemented"
);
return
nullptr
;
}
std
::
shared_ptr
<
audio
::
Source
>
DefaultPolicy
::
create_audio_source
()
{
std
::
shared_ptr
<
audio
::
Source
>
NullPlatform
::
create_audio_source
()
{
ERROR
(
"Not implemented"
);
return
nullptr
;
}
void
NullPlatform
::
set_renderer
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
)
{
(
void
)
renderer
;
ERROR
(
"Not implemented"
);
}
void
NullPlatform
::
set_window_manager
(
const
std
::
shared_ptr
<
wm
::
Manager
>
&
window_manager
)
{
(
void
)
window_manager
;
ERROR
(
"Not implemented"
);
}
}
// namespace wm
}
// namespace anbox
src/anbox/platform/
default_policy
.h
→
src/anbox/platform/
null/platform
.h
浏览文件 @
2900829d
...
...
@@ -15,16 +15,16 @@
*
*/
#ifndef ANBOX_PLATFORM_
DEFAULT_POLICY
_H_
#define ANBOX_PLATFORM_
DEFAULT_POLICY
_H_
#ifndef ANBOX_PLATFORM_
NULL_PLATFORM
_H_
#define ANBOX_PLATFORM_
NULL_PLATFORM
_H_
#include "anbox/platform/
policy
.h"
#include "anbox/platform/
base_platform
.h"
namespace
anbox
{
namespace
platform
{
class
DefaultPolicy
:
public
Policy
{
class
NullPlatform
:
public
BasePlatform
{
public:
DefaultPolicy
();
NullPlatform
();
std
::
shared_ptr
<
wm
::
Window
>
create_window
(
const
anbox
::
wm
::
Task
::
Id
&
task
,
const
anbox
::
graphics
::
Rect
&
frame
,
...
...
@@ -33,6 +33,8 @@ class DefaultPolicy : public Policy {
ClipboardData
get_clipboard_data
()
override
;
std
::
shared_ptr
<
audio
::
Sink
>
create_audio_sink
()
override
;
std
::
shared_ptr
<
audio
::
Source
>
create_audio_source
()
override
;
void
set_renderer
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
)
override
;
void
set_window_manager
(
const
std
::
shared_ptr
<
wm
::
Manager
>
&
window_manager
)
override
;
};
}
// namespace wm
}
// namespace anbox
...
...
src/anbox/
ubuntu
/audio_sink.cpp
→
src/anbox/
platform/sdl
/audio_sink.cpp
浏览文件 @
2900829d
...
...
@@ -15,7 +15,7 @@
*
*/
#include "anbox/
ubuntu
/audio_sink.h"
#include "anbox/
platform/sdl
/audio_sink.h"
#include "anbox/logger.h"
#include <stdexcept>
...
...
@@ -27,7 +27,8 @@ const constexpr size_t max_queue_size{16};
}
namespace
anbox
{
namespace
ubuntu
{
namespace
platform
{
namespace
sdl
{
AudioSink
::
AudioSink
()
:
device_id_
(
0
),
queue_
(
max_queue_size
)
{
...
...
@@ -113,5 +114,6 @@ void AudioSink::write_data(const std::vector<std::uint8_t> &data) {
graphics
::
Buffer
buffer
{
data
.
data
(),
data
.
data
()
+
data
.
size
()};
queue_
.
push_locked
(
std
::
move
(
buffer
),
l
);
}
}
// namespace ubuntu
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
src/anbox/
ubuntu
/audio_sink.h
→
src/anbox/
platform/sdl
/audio_sink.h
浏览文件 @
2900829d
...
...
@@ -15,18 +15,18 @@
*
*/
#ifndef ANBOX_
UBUNTU
_AUDIO_SINK_H_
#define ANBOX_
UBUNTU
_AUDIO_SINK_H_
#ifndef ANBOX_
PLATFORM_SDL
_AUDIO_SINK_H_
#define ANBOX_
PLATFORM_SDL
_AUDIO_SINK_H_
#include "anbox/audio/sink.h"
#include "anbox/graphics/buffer_queue.h"
#include <SDL2/SDL_audio.h>
#include "anbox/platform/sdl/sdl_wrapper.h"
#include <thread>
namespace
anbox
{
namespace
ubuntu
{
namespace
platform
{
namespace
sdl
{
class
AudioSink
:
public
audio
::
Sink
{
public:
AudioSink
();
...
...
@@ -48,7 +48,8 @@ class AudioSink : public audio::Sink {
graphics
::
Buffer
read_buffer_
;
size_t
read_buffer_left_
=
0
;
};
}
// namespace ubuntu
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
#endif
src/anbox/
ubuntu
/keycode_converter.cpp
→
src/anbox/
platform/sdl
/keycode_converter.cpp
浏览文件 @
2900829d
...
...
@@ -16,13 +16,14 @@
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
#include "anbox/
ubuntu
/keycode_converter.h"
#include "anbox/
platform/sdl
/keycode_converter.h"
#pragma GCC diagnostic pop
#include <linux/input.h>
namespace
anbox
{
namespace
ubuntu
{
namespace
platform
{
namespace
sdl
{
std
::
uint16_t
KeycodeConverter
::
convert
(
const
SDL_Scancode
&
scan_code
)
{
for
(
std
::
uint16_t
n
=
0
;
n
<
code_map
.
size
();
n
++
)
{
if
(
code_map
[
n
]
==
scan_code
)
return
n
;
...
...
@@ -289,5 +290,6 @@ const std::array<SDL_Scancode, 249> KeycodeConverter::code_map = {{
*/
SDL_SCANCODE_UNKNOWN
/* KEY_MICMUTE 248 Mute / unmute the microphone */
}};
}
// namespace ubuntu
}
// namespace anbox
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
src/anbox/
ubuntu
/keycode_converter.h
→
src/anbox/
platform/sdl
/keycode_converter.h
浏览文件 @
2900829d
...
...
@@ -15,17 +15,18 @@
*
*/
#ifndef ANBOX_
UBUNTU
_KEYCODE_CONVERTER_H_
#define ANBOX_
UBUNTU
_KEYCODE_CONVERTER_H_
#ifndef ANBOX_
PLATFORM_SDL
_KEYCODE_CONVERTER_H_
#define ANBOX_
PLATFORM_SDL
_KEYCODE_CONVERTER_H_
#include
<SDL_scancode.h>
#include
"anbox/platform/sdl/sdl_wrapper.h"
#include <cstdint>
#include <array>
namespace
anbox
{
namespace
ubuntu
{
namespace
platform
{
namespace
sdl
{
class
KeycodeConverter
{
public:
static
std
::
uint16_t
convert
(
const
SDL_Scancode
&
scan_code
);
...
...
@@ -33,7 +34,8 @@ class KeycodeConverter {
private:
static
const
std
::
array
<
SDL_Scancode
,
249
>
code_map
;
};
}
// namespace ubuntu
}
// namespace anbox
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
#endif
src/anbox/
ubuntu
/mir_display_connection.cpp
→
src/anbox/
platform/sdl
/mir_display_connection.cpp
浏览文件 @
2900829d
...
...
@@ -14,7 +14,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "anbox/
ubuntu/
mir_display_connection.h"
#include "anbox/
platform/sdl
mir_display_connection.h"
#include "anbox/logger.h"
#include <boost/throw_exception.hpp>
...
...
@@ -43,7 +43,7 @@ static const MirDisplayOutput *find_active_output(
}
namespace
anbox
{
namespace
ubuntu
{
namespace
sdl
{
MirDisplayConnection
::
MirDisplayConnection
()
:
connection_
(
nullptr
),
output_id_
(
-
1
),
...
...
@@ -119,5 +119,5 @@ int MirDisplayConnection::vertical_resolution() const {
int
MirDisplayConnection
::
horizontal_resolution
()
const
{
return
horizontal_resolution_
;
}
}
// namespace
ubuntu
}
// namespace
sdl
}
// namespace anbox
src/anbox/
ubuntu
/mir_display_connection.h
→
src/anbox/
platform/sdl
/mir_display_connection.h
浏览文件 @
2900829d
...
...
@@ -15,8 +15,8 @@
*
*/
#ifndef ANBOX_
UBUNTU
_MIR_DISPLAY_CONNECTION_H_
#define ANBOX_
UBUNTU
_MIR_DISPLAY_CONNECTION_H_
#ifndef ANBOX_
PLATFORM_SDL
_MIR_DISPLAY_CONNECTION_H_
#define ANBOX_
PLATFORM_SDL
_MIR_DISPLAY_CONNECTION_H_
#define MIR_EGL_PLATFORM
...
...
@@ -25,7 +25,7 @@
#include <EGL/egl.h>
namespace
anbox
{
namespace
ubuntu
{
namespace
sdl
{
class
MirDisplayConnection
{
public:
MirDisplayConnection
();
...
...
@@ -46,7 +46,7 @@ class MirDisplayConnection {
int
vertical_resolution_
;
int
horizontal_resolution_
;
};
}
// namespace
ubuntu
}
// namespace
sdl
}
// namespace anbox
#endif
src/anbox/
ubuntu/platform_policy
.cpp
→
src/anbox/
platform/sdl/platform
.cpp
浏览文件 @
2900829d
...
...
@@ -17,13 +17,13 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
#include "anbox/
ubuntu/platform_policy
.h"
#include "anbox/
platform/sdl/platform
.h"
#include "anbox/input/device.h"
#include "anbox/input/manager.h"
#include "anbox/logger.h"
#include "anbox/
ubuntu
/keycode_converter.h"
#include "anbox/
ubuntu
/window.h"
#include "anbox/
ubuntu
/audio_sink.h"
#include "anbox/
platform/sdl
/keycode_converter.h"
#include "anbox/
platform/sdl
/window.h"
#include "anbox/
platform/sdl
/audio_sink.h"
#include "anbox/wm/manager.h"
#include <boost/throw_exception.hpp>
...
...
@@ -33,8 +33,9 @@
#pragma GCC diagnostic pop
namespace
anbox
{
namespace
ubuntu
{
PlatformPolicy
::
PlatformPolicy
(
namespace
platform
{
namespace
sdl
{
Platform
::
Platform
(
const
std
::
shared_ptr
<
input
::
Manager
>
&
input_manager
,
const
graphics
::
Rect
&
static_display_frame
,
bool
single_window
)
...
...
@@ -92,25 +93,25 @@ PlatformPolicy::PlatformPolicy(
keyboard_
->
set_key_bit
(
BTN_MISC
);
keyboard_
->
set_key_bit
(
KEY_OK
);
event_thread_
=
std
::
thread
(
&
Platform
Policy
::
process_events
,
this
);
event_thread_
=
std
::
thread
(
&
Platform
::
process_events
,
this
);
}
Platform
Policy
::~
PlatformPolicy
()
{
Platform
::~
Platform
()
{
if
(
event_thread_running_
)
{
event_thread_running_
=
false
;
event_thread_
.
join
();
}
}
void
Platform
Policy
::
set_renderer
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
)
{
void
Platform
::
set_renderer
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
)
{
renderer_
=
renderer
;
}
void
Platform
Policy
::
set_window_manager
(
const
std
::
shared_ptr
<
wm
::
Manager
>
&
window_manager
)
{
void
Platform
::
set_window_manager
(
const
std
::
shared_ptr
<
wm
::
Manager
>
&
window_manager
)
{
window_manager_
=
window_manager
;
}
void
Platform
Policy
::
process_events
()
{
void
Platform
::
process_events
()
{
event_thread_running_
=
true
;
while
(
event_thread_running_
)
{
...
...
@@ -144,7 +145,7 @@ void PlatformPolicy::process_events() {
}
}
void
Platform
Policy
::
process_input_event
(
const
SDL_Event
&
event
)
{
void
Platform
::
process_input_event
(
const
SDL_Event
&
event
)
{
std
::
vector
<
input
::
Event
>
mouse_events
;
std
::
vector
<
input
::
Event
>
keyboard_events
;
...
...
@@ -216,12 +217,12 @@ void PlatformPolicy::process_input_event(const SDL_Event &event) {
if
(
keyboard_events
.
size
()
>
0
)
keyboard_
->
send_events
(
keyboard_events
);
}
Window
::
Id
Platform
Policy
::
next_window_id
()
{
Window
::
Id
Platform
::
next_window_id
()
{
static
Window
::
Id
next_id
=
0
;
return
next_id
++
;
}
std
::
shared_ptr
<
wm
::
Window
>
Platform
Policy
::
create_window
(
std
::
shared_ptr
<
wm
::
Window
>
Platform
::
create_window
(
const
anbox
::
wm
::
Task
::
Id
&
task
,
const
anbox
::
graphics
::
Rect
&
frame
,
const
std
::
string
&
title
)
{
if
(
!
renderer_
)
{
ERROR
(
"Can't create window without a renderer set"
);
...
...
@@ -234,7 +235,7 @@ std::shared_ptr<wm::Window> PlatformPolicy::create_window(
return
w
;
}
void
Platform
Policy
::
window_deleted
(
const
Window
::
Id
&
id
)
{
void
Platform
::
window_deleted
(
const
Window
::
Id
&
id
)
{
auto
w
=
windows_
.
find
(
id
);
if
(
w
==
windows_
.
end
())
{
WARNING
(
"Got window removed event for unknown window (id %d)"
,
id
);
...
...
@@ -245,7 +246,7 @@ void PlatformPolicy::window_deleted(const Window::Id &id) {
windows_
.
erase
(
w
);
}
void
Platform
Policy
::
window_wants_focus
(
const
Window
::
Id
&
id
)
{
void
Platform
::
window_wants_focus
(
const
Window
::
Id
&
id
)
{
auto
w
=
windows_
.
find
(
id
);
if
(
w
==
windows_
.
end
())
return
;
...
...
@@ -253,7 +254,7 @@ void PlatformPolicy::window_wants_focus(const Window::Id &id) {
window_manager_
->
set_focused_task
(
window
->
task
());
}
void
Platform
Policy
::
window_moved
(
const
Window
::
Id
&
id
,
const
std
::
int32_t
&
x
,
void
Platform
::
window_moved
(
const
Window
::
Id
&
id
,
const
std
::
int32_t
&
x
,
const
std
::
int32_t
&
y
)
{
auto
w
=
windows_
.
find
(
id
);
if
(
w
==
windows_
.
end
())
return
;
...
...
@@ -266,7 +267,7 @@ void PlatformPolicy::window_moved(const Window::Id &id, const std::int32_t &x,
}
}
void
Platform
Policy
::
window_resized
(
const
Window
::
Id
&
id
,
void
Platform
::
window_resized
(
const
Window
::
Id
&
id
,
const
std
::
int32_t
&
width
,
const
std
::
int32_t
&
height
)
{
auto
w
=
windows_
.
find
(
id
);
...
...
@@ -284,13 +285,13 @@ void PlatformPolicy::window_resized(const Window::Id &id,
}
}
void
Platform
Policy
::
set_clipboard_data
(
const
ClipboardData
&
data
)
{
void
Platform
::
set_clipboard_data
(
const
ClipboardData
&
data
)
{
if
(
data
.
text
.
empty
())
return
;
SDL_SetClipboardText
(
data
.
text
.
c_str
());
}
Platform
Policy
::
ClipboardData
PlatformPolicy
::
get_clipboard_data
()
{
Platform
::
ClipboardData
Platform
::
get_clipboard_data
()
{
if
(
!
SDL_HasClipboardText
())
return
ClipboardData
{};
...
...
@@ -303,13 +304,14 @@ PlatformPolicy::ClipboardData PlatformPolicy::get_clipboard_data() {
return
data
;
}
std
::
shared_ptr
<
audio
::
Sink
>
Platform
Policy
::
create_audio_sink
()
{
std
::
shared_ptr
<
audio
::
Sink
>
Platform
::
create_audio_sink
()
{
return
std
::
make_shared
<
AudioSink
>
();
}
std
::
shared_ptr
<
audio
::
Source
>
Platform
Policy
::
create_audio_source
()
{
std
::
shared_ptr
<
audio
::
Source
>
Platform
::
create_audio_source
()
{
ERROR
(
"Not implemented"
);
return
nullptr
;
}
}
// namespace wm
}
// namespace anbox
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
src/anbox/
ubuntu/platform_policy
.h
→
src/anbox/
platform/sdl/platform
.h
浏览文件 @
2900829d
...
...
@@ -15,19 +15,17 @@
*
*/
#ifndef ANBOX_UBUNTU_PLATFORM_POLICY_H_
#define ANBOX_UBUNTU_PLATFORM_POLICY_H_
#include "anbox/ubuntu/window.h"
#include "anbox/platform/policy.h"
#ifndef ANBOX_PLATFORM_SDL_PLATFORM_H_
#define ANBOX_PLATFORM_SDL_PLATFORM_H_
#include "anbox/platform/sdl/window.h"
#include "anbox/platform/sdl/sdl_wrapper.h"
#include "anbox/platform/base_platform.h"
#include "anbox/graphics/emugl/DisplayManager.h"
#include <map>
#include <thread>
#include <SDL.h>
class
Renderer
;
namespace
anbox
{
...
...
@@ -38,15 +36,16 @@ class Manager;
namespace
wm
{
class
Manager
;
}
// namespace wm
namespace
ubuntu
{
class
PlatformPolicy
:
public
std
::
enable_shared_from_this
<
PlatformPolicy
>
,
public
platform
::
Policy
,
namespace
platform
{
namespace
sdl
{
class
Platform
:
public
std
::
enable_shared_from_this
<
Platform
>
,
public
platform
::
BasePlatform
,
public
Window
::
Observer
{
public:
Platform
Policy
(
const
std
::
shared_ptr
<
input
::
Manager
>
&
input_manager
,
Platform
(
const
std
::
shared_ptr
<
input
::
Manager
>
&
input_manager
,
const
graphics
::
Rect
&
static_display_frame
=
graphics
::
Rect
::
Invalid
,
bool
single_window
=
false
);
~
Platform
Policy
();
~
Platform
();
std
::
shared_ptr
<
wm
::
Window
>
create_window
(
const
anbox
::
wm
::
Task
::
Id
&
task
,
...
...
@@ -60,8 +59,8 @@ class PlatformPolicy : public std::enable_shared_from_this<PlatformPolicy>,
void
window_resized
(
const
Window
::
Id
&
id
,
const
std
::
int32_t
&
width
,
const
std
::
int32_t
&
height
)
override
;
void
set_renderer
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
);
void
set_window_manager
(
const
std
::
shared_ptr
<
wm
::
Manager
>
&
window_manager
);
void
set_renderer
(
const
std
::
shared_ptr
<
Renderer
>
&
renderer
)
override
;
void
set_window_manager
(
const
std
::
shared_ptr
<
wm
::
Manager
>
&
window_manager
)
override
;
void
set_clipboard_data
(
const
ClipboardData
&
data
)
override
;
ClipboardData
get_clipboard_data
()
override
;
...
...
@@ -89,7 +88,8 @@ class PlatformPolicy : public std::enable_shared_from_this<PlatformPolicy>,
bool
window_size_immutable_
=
false
;
bool
single_window_
=
false
;
};
}
// namespace wm
}
// namespace anbox
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
#endif
src/anbox/platform/
policy.cpp
→
src/anbox/platform/
sdl/sdl_wrapper.h
浏览文件 @
2900829d
...
...
@@ -15,10 +15,15 @@
*
*/
#include "anbox/platform/policy.h"
#ifndef ANBOX_PLATFORM_SDL_WRAPPER_H_
#define ANBOX_PLATFORM_SDL_WRAPPER_H_
namespace
anbox
{
namespace
platform
{
Policy
::~
Policy
()
{}
}
// namespace wm
}
// namespace anbox
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
#include <SDL2/SDL.h>
#include <SDL2/SDL_audio.h>
#include <SDL2/SDL_syswm.h>
#include <SDL2/SDL_scancode.h>
#pragma GCC diagnostic pop
#endif
src/anbox/
ubuntu
/window.cpp
→
src/anbox/
platform/sdl
/window.cpp
浏览文件 @
2900829d
...
...
@@ -15,9 +15,7 @@
*
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
#include "anbox/ubuntu/window.h"
#include "anbox/platform/sdl/window.h"
#include "anbox/logger.h"
#include "anbox/wm/window_state.h"
...
...
@@ -27,11 +25,9 @@
#include <mir_toolkit/mir_client_library.h>
#endif
#include <SDL_syswm.h>
#pragma GCC diagnostic pop
namespace
anbox
{
namespace
ubuntu
{
namespace
platform
{
namespace
sdl
{
Window
::
Id
Window
::
Invalid
{
-
1
};
Window
::
Observer
::~
Observer
()
{}
...
...
@@ -129,5 +125,6 @@ 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_
);
}
}
// namespace bridge
}
// namespace anbox
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
src/anbox/
ubuntu
/window.h
→
src/anbox/
platform/sdl
/window.h
浏览文件 @
2900829d
...
...
@@ -15,22 +15,22 @@
*
*/
#ifndef ANBOX_
UBUNTU
_WINDOW_H_
#define ANBOX_
UBUNTU
_WINDOW_H_
#ifndef ANBOX_
PLATFORM_SDL
_WINDOW_H_
#define ANBOX_
PLATFORM_SDL
_WINDOW_H_
#include "anbox/wm/window.h"
#include "anbox/platform/sdl/sdl_wrapper.h"
#include <EGL/egl.h>
#include <memory>
#include <vector>
#include <SDL.h>
class
Renderer
;
namespace
anbox
{
namespace
ubuntu
{
namespace
platform
{
namespace
sdl
{
class
Window
:
public
std
::
enable_shared_from_this
<
Window
>
,
public
wm
::
Window
{
public:
typedef
std
::
int32_t
Id
;
...
...
@@ -68,7 +68,8 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
EGLNativeWindowType
native_window_
;
SDL_Window
*
window_
;
};
}
// namespace bridge
}
// namespace anbox
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
#endif
src/anbox/wm/multi_window_manager.cpp
浏览文件 @
2900829d
...
...
@@ -17,7 +17,7 @@
#include "anbox/application/database.h"
#include "anbox/wm/multi_window_manager.h"
#include "anbox/platform/
policy
.h"
#include "anbox/platform/
base_platform
.h"
#include "anbox/bridge/android_api_stub.h"
#include "anbox/logger.h"
...
...
@@ -25,10 +25,10 @@
namespace
anbox
{
namespace
wm
{
MultiWindowManager
::
MultiWindowManager
(
const
std
::
weak_ptr
<
platform
::
Policy
>
&
policy
,
MultiWindowManager
::
MultiWindowManager
(
const
std
::
weak_ptr
<
platform
::
BasePlatform
>
&
platform
,
const
std
::
shared_ptr
<
bridge
::
AndroidApiStub
>
&
android_api_stub
,
const
std
::
shared_ptr
<
application
::
Database
>
&
app_db
)
:
platform_
policy_
(
policy
),
android_api_stub_
(
android_api_stub
),
app_db_
(
app_db
)
{}
:
platform_
(
platform
),
android_api_stub_
(
android_api_stub
),
app_db_
(
app_db
)
{}
MultiWindowManager
::~
MultiWindowManager
()
{}
...
...
@@ -67,7 +67,7 @@ void MultiWindowManager::apply_window_state_update(const WindowState::List &upda
if
(
app
.
valid
())
title
=
app
.
name
;
if
(
auto
p
=
platform_
policy_
.
lock
())
{
if
(
auto
p
=
platform_
.
lock
())
{
auto
w
=
p
->
create_window
(
window
.
task
(),
window
.
frame
(),
title
);
if
(
w
)
{
w
->
attach
();
...
...
src/anbox/wm/multi_window_manager.h
浏览文件 @
2900829d
...
...
@@ -32,12 +32,12 @@ namespace bridge {
class
AndroidApiStub
;
}
// namespace bridge
namespace
platform
{
class
Policy
;
class
BasePlatform
;
}
// namespace platform
namespace
wm
{
class
MultiWindowManager
:
public
Manager
{
public:
MultiWindowManager
(
const
std
::
weak_ptr
<
platform
::
Policy
>
&
policy
,
MultiWindowManager
(
const
std
::
weak_ptr
<
platform
::
BasePlatform
>
&
platform
,
const
std
::
shared_ptr
<
bridge
::
AndroidApiStub
>
&
android_api_stub
,
const
std
::
shared_ptr
<
application
::
Database
>
&
app_db
);
~
MultiWindowManager
();
...
...
@@ -53,7 +53,7 @@ class MultiWindowManager : public Manager {
private:
std
::
mutex
mutex_
;
std
::
weak_ptr
<
platform
::
Policy
>
platform_policy
_
;
std
::
weak_ptr
<
platform
::
BasePlatform
>
platform
_
;
std
::
shared_ptr
<
bridge
::
AndroidApiStub
>
android_api_stub_
;
std
::
shared_ptr
<
application
::
Database
>
app_db_
;
std
::
map
<
Task
::
Id
,
std
::
shared_ptr
<
Window
>>
windows_
;
...
...
src/anbox/wm/single_window_manager.cpp
浏览文件 @
2900829d
...
...
@@ -16,7 +16,7 @@
*/
#include "anbox/wm/single_window_manager.h"
#include "anbox/platform/
policy
.h"
#include "anbox/platform/
base_platform
.h"
#include "anbox/logger.h"
#include <algorithm>
...
...
@@ -26,15 +26,15 @@
namespace
anbox
{
namespace
wm
{
SingleWindowManager
::
SingleWindowManager
(
const
std
::
weak_ptr
<
platform
::
Policy
>
&
policy
,
SingleWindowManager
::
SingleWindowManager
(
const
std
::
weak_ptr
<
platform
::
BasePlatform
>
&
platform
,
const
graphics
::
Rect
&
window_size
,
const
std
::
shared_ptr
<
application
::
Database
>
&
app_db
)
:
platform_
policy_
(
policy
),
window_size_
(
window_size
),
app_db_
(
app_db
)
{}
:
platform_
(
platform
),
window_size_
(
window_size
),
app_db_
(
app_db
)
{}
SingleWindowManager
::~
SingleWindowManager
()
{}
void
SingleWindowManager
::
setup
()
{
if
(
auto
p
=
platform_
policy_
.
lock
())
{
if
(
auto
p
=
platform_
.
lock
())
{
window_
=
p
->
create_window
(
0
,
window_size_
,
"Anbox - Android in a Box"
);
if
(
!
window_
->
attach
())
WARNING
(
"Failed to attach window to renderer"
);
...
...
src/anbox/wm/single_window_manager.h
浏览文件 @
2900829d
...
...
@@ -29,13 +29,13 @@ namespace application {
class
Database
;
}
// namespace application
namespace
platform
{
class
Policy
;
class
BasePlatform
;
}
// namespace platform
namespace
wm
{
class
Window
;
class
SingleWindowManager
:
public
Manager
{
public:
SingleWindowManager
(
const
std
::
weak_ptr
<
platform
::
Policy
>
&
policy
,
SingleWindowManager
(
const
std
::
weak_ptr
<
platform
::
BasePlatform
>
&
platform
,
const
graphics
::
Rect
&
window_size
,
const
std
::
shared_ptr
<
application
::
Database
>
&
app_db
);
~
SingleWindowManager
();
...
...
@@ -52,7 +52,7 @@ class SingleWindowManager : public Manager {
void
remove_task
(
const
Task
::
Id
&
task
)
override
;
private:
std
::
weak_ptr
<
platform
::
Policy
>
platform_policy
_
;
std
::
weak_ptr
<
platform
::
BasePlatform
>
platform
_
;
graphics
::
Rect
window_size_
;
std
::
shared_ptr
<
application
::
Database
>
app_db_
;
std
::
shared_ptr
<
Window
>
window_
;
...
...
tests/anbox/graphics/layer_composer_tests.cpp
浏览文件 @
2900829d
...
...
@@ -21,7 +21,7 @@
#include <gtest/gtest.h>
#include "anbox/application/database.h"
#include "anbox/platform/
default_policy
.h"
#include "anbox/platform/
base_platform
.h"
#include "anbox/wm/multi_window_manager.h"
#include "anbox/wm/window_state.h"
...
...
@@ -45,9 +45,9 @@ TEST(LayerComposer, FindsNoSuitableWindowForLayer) {
// The default policy will create a dumb window instance when requested
// from the manager.
auto
platform
_policy
=
std
::
make_shared
<
platform
::
DefaultPolicy
>
();
auto
platform
=
platform
::
create
();
auto
app_db
=
std
::
make_shared
<
application
::
Database
>
();
auto
wm
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
platform
_policy
,
nullptr
,
app_db
);
auto
wm
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
platform
,
nullptr
,
app_db
);
auto
single_window
=
wm
::
WindowState
{
wm
::
Display
::
Id
{
1
},
...
...
@@ -79,9 +79,9 @@ TEST(LayerComposer, MapsLayersToWindows) {
// The default policy will create a dumb window instance when requested
// from the manager.
auto
platform
_policy
=
std
::
make_shared
<
platform
::
DefaultPolicy
>
();
auto
platform
=
platform
::
create
();
auto
app_db
=
std
::
make_shared
<
application
::
Database
>
();
auto
wm
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
platform
_policy
,
nullptr
,
app_db
);
auto
wm
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
platform
,
nullptr
,
app_db
);
auto
first_window
=
wm
::
WindowState
{
wm
::
Display
::
Id
{
1
},
...
...
@@ -139,9 +139,9 @@ TEST(LayerComposer, WindowPartiallyOffscreen) {
// The default policy will create a dumb window instance when requested
// from the manager.
auto
platform
_policy
=
std
::
make_shared
<
platform
::
DefaultPolicy
>
();
auto
platform
=
platform
::
create
();
auto
app_db
=
std
::
make_shared
<
application
::
Database
>
();
auto
wm
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
platform
_policy
,
nullptr
,
app_db
);
auto
wm
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
platform
,
nullptr
,
app_db
);
auto
window
=
wm
::
WindowState
{
wm
::
Display
::
Id
{
1
},
...
...
@@ -184,9 +184,9 @@ TEST(LayerComposer, PopupShouldNotCauseWindowLayerOffset) {
// The default policy will create a dumb window instance when requested
// from the manager.
auto
platform
_policy
=
std
::
make_shared
<
platform
::
DefaultPolicy
>
();
auto
platform
=
platform
::
create
();
auto
app_db
=
std
::
make_shared
<
application
::
Database
>
();
auto
wm
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
platform
_policy
,
nullptr
,
app_db
);
auto
wm
=
std
::
make_shared
<
wm
::
MultiWindowManager
>
(
platform
,
nullptr
,
app_db
);
auto
window
=
wm
::
WindowState
{
wm
::
Display
::
Id
{
1
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录