From patchwork Wed Nov 11 21:57:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 543105 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ACD5A1413F0 for ; Thu, 12 Nov 2015 08:57:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=comcast.net header.i=@comcast.net header.b=eovxrIWO; dkim-atps=neutral Received: from localhost ([::1]:43225 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwdOj-0000gb-K8 for incoming@patchwork.ozlabs.org; Wed, 11 Nov 2015 16:57:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwdOI-0008LS-H1 for qemu-devel@nongnu.org; Wed, 11 Nov 2015 16:57:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwdOH-0007fH-JD for qemu-devel@nongnu.org; Wed, 11 Nov 2015 16:57:18 -0500 Received: from resqmta-po-09v.sys.comcast.net ([2001:558:fe16:19:96:114:154:168]:36341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwdOH-0007f8-El for qemu-devel@nongnu.org; Wed, 11 Nov 2015 16:57:17 -0500 Received: from resomta-po-02v.sys.comcast.net ([96.114.154.226]) by resqmta-po-09v.sys.comcast.net with comcast id gMxC1r0024tLnxL01MxGwK; Wed, 11 Nov 2015 21:57:16 +0000 Received: from red.redhat.com ([24.10.254.122]) by resomta-po-02v.sys.comcast.net with comcast id gMx81r00E2fD5rL01MxG7w; Wed, 11 Nov 2015 21:57:16 +0000 From: Eric Blake To: qemu-devel@nongnu.org Date: Wed, 11 Nov 2015 14:57:07 -0700 Message-Id: <1447279028-2114-2-git-send-email-eblake@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1447279028-2114-1-git-send-email-eblake@redhat.com> References: <1447279028-2114-1-git-send-email-eblake@redhat.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1447279036; bh=9RV8Hdil4+cJLh6P1RI0HMD8BmAdFgAkVl7JDb5LIHU=; h=Received:Received:From:To:Subject:Date:Message-Id; b=eovxrIWOAQyyTkYNYqc4sawpS4NWFNNWkscjgjrRzt4zcgRKz/rLhC0ic+23L/2tL UxZSzDHVoZqxK5a9xmfokgHZ3/OFDYFduE3Las6nkC8oOHpmq5K2WKP92430sbQKem BIguAx0c7qR0a7yGPeA5cXxB11tDsBrY4B7kizHFDkGSHKNneSOw1FvRCsp5v6sGl9 23Lo0qUh3LJawVjv8BA/8TSsxIANFXIPndiV5q20llgslkPkI+e7Vnt2RH8+p93aSo iig6btiokJ/DOMZ8h8z2d5bavh7k35+OjgBSzxCQsbe3JqelXxmh5XAjXtkyhfd7ge 2ScWsgNoiid/A== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:558:fe16:19:96:114:154:168 Cc: armbru@redhat.com, kraxel@redhat.com Subject: [Qemu-devel] [PATCH for-2.5 1/2] input: Avoid CamelCase in InputEvent enums X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster --- 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