qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] qmp: qmp_send_key(): accept key codes in he


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 2/3] qmp: qmp_send_key(): accept key codes in hex
Date: Fri, 21 Sep 2012 20:20:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Luiz Capitulino <address@hidden> writes:

> On Fri, 21 Sep 2012 13:42:34 -0300
> Luiz Capitulino <address@hidden> wrote:
>
>> On Fri, 21 Sep 2012 10:31:23 -0600
>> Eric Blake <address@hidden> wrote:
>> 
>> > On 09/21/2012 08:55 AM, Luiz Capitulino wrote:
>> > > This commit fixes the problem by adding hex value support down
>> > > the QMP interface, qmp_send_key().
>> > > 
>> > 
>> > > +++ b/qapi-schema.json
>> > > @@ -2588,12 +2588,25 @@
>> > >               'lf', 'help', 'meta_l', 'meta_r', 'compose' ] }
>> > >  
>> > >  ##
>> > > +# @KeyValue
>> > > +#
>> > > +# Represents a keyboard key.
>> > > +# 
>> > > +# Since: 1.3.0
>> > > +##
>> > > +{ 'union': 'KeyValue',
>> > > +  'data': {
>> > > +    'hex': 'int',
>> > 
>> > Don't you find it a bit odd to name this 'hex', even though it works to
>> > do 'hex':32 as a synonym for 'hex':0x20?  Should we instead name it
>> > 'value', since we don't care in what base the value was represented,
>> > only that JSON was able to decode the base into a value?
>> 
>> Yes, that's a good point. I'll respin.
>
> Actually, this also has drawbacks:
>
>             keylist->value->kind = KEY_VALUE_KIND_VALUE;
>             keylist->value->value = value;
>
> Value, value, value... Value, value, value!
>
> I thought about renaming QKeyCode to KeyName and KeyValue to KeyCode, the
> problem though (apart from the code churn caused by the renaming) is that
> KeyName doesn't make much sense in C as it's all integers.
>
> Any better ideas?

keylist->value->kind = KEY_VALUE_KIND_NUM;
keylist->value->num = num;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]