Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
33696837
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 搜索 >>
提交
33696837
编写于
8月 06, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
8月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
!75 platform: fix modstate problem
Merge pull request !75 from Night/master
上级
a5933f40
52c75934
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
3 deletion
+28
-3
src/anbox/platform/sdl/platform.cpp
src/anbox/platform/sdl/platform.cpp
+23
-1
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
+4
-2
未找到文件。
src/anbox/platform/sdl/platform.cpp
浏览文件 @
33696837
...
...
@@ -391,6 +391,12 @@ void Platform::process_input_event(const SDL_Event &event) {
input_key_event
(
SDL_SCANCODE_AC_BACK
,
0
);
break
;
}
if
(
code
==
KEY_CAPSLOCK
)
{
key_mod_
^=
KMOD_CAPS
;
}
if
(
code
==
KEY_NUMLOCK
)
{
key_mod_
^=
KMOD_NUM
;
}
keyboard_events
.
push_back
({
EV_KEY
,
code
,
0
});
break
;
}
...
...
@@ -574,7 +580,23 @@ void Platform::window_deleted(const Window::Id &id) {
void
Platform
::
window_wants_focus
(
const
Window
::
Id
&
id
)
{
auto
w
=
windows_
.
find
(
id
);
if
(
w
==
windows_
.
end
())
return
;
if
(
w
==
windows_
.
end
())
{
return
;
}
// if window's modstate is not the same as android, send
// capslock or numlock message to android to change it.
auto
mod_state
=
SDL_GetModState
();
if
((
key_mod_
&
KMOD_NUM
)
!=
(
mod_state
&
KMOD_NUM
))
{
input_key_event
(
SDL_SCANCODE_NUMLOCKCLEAR
,
1
);
input_key_event
(
SDL_SCANCODE_NUMLOCKCLEAR
,
0
);
key_mod_
^=
KMOD_NUM
;
}
if
((
key_mod_
&
KMOD_CAPS
)
!=
(
mod_state
&
KMOD_CAPS
))
{
input_key_event
(
SDL_SCANCODE_CAPSLOCK
,
1
);
input_key_event
(
SDL_SCANCODE_CAPSLOCK
,
0
);
key_mod_
^=
KMOD_CAPS
;
}
if
(
auto
window
=
w
->
second
.
lock
())
{
focused_sdl_window_id_
=
window
->
window_id
();
...
...
src/anbox/platform/sdl/platform.h
浏览文件 @
33696837
...
...
@@ -125,6 +125,7 @@ class Platform : public std::enable_shared_from_this<Platform>,
void
push_finger_motion
(
int
x
,
int
y
,
int
finger_id
,
std
::
vector
<
input
::
Event
>
&
touch_events
);
int
user_window_event
=
0
;
std
::
uint32_t
key_mod_
{
KMOD_NONE
};
};
}
// namespace sdl
}
// namespace platform
...
...
src/anbox/platform/sdl/window.cpp
浏览文件 @
33696837
...
...
@@ -57,7 +57,7 @@ const std::map<std::string, Window::mini_size>Window::custom_window_map = {
{
"微信"
,
{
WX_MINI_WIDTH
,
MINI_HEIGHT
}}
};
Window
::
Id
Window
::
Invalid
{
-
1
};
Window
::
Id
Window
::
Invalid
{
-
1
};
Window
::
Observer
::~
Observer
()
{}
...
...
@@ -294,7 +294,9 @@ void Window::switch_window_state() {
void
Window
::
process_event
(
const
SDL_Event
&
event
)
{
switch
(
event
.
window
.
event
)
{
case
SDL_WINDOWEVENT_FOCUS_GAINED
:
if
(
observer_
)
observer_
->
window_wants_focus
(
id_
);
if
(
observer_
)
{
observer_
->
window_wants_focus
(
id_
);
}
break
;
case
SDL_WINDOWEVENT_FOCUS_LOST
:
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录