Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
6e37d1f2
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看板
提交
6e37d1f2
编写于
8月 11, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
8月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
!74 launch:click the desktop icon to restore the minimized application
Merge pull request !74 from yu_qinfei/master
上级
058eaada
47b346ad
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
101 addition
and
1 deletion
+101
-1
external/libSDL/SDL_fix_Restore.patch
external/libSDL/SDL_fix_Restore.patch
+38
-0
src/anbox/bridge/android_api_stub.cpp
src/anbox/bridge/android_api_stub.cpp
+8
-1
src/anbox/bridge/android_api_stub.h
src/anbox/bridge/android_api_stub.h
+5
-0
src/anbox/cmds/session_manager.cpp
src/anbox/cmds/session_manager.cpp
+1
-0
src/anbox/platform/base_platform.h
src/anbox/platform/base_platform.h
+1
-0
src/anbox/platform/null/platform.cpp
src/anbox/platform/null/platform.cpp
+4
-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
+14
-0
src/anbox/platform/sdl/platform.h
src/anbox/platform/sdl/platform.h
+1
-0
src/anbox/platform/sdl/window.cpp
src/anbox/platform/sdl/window.cpp
+9
-0
src/anbox/platform/sdl/window.h
src/anbox/platform/sdl/window.h
+2
-0
src/anbox/wm/manager.h
src/anbox/wm/manager.h
+1
-0
src/anbox/wm/multi_window_manager.cpp
src/anbox/wm/multi_window_manager.cpp
+9
-0
src/anbox/wm/multi_window_manager.h
src/anbox/wm/multi_window_manager.h
+1
-0
src/anbox/wm/single_window_manager.cpp
src/anbox/wm/single_window_manager.cpp
+5
-0
src/anbox/wm/single_window_manager.h
src/anbox/wm/single_window_manager.h
+1
-0
未找到文件。
external/libSDL/SDL_fix_Restore.patch
0 → 100644
浏览文件 @
6e37d1f2
diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c
index 1670841..18e2135 100644
--- a/src/events/SDL_windowevents.c
+++ b/src/events/SDL_windowevents.c
@@ -127,7 +127,6 @@
SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
if (window->flags & SDL_WINDOW_MINIMIZED) {
return 0;
}
- window->flags &= ~SDL_WINDOW_MAXIMIZED;
window->flags |= SDL_WINDOW_MINIMIZED;
SDL_OnWindowMinimized(window);
break;
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 0a254b0..e87ff2f 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -28,6 +28,7 @@
#include "../SDL_pixels_c.h"
#include "../../events/SDL_keyboard_c.h"
#include "../../events/SDL_mouse_c.h"
+#include <sys/syscall.h>
#include "SDL_x11video.h"
#include "SDL_x11mouse.h"
@@ -1166,7 +1167,12 @@
X11_MinimizeWindow(_THIS, SDL_Window * window)
void
X11_RestoreWindow(_THIS, SDL_Window * window)
{
- SetWindowMaximized(_this, window, SDL_FALSE);
+ if ((window->flags & SDL_WINDOW_MAXIMIZED) && (window->flags & SDL_WINDOW_MINIMIZED)) {
+ SetWindowMaximized(_this, window, SDL_TRUE);
+ } else {
+ SetWindowMaximized(_this, window, SDL_FALSE);
+ }
+ window->flags &= ~SDL_WINDOW_MINIMIZED;
X11_ShowWindow(_this, window);
SetWindowActive(_this, window);
}
src/anbox/bridge/android_api_stub.cpp
浏览文件 @
6e37d1f2
...
...
@@ -15,13 +15,13 @@
*
*/
#include "anbox/platform/base_platform.h"
#include "anbox/bridge/android_api_stub.h"
#include "anbox/system_configuration.h"
#include "anbox/logger.h"
#include "anbox/rpc/channel.h"
#include "anbox/utils.h"
#include "anbox/wm/stack.h"
#include "anbox_bridge.pb.h"
#include "anbox_rpc.pb.h"
...
...
@@ -106,6 +106,9 @@ void AndroidApiStub::launch(const android::Intent &intent,
*
c
=
category
;
}
std
::
string
package_name
=
intent
.
package
;
platform_
->
restore_app
(
package_name
);
channel_
->
call_method
(
"launch_application"
,
&
message
,
c
->
response
.
get
(),
google
::
protobuf
::
NewCallback
(
this
,
&
AndroidApiStub
::
application_launched
,
...
...
@@ -223,5 +226,9 @@ void AndroidApiStub::task_resized(Request<protobuf::rpc::Void> *request) {
(
void
)
request
;
resize_task_handle_
.
result_received
();
}
void
AndroidApiStub
::
set_platform
(
const
std
::
shared_ptr
<
platform
::
BasePlatform
>&
base_platform
)
{
platform_
=
base_platform
;
}
}
// namespace bridge
}
// namespace anbox
src/anbox/bridge/android_api_stub.h
浏览文件 @
6e37d1f2
...
...
@@ -34,6 +34,9 @@ class Void;
namespace
rpc
{
class
Channel
;
}
// namespace rpc
namespace
platform
{
class
Platform
;
}
// namespace platform
namespace
bridge
{
class
AndroidApiStub
:
public
anbox
::
application
::
Manager
{
public:
...
...
@@ -48,6 +51,7 @@ class AndroidApiStub : public anbox::application::Manager {
void
resize_task
(
const
std
::
int32_t
&
id
,
const
anbox
::
graphics
::
Rect
&
rect
,
const
std
::
int32_t
&
resize_mode
);
void
set_platform
(
const
std
::
shared_ptr
<
platform
::
BasePlatform
>&
base_platform
);
void
launch
(
const
android
::
Intent
&
intent
,
const
graphics
::
Rect
&
launch_bounds
=
graphics
::
Rect
::
Invalid
,
const
wm
::
Stack
::
Id
&
stack
=
wm
::
Stack
::
Id
::
Default
)
override
;
...
...
@@ -70,6 +74,7 @@ class AndroidApiStub : public anbox::application::Manager {
void
task_resized
(
Request
<
protobuf
::
rpc
::
Void
>
*
request
);
mutable
std
::
mutex
mutex_
;
std
::
shared_ptr
<
platform
::
BasePlatform
>
platform_
;
std
::
shared_ptr
<
rpc
::
Channel
>
channel_
;
common
::
WaitHandle
launch_wait_handle_
;
common
::
WaitHandle
set_focused_task_handle_
;
...
...
src/anbox/cmds/session_manager.cpp
浏览文件 @
6e37d1f2
...
...
@@ -197,6 +197,7 @@ anbox::cmds::SessionManager::SessionManager()
platform
->
set_window_manager
(
window_manager
);
platform
->
set_renderer
(
gl_server
->
renderer
());
window_manager
->
setup
();
android_api_stub
->
set_platform
(
platform
);
auto
app_manager
=
std
::
static_pointer_cast
<
application
::
Manager
>
(
android_api_stub
);
if
(
!
using_single_window
)
{
...
...
src/anbox/platform/base_platform.h
浏览文件 @
6e37d1f2
...
...
@@ -73,6 +73,7 @@ class BasePlatform {
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
;
virtual
bool
restore_app
(
const
std
::
string
&
package_name
)
=
0
;
virtual
bool
supports_multi_window
()
const
=
0
;
virtual
int
get_user_window_event
()
const
=
0
;
virtual
std
::
string
ime_socket_file
()
const
=
0
;
...
...
src/anbox/platform/null/platform.cpp
浏览文件 @
6e37d1f2
...
...
@@ -79,6 +79,10 @@ int NullPlatform::get_user_window_event() const {
return
-
1
;
}
bool
NullPlatform
::
restore_app
(
const
std
::
string
&
package_name
)
{
(
void
)
package_name
;
}
std
::
string
NullPlatform
::
ime_socket_file
()
const
{
ERROR
(
"Not implemented"
);
return
""
;
...
...
src/anbox/platform/null/platform.h
浏览文件 @
6e37d1f2
...
...
@@ -39,6 +39,7 @@ class NullPlatform : public BasePlatform {
bool
supports_multi_window
()
const
override
;
int
get_user_window_event
()
const
override
;
std
::
string
ime_socket_file
()
const
override
;
bool
restore_app
(
const
std
::
string
&
package_name
)
override
;
};
}
// namespace wm
}
// namespace anbox
...
...
src/anbox/platform/sdl/platform.cpp
浏览文件 @
6e37d1f2
...
...
@@ -672,6 +672,20 @@ int Platform::get_user_window_event() const {
}
return
user_window_event
;
}
bool
Platform
::
restore_app
(
const
std
::
string
&
package_name
)
{
auto
title
=
window_manager_
->
get_title
(
package_name
);
for
(
auto
&
iter
:
windows_
)
{
if
(
auto
w
=
iter
.
second
.
lock
())
{
if
(
w
->
title
()
==
title
)
{
w
->
restore_window
();
DEBUG
(
"ready to restore window"
);
return
true
;
}
}
}
return
false
;
}
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
src/anbox/platform/sdl/platform.h
浏览文件 @
6e37d1f2
...
...
@@ -52,6 +52,7 @@ class Platform : public std::enable_shared_from_this<Platform>,
const
anbox
::
graphics
::
Rect
&
frame
,
const
std
::
string
&
title
)
override
;
bool
restore_app
(
const
std
::
string
&
package_name
)
override
;
void
input_key_event
(
const
SDL_Scancode
&
scan_code
,
std
::
int32_t
down_or_up
)
override
;
void
window_deleted
(
const
Window
::
Id
&
id
)
override
;
void
window_wants_focus
(
const
Window
::
Id
&
id
)
override
;
...
...
src/anbox/platform/sdl/window.cpp
浏览文件 @
6e37d1f2
...
...
@@ -371,6 +371,15 @@ void Window::update_state(const wm::WindowState::List &states) {
update_frame
(
rect
);
}
}
void
Window
::
restore_window
()
{
SDL_ShowWindow
(
window_
);
SDL_RaiseWindow
(
window_
);
auto
flags
=
SDL_GetWindowFlags
(
window_
);
if
(
flags
&
SDL_WINDOW_MINIMIZED
)
{
SDL_RestoreWindow
(
window_
);
}
}
}
// namespace sdl
}
// namespace platform
}
// namespace anbox
src/anbox/platform/sdl/window.h
浏览文件 @
6e37d1f2
...
...
@@ -77,6 +77,8 @@ class Window : public std::enable_shared_from_this<Window>, public wm::Window {
void
update_state
(
const
wm
::
WindowState
::
List
&
states
)
override
;
bool
check_db_clicked
(
int
x
,
int
y
);
void
restore_window
();
Id
id
()
const
;
std
::
uint32_t
window_id
()
const
;
Uint32
GetWindowFlags
(){
return
SDL_GetWindowFlags
(
window_
);}
...
...
src/anbox/wm/manager.h
浏览文件 @
6e37d1f2
...
...
@@ -42,6 +42,7 @@ class Manager {
virtual
void
insert_task
(
const
Task
::
Id
&
task
,
std
::
shared_ptr
<
wm
::
Window
>
pt
)
=
0
;
virtual
void
erase_task
(
const
Task
::
Id
&
task
)
=
0
;
virtual
std
::
string
get_title
(
const
std
::
string
&
package_name
)
=
0
;
// FIXME only applies for the multi-window case
virtual
std
::
shared_ptr
<
Window
>
find_window_for_task
(
const
Task
::
Id
&
task
)
=
0
;
};
...
...
src/anbox/wm/multi_window_manager.cpp
浏览文件 @
6e37d1f2
...
...
@@ -141,5 +141,14 @@ void MultiWindowManager::erase_task(const Task::Id &task) {
windows_
.
erase
(
it
);
}
}
std
::
string
MultiWindowManager
::
get_title
(
const
std
::
string
&
package_name
)
{
auto
app
=
app_db_
->
find_by_package
(
package_name
);
if
(
app
.
valid
())
{
return
app
.
name
;
}
else
{
return
package_name
;
}
}
}
// namespace wm
}
// namespace anbox
src/anbox/wm/multi_window_manager.h
浏览文件 @
6e37d1f2
...
...
@@ -54,6 +54,7 @@ class MultiWindowManager : public Manager {
void
insert_task
(
const
Task
::
Id
&
task
,
std
::
shared_ptr
<
wm
::
Window
>
pt
)
override
;
void
erase_task
(
const
Task
::
Id
&
task
)
override
;
std
::
string
get_title
(
const
std
::
string
&
package_name
)
override
;
private:
std
::
mutex
mutex_
;
std
::
weak_ptr
<
platform
::
BasePlatform
>
platform_
;
...
...
src/anbox/wm/single_window_manager.cpp
浏览文件 @
6e37d1f2
...
...
@@ -84,5 +84,10 @@ void SingleWindowManager::insert_task(const Task::Id &task, std::shared_ptr<wm::
void
SingleWindowManager
::
erase_task
(
const
Task
::
Id
&
task
)
{
(
void
)
task
;
}
std
::
string
SingleWindowManager
::
get_title
(
const
std
::
string
&
package_name
)
{
(
void
)
package_name
;
return
""
;
}
}
// namespace wm
}
// namespace anbox
src/anbox/wm/single_window_manager.h
浏览文件 @
6e37d1f2
...
...
@@ -52,6 +52,7 @@ class SingleWindowManager : public Manager {
void
remove_task
(
const
Task
::
Id
&
task
)
override
;
void
insert_task
(
const
Task
::
Id
&
task
,
std
::
shared_ptr
<
wm
::
Window
>
pt
)
override
;
void
erase_task
(
const
Task
::
Id
&
task
)
override
;
std
::
string
get_title
(
const
std
::
string
&
package_name
)
override
;
private:
std
::
weak_ptr
<
platform
::
BasePlatform
>
platform_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录