Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
ce53f2f9
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ce53f2f9
编写于
4月 29, 2014
作者:
G
Gerd Hoffmann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
input: use KeyValue directly in sendkey monitor command
Signed-off-by:
N
Gerd Hoffmann
<
kraxel@redhat.com
>
上级
528728fd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
24 deletion
+23
-24
ui/input-legacy.c
ui/input-legacy.c
+23
-24
未找到文件。
ui/input-legacy.c
浏览文件 @
ce53f2f9
...
...
@@ -74,38 +74,44 @@ int index_from_key(const char *key)
return
i
;
}
static
int
*
keycod
es
;
static
int
key
cod
es_size
;
static
KeyValue
**
keyvalu
es
;
static
int
key
valu
es_size
;
static
QEMUTimer
*
key_timer
;
static
void
free_key
cod
es
(
void
)
static
void
free_key
valu
es
(
void
)
{
g_free
(
key
cod
es
);
key
cod
es
=
NULL
;
key
cod
es_size
=
0
;
g_free
(
key
valu
es
);
key
valu
es
=
NULL
;
key
valu
es_size
=
0
;
}
static
void
release_keys
(
void
*
opaque
)
{
while
(
key
cod
es_size
>
0
)
{
qemu_input_event_send_key
_number
(
NULL
,
keycodes
[
--
keycod
es_size
],
false
);
while
(
key
valu
es_size
>
0
)
{
qemu_input_event_send_key
(
NULL
,
keyvalues
[
--
keyvalu
es_size
],
false
);
}
free_keycodes
();
free_keyvalues
();
}
static
KeyValue
*
copy_key_value
(
KeyValue
*
src
)
{
KeyValue
*
dst
=
g_new
(
KeyValue
,
1
);
memcpy
(
dst
,
src
,
sizeof
(
*
src
));
return
dst
;
}
void
qmp_send_key
(
KeyValueList
*
keys
,
bool
has_hold_time
,
int64_t
hold_time
,
Error
**
errp
)
{
int
keycode
;
KeyValueList
*
p
;
if
(
!
key_timer
)
{
key_timer
=
timer_new_ns
(
QEMU_CLOCK_VIRTUAL
,
release_keys
,
NULL
);
}
if
(
key
cod
es
!=
NULL
)
{
if
(
key
valu
es
!=
NULL
)
{
timer_del
(
key_timer
);
release_keys
(
NULL
);
}
...
...
@@ -115,23 +121,16 @@ void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time,
}
for
(
p
=
keys
;
p
!=
NULL
;
p
=
p
->
next
)
{
/* key down events */
keycode
=
qemu_input_key_value_to_number
(
p
->
value
);
if
(
keycode
<
0x01
||
keycode
>
0xff
)
{
error_setg
(
errp
,
"invalid hex keycode 0x%x"
,
keycode
);
free_keycodes
();
return
;
}
qemu_input_event_send_key_number
(
NULL
,
keycode
,
true
);
qemu_input_event_send_key
(
NULL
,
copy_key_value
(
p
->
value
),
true
);
keycodes
=
g_realloc
(
keycodes
,
sizeof
(
int
)
*
(
keycodes_size
+
1
));
keycodes
[
keycodes_size
++
]
=
keycode
;
keyvalues
=
g_realloc
(
keyvalues
,
sizeof
(
KeyValue
*
)
*
(
keyvalues_size
+
1
));
keyvalues
[
keyvalues_size
++
]
=
copy_key_value
(
p
->
value
);
}
/* delayed key up events */
timer_mod
(
key_timer
,
qemu_clock_get_ns
(
QEMU_CLOCK_VIRTUAL
)
+
muldiv64
(
get_ticks_per_sec
(),
hold_time
,
1000
));
muldiv64
(
get_ticks_per_sec
(),
hold_time
,
1000
));
}
static
void
legacy_kbd_event
(
DeviceState
*
dev
,
QemuConsole
*
src
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录