Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
b90cdf43
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,发现更多精彩内容 >>
提交
b90cdf43
编写于
6月 30, 2016
作者:
S
Simon Fels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Justify pointer input device support
Currently not working as Unity8 does not provide pointer input events yet.
上级
a0662883
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
47 addition
and
38 deletion
+47
-38
src/anbox/input/device.h
src/anbox/input/device.h
+6
-6
src/anbox/ubuntu/window.cpp
src/anbox/ubuntu/window.cpp
+37
-32
src/anbox/ubuntu/window.h
src/anbox/ubuntu/window.h
+4
-0
未找到文件。
src/anbox/input/device.h
浏览文件 @
b90cdf43
...
...
@@ -29,6 +29,12 @@
namespace
anbox
{
namespace
input
{
struct
Event
{
std
::
uint16_t
type
;
std
::
uint16_t
code
;
std
::
int32_t
value
;
};
class
Device
:
public
std
::
enable_shared_from_this
<
Device
>
{
public:
static
std
::
shared_ptr
<
Device
>
create
(
const
std
::
string
&
path
,
const
std
::
shared_ptr
<
Runtime
>
&
runtime
);
...
...
@@ -36,12 +42,6 @@ public:
Device
();
~
Device
();
struct
Event
{
std
::
uint16_t
type
;
std
::
uint16_t
code
;
std
::
int32_t
value
;
};
void
send_events
(
const
std
::
vector
<
Event
>
&
events
);
void
send_event
(
const
std
::
uint16_t
&
code
,
const
std
::
uint16_t
&
event
,
const
std
::
int32_t
&
value
);
...
...
src/anbox/ubuntu/window.cpp
浏览文件 @
b90cdf43
...
...
@@ -136,15 +136,15 @@ Window::Window(const std::shared_ptr<MirDisplayConnection> &display,
pointer_
->
set_driver_version
(
1
);
pointer_
->
set_input_id
({
BUS_VIRTUAL
,
1
,
1
,
1
});
pointer_
->
set_physical_location
(
"none"
);
pointer_
->
set_key_bit
(
BTN_MOUSE
);
pointer_
->
set_key_bit
(
BTN_LEFT
);
pointer_
->
set_key_bit
(
BTN_RIGHT
);
pointer_
->
set_key_bit
(
BTN_MIDDLE
);
pointer_
->
set_key_bit
(
BTN_RIGHT
);
pointer_
->
set_rel_bit
(
REL_X
);
pointer_
->
set_rel_bit
(
REL_Y
);
pointer_
->
set_rel_bit
(
REL_HWHEEL
);
pointer_
->
set_rel_bit
(
REL_WHEEL
);
pointer_
->
set_abs_bit
(
ABS_X
);
pointer_
->
set_abs_bit
(
ABS_Y
);
pointer_
->
set_prop_bit
(
INPUT_PROP_POINTER
);
}
Window
::~
Window
()
{
...
...
@@ -163,7 +163,7 @@ void Window::handle_touch_event(MirTouchEvent const* touch_event) {
const
auto
touch_major
=
mir_touch_event_axis_value
(
touch_event
,
n
,
mir_touch_axis_touch_major
);
const
auto
touch_minor
=
mir_touch_event_axis_value
(
touch_event
,
n
,
mir_touch_axis_touch_minor
);
std
::
vector
<
input
::
Device
::
Event
>
events
;
std
::
vector
<
input
::
Event
>
events
;
switch
(
mir_touch_event_action
(
touch_event
,
n
))
{
case
mir_touch_action_up
:
...
...
@@ -200,8 +200,36 @@ void Window::handle_touch_event(MirTouchEvent const* touch_event) {
}
}
void
Window
::
handle_pointer_button_event
(
std
::
vector
<
input
::
Event
>
&
events
,
MirPointerEvent
const
*
pointer_event
,
bool
pressed
)
{
static
uint32_t
old_button_states
=
0
;
uint32_t
new_button_states
=
mir_pointer_event_buttons
(
pointer_event
);
MirPointerButton
button_state
=
mir_pointer_button_primary
;
button_state
=
static_cast
<
MirPointerButton
>
(
new_button_states
^
old_button_states
);
std
::
uint16_t
button
;
switch
(
button_state
)
{
case
mir_pointer_button_primary
:
button
=
BTN_LEFT
;
break
;
case
mir_pointer_button_secondary
:
button
=
BTN_RIGHT
;
break
;
case
mir_pointer_button_tertiary
:
button
=
BTN_MIDDLE
;
break
;
default:
break
;
}
events
.
push_back
({
EV_KEY
,
button
,
pressed
?
1
:
0
});
events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
}
void
Window
::
handle_pointer_event
(
MirPointerEvent
const
*
pointer_event
)
{
std
::
vector
<
input
::
Device
::
Event
>
events
;
std
::
vector
<
input
::
Event
>
events
;
static
MirPointerButtons
button_state
=
0
;
const
float
x
=
mir_pointer_event_axis_value
(
pointer_event
,
mir_pointer_axis_x
);
...
...
@@ -209,35 +237,10 @@ void Window::handle_pointer_event(MirPointerEvent const* pointer_event) {
switch
(
mir_pointer_event_action
(
pointer_event
))
{
case
mir_pointer_action_button_down
:
events
.
push_back
({
EV_ABS
,
ABS_X
,
static_cast
<
std
::
int32_t
>
(
x
)
});
events
.
push_back
({
EV_ABS
,
ABS_Y
,
static_cast
<
std
::
int32_t
>
(
y
)
});
if
(
mir_pointer_event_button_state
(
pointer_event
,
mir_pointer_button_primary
))
{
events
.
push_back
({
EV_KEY
,
BTN_LEFT
,
1
});
events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
}
if
(
mir_pointer_event_button_state
(
pointer_event
,
mir_pointer_button_secondary
))
{
events
.
push_back
({
EV_KEY
,
BTN_RIGHT
,
1
});
events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
}
if
(
mir_pointer_event_button_state
(
pointer_event
,
mir_pointer_button_tertiary
))
{
events
.
push_back
({
EV_KEY
,
BTN_MIDDLE
,
1
});
events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
}
handle_pointer_button_event
(
events
,
pointer_event
,
true
);
break
;
case
mir_pointer_action_button_up
:
if
(
mir_pointer_event_button_state
(
pointer_event
,
mir_pointer_button_primary
))
{
events
.
push_back
({
EV_KEY
,
BTN_LEFT
,
0
});
events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
}
if
(
mir_pointer_event_button_state
(
pointer_event
,
mir_pointer_button_secondary
))
{
events
.
push_back
({
EV_KEY
,
BTN_RIGHT
,
0
});
events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
}
if
(
mir_pointer_event_button_state
(
pointer_event
,
mir_pointer_button_tertiary
))
{
events
.
push_back
({
EV_KEY
,
BTN_MIDDLE
,
0
});
events
.
push_back
({
EV_SYN
,
SYN_REPORT
,
0
});
}
handle_pointer_button_event
(
events
,
pointer_event
,
false
);
break
;
case
mir_pointer_action_motion
:
{
...
...
@@ -277,8 +280,10 @@ void Window::handle_input_event(MirInputEvent const* input_event) {
handle_touch_event
(
touch_event
);
break
;
case
mir_input_event_type_pointer
:
#if 0
pointer_event = mir_input_event_get_pointer_event(input_event);
handle_pointer_event(pointer_event);
#endif
break
;
case
mir_input_event_type_key
:
key_event
=
mir_input_event_get_keyboard_event
(
input_event
);
...
...
src/anbox/ubuntu/window.h
浏览文件 @
b90cdf43
...
...
@@ -21,6 +21,7 @@
#include <EGL/egl.h>
#include <memory>
#include <vector>
#include <mirclient/mir_toolkit/mir_client_library.h>
...
...
@@ -28,6 +29,7 @@ namespace anbox {
namespace
input
{
class
Manager
;
class
Device
;
class
Event
;
}
// namespace input
namespace
ubuntu
{
class
MirDisplayConnection
;
...
...
@@ -46,6 +48,8 @@ private:
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_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录