qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Programmingkid <programmingkidx@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: Replace pc/xt keyboard keycode array with QKeyCode
Date: Tue, 1 Mar 2016 19:18:47 -0500	[thread overview]
Message-ID: <3D07F69F-F34B-4A2F-90A8-9E26F8D7D82B@gmail.com> (raw)
In-Reply-To: <CAFEAcA87TYf9KMP15H7y4hfE7LX0q3mOi0XaBuoX0vce_tjVSw@mail.gmail.com>


On Mar 1, 2016, at 6:18 PM, Peter Maydell wrote:

> On 1 March 2016 at 22:12, Programmingkid <programmingkidx@gmail.com> wrote:
>> The old pc/xt keyboard keycode array is replaced with QEMU's own QKeyCode
>> layout.
>> 
>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>> 
>> ---
>> Maintainer note:
>> Please apply these patches before testing:
>> - qapi-schema.json: Add kp_equals and power keys
>> - adb.c: Replace pc_to_adb_keycode with more detailed array
>> - MacKeys.h: initial commit
> 
> The correct way to do this is to send the patches as a single
> patch series, which then will have them all in the right order,
> together with 'cover letter' email which explains the series
> and has all the patch mails as followups to it. Look at how
> other people send out mails for multi-patch features.
> (git format-patch and git send-email can do this for you.)

Yes you are right. I will learn how to use git send-email.

> 
>> 
>> ui/cocoa.m |  300 ++++++++++++++++++++++++++----------------------------------
>> 1 files changed, 128 insertions(+), 172 deletions(-)
>> 
>> diff --git a/ui/cocoa.m b/ui/cocoa.m
>> index 3ee5549..8ea39ad 100644
>> --- a/ui/cocoa.m
>> +++ b/ui/cocoa.m
>> @@ -33,6 +33,7 @@
>> #include "sysemu/sysemu.h"
>> #include "qmp-commands.h"
>> #include "sysemu/blockdev.h"
>> +#include "include/hw/input/MacKeys.h"
> 
> This should use the OSX header for the keycodes.

If you really prefer I use Events.h and its keycodes, it shouldn't be a problem. A quick Find & Replace should make the changes that are needed.

> 
>> static int cocoa_keycode_to_qemu(int keycode)
>> {
>> -    if (ARRAY_SIZE(keymap) <= keycode) {
>> +    if (ARRAY_SIZE(macToQKeyCodeMap) <= keycode) {
>>         fprintf(stderr, "(cocoa) warning unknown keycode 0x%x\n", keycode);
>>         return 0;
>>     }
>> -    return keymap[keycode];
>> +    return macToQKeyCodeMap[keycode];
>> }
>> 
>> /* Displays an alert dialog box with the specified message */
>> @@ -564,14 +520,14 @@ QemuCocoaView *cocoaView;
>> 
>>             if (keycode) {
>>                 if (keycode == 58 || keycode == 69) { // emulate caps lock and num lock keydown and keyup
> 
> Because cocoa_keycode_to_qemu() now returns a Q_KEY_* constant,
> you need to change all the places like this that were checking
> against hardcoded 58, 69, etc, to check against the correct
> Q_KEY_* instead. (They're not the same numbers, so otherwise these
> special cases will be broken.)


Good idea.

      reply	other threads:[~2016-03-02  0:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 22:12 [Qemu-devel] [PATCH] ui/cocoa.m: Replace pc/xt keyboard keycode array with QKeyCode Programmingkid
2016-03-01 23:16 ` Eric Blake
2016-03-02  0:12   ` Programmingkid
2016-03-02  0:25     ` Eric Blake
2016-03-02  1:20       ` Programmingkid
2016-03-02  2:14         ` Eric Blake
2016-03-02  9:29           ` Markus Armbruster
2016-03-01 23:18 ` Peter Maydell
2016-03-02  0:18   ` Programmingkid [this message]

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=3D07F69F-F34B-4A2F-90A8-9E26F8D7D82B@gmail.com \
    --to=programmingkidx@gmail.com \
    --cc=peter.maydell@linaro.org \
    --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).