qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH for-2.5 1/2] input: Avoid CamelCase in InputEvent enums
Date: Wed, 11 Nov 2015 14:57:07 -0700	[thread overview]
Message-ID: <1447279028-2114-2-git-send-email-eblake@redhat.com> (raw)
In-Reply-To: <1447279028-2114-1-git-send-email-eblake@redhat.com>

Our documentation states that we prefer 'lower-case', rather than
'CamelCase', for qapi enum values.  The InputButton and InputAxis
enums violated this convention.  However, they are currently used
primarily for generating code that is used internally; their only
exposure through QMP is via the experimental 'x-input-send-event'
command.  Since this is experimental, changing the QMP wire format
for that command is acceptable.

The existing c_enum_const() code in the generator for turning the
enum names into C constants happens to munge both pre- and
post-patch spellings to the same C code, which means making the
change now touches very few files.  But we are considering a
future patch which would change c_enum_const() to use
c_name(V).upper() rather than camel_to_upper(), which would render
'WheelUp' as INPUT_BUTTON_WHEELUP instead of its current
INPUT_BUTTON_WHEEL_UP.  Making the change to the enum values now
will isolate these enums from any impact if the generator munging
algorithm is changed.

Note that SDL code uses the spelling WHEELUP rather than WHEEL_UP
in its constants, but that shouldn't drive our decision.

Fix a typo in the qapi docs for InputAxis while at it.

CC: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 qapi-schema.json | 6 +++---
 qmp-commands.hx  | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index c3f95ab..ecefb17 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3531,17 +3531,17 @@
 # Since: 2.0
 ##
 { 'enum'  : 'InputButton',
-  'data'  : [ 'Left', 'Middle', 'Right', 'WheelUp', 'WheelDown' ] }
+  'data'  : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down' ] }

 ##
-# @InputButton
+# @InputAxis
 #
 # Position axis of a pointer input device (mouse, tablet).
 #
 # Since: 2.0
 ##
 { 'enum'  : 'InputAxis',
-  'data'  : [ 'X', 'Y' ] }
+  'data'  : [ 'x', 'y' ] }

 ##
 # @InputKeyEvent
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 02c0c5b..8f25fe0 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -4504,13 +4504,13 @@ Press left mouse button.
 -> { "execute": "x-input-send-event",
     "arguments": { "console": 0,
                    "events": [ { "type": "btn",
-                    "data" : { "down": true, "button": "Left" } } ] } }
+                    "data" : { "down": true, "button": "left" } } ] } }
 <- { "return": {} }

 -> { "execute": "x-input-send-event",
     "arguments": { "console": 0,
                    "events": [ { "type": "btn",
-                    "data" : { "down": false, "button": "Left" } } ] } }
+                    "data" : { "down": false, "button": "left" } } ] } }
 <- { "return": {} }

 Example (2):
@@ -4533,8 +4533,8 @@ Move mouse pointer to absolute coordinates (20000, 400).

 -> { "execute": "x-input-send-event" ,
   "arguments": { "console": 0, "events": [
-               { "type": "abs", "data" : { "axis": "X", "value" : 20000 } },
-               { "type": "abs", "data" : { "axis": "Y", "value" : 400 } } ] } }
+               { "type": "abs", "data" : { "axis": "x", "value" : 20000 } },
+               { "type": "abs", "data" : { "axis": "y", "value" : 400 } } ] } }
 <- { "return": {} }

 EQMP
-- 
2.4.3

  reply	other threads:[~2015-11-11 21:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 21:57 [Qemu-devel] [PATCH for-2.5 0/2] Promote 'input-send-event' to supported Eric Blake
2015-11-11 21:57 ` Eric Blake [this message]
2015-11-12  8:23   ` [Qemu-devel] [PATCH for-2.5 1/2] input: Avoid CamelCase in InputEvent enums Markus Armbruster
2015-11-12 13:24     ` Eric Blake
2015-11-11 21:57 ` [Qemu-devel] [PATCH for-2.5 2/2] input: Promote 'input-send-event' to stable API Eric Blake
2015-11-12  8:23   ` Markus Armbruster
2015-11-12  9:09     ` Gerd Hoffmann
2015-11-12 11:10       ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447279028-2114-2-git-send-email-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).