diff mbox

ui/cocoa.m: Allow console selection using keypad number keys

Message ID A7AD3D76-3520-4576-86BA-5C31B2F54B8B@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Programmingkid March 3, 2016, 3:34 a.m. UTC
This patch allows for the user to use the keypad number keys to select a
console.

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>

---
This patch depends on this patch: http://patchwork.ozlabs.org/patch/591221/

 ui/cocoa.m | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Eric Blake March 3, 2016, 4:26 p.m. UTC | #1
On 03/02/2016 08:34 PM, Programmingkid wrote:
> This patch allows for the user to use the keypad number keys to select a
> console.
> 
> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
> 
> ---
> This patch depends on this patch: http://patchwork.ozlabs.org/patch/591221/

Making me chase a URL is not nice when I'm offline.  Please also mention
the subject line, which I can then search for in my inbox without having
to visit a web page.  Or better yet, fix your setup to send threaded series.

I know you've expressed frustrations that you don't have 'git
send-email' configured correctly; have you tried trouble-shooting it on
IRC with the #git folks?  Chances are, someone else is in the same boat
as you and has figured out the right settings to use.

In fact, a quick google search shows:
http://lmgtfy.com/?q=git+send-email+setup+for+gmail
https://coderwall.com/p/dp-gka/setting-up-git-send-email-with-gmail
Programmingkid March 3, 2016, 4:32 p.m. UTC | #2
On Mar 3, 2016, at 11:26 AM, Eric Blake wrote:

> On 03/02/2016 08:34 PM, Programmingkid wrote:
>> This patch allows for the user to use the keypad number keys to select a
>> console.
>> 
>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>> 
>> ---
>> This patch depends on this patch: http://patchwork.ozlabs.org/patch/591221/
> 
> Making me chase a URL is not nice when I'm offline.  Please also mention
> the subject line, which I can then search for in my inbox without having
> to visit a web page.  Or better yet, fix your setup to send threaded series.

I'm so sorry. I thought using a url would make things very easy for you. 

> 
> I know you've expressed frustrations that you don't have 'git
> send-email' configured correctly; have you tried trouble-shooting it on
> IRC with the #git folks?  Chances are, someone else is in the same boat
> as you and has figured out the right settings to use.

Well I spend several hours yesterday doing a lot of things suggested online. I even upgraded my version of git to 2.7.2. This was still not enough. It looks like something else that git depends on is the problem. 

> 
> In fact, a quick google search shows:
> http://lmgtfy.com/?q=git+send-email+setup+for+gmail
> https://coderwall.com/p/dp-gka/setting-up-git-send-email-with-gmail

I did a lot of google searching yesterday on this problem. I much rather spend my time working to better QEMU than on some git feature I rather not use.
Peter Maydell March 3, 2016, 4:49 p.m. UTC | #3
On 3 March 2016 at 16:32, Programmingkid <programmingkidx@gmail.com> wrote:
> I did a lot of google searching yesterday on this problem. I much
> rather spend my time working to better QEMU than on some git feature
> I rather not use.

You don't have to use git send-email if you can get the emails to
appear on the list correctly formatted and threaded via some other
mechanism. We just suggest it because it's usually the easiest.

As usual with issues of style and presentation with patches, there
is a trade off between time spent by the submitter of patches,
and time spent by those who review, test and apply the patches.
The project's preferences are optimised to make things easy for
reviewers, because (like many open source projects) we are always
short of people with the time and expertise to review incoming patches,
so we try to make it easy for them. For first-time patch submitters
we generally don't insist on exact following of the rules because
it's mostly easier to just fix things up by hand for a one-off
and it's friendlier to new contributors. But if you're a more
regular contributor you shouldn't be surprised if reviewers start
to say "look, please just follow our workflow" after a while.

thanks
-- PMM
Eric Blake March 3, 2016, 4:49 p.m. UTC | #4
On 03/03/2016 09:32 AM, Programmingkid wrote:
>> I know you've expressed frustrations that you don't have 'git
>> send-email' configured correctly; have you tried trouble-shooting it on
>> IRC with the #git folks?  Chances are, someone else is in the same boat
>> as you and has figured out the right settings to use.
> 
> Well I spend several hours yesterday doing a lot of things suggested online. I even upgraded my version of git to 2.7.2. This was still not enough. It looks like something else that git depends on is the problem. 
> 
>>
>> In fact, a quick google search shows:
>> http://lmgtfy.com/?q=git+send-email+setup+for+gmail
>> https://coderwall.com/p/dp-gka/setting-up-git-send-email-with-gmail
> 
> I did a lot of google searching yesterday on this problem. I much rather spend my time working to better QEMU than on some git feature I rather not use.

But getting 'git send-email' IS making a better qemu, and is time
well-spent.  Consider - there are well over 100 readers of this list.
Saving 1 minute of reader's time is therefore worth 100 minutes of your
time, if you want your patches to be quickly applied.  We're serious
about our offers to help you get your environment set up correctly so
that you can quit wasting our time with one-off submissions that are
very difficult to work with, so that we can spend more time reviewing
your patches proper rather than your submission habits.
Programmingkid March 3, 2016, 4:53 p.m. UTC | #5
On Mar 3, 2016, at 11:49 AM, Eric Blake wrote:

> On 03/03/2016 09:32 AM, Programmingkid wrote:
>>> I know you've expressed frustrations that you don't have 'git
>>> send-email' configured correctly; have you tried trouble-shooting it on
>>> IRC with the #git folks?  Chances are, someone else is in the same boat
>>> as you and has figured out the right settings to use.
>> 
>> Well I spend several hours yesterday doing a lot of things suggested online. I even upgraded my version of git to 2.7.2. This was still not enough. It looks like something else that git depends on is the problem. 
>> 
>>> 
>>> In fact, a quick google search shows:
>>> http://lmgtfy.com/?q=git+send-email+setup+for+gmail
>>> https://coderwall.com/p/dp-gka/setting-up-git-send-email-with-gmail
>> 
>> I did a lot of google searching yesterday on this problem. I much rather spend my time working to better QEMU than on some git feature I rather not use.
> 
> But getting 'git send-email' IS making a better qemu, and is time
> well-spent.  Consider - there are well over 100 readers of this list.
> Saving 1 minute of reader's time is therefore worth 100 minutes of your
> time, if you want your patches to be quickly applied.  We're serious
> about our offers to help you get your environment set up correctly so
> that you can quit wasting our time with one-off submissions that are
> very difficult to work with, so that we can spend more time reviewing
> your patches proper rather than your submission habits.

Very interesting response. I didn't think about it that way.
Peter Maydell March 3, 2016, 4:53 p.m. UTC | #6
On 3 March 2016 at 03:34, Programmingkid <programmingkidx@gmail.com> wrote:
> This patch allows for the user to use the keypad number keys to select a
> console.
>
> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>
> ---
> This patch depends on this patch: http://patchwork.ozlabs.org/patch/591221/
>
>  ui/cocoa.m | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 65301ff..d3310bf 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -562,13 +562,10 @@ QemuCocoaView *cocoaView;
>
>              // handle control + alt Key Combos (ctrl+alt is reserved for QEMU)
>              if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
> -                switch (keycode) {
> -
> -                    // enable graphic console
> -                    case Q_KEY_CODE_1 ... Q_KEY_CODE_9: // '1' to '9' keys
> -                        console_select(keycode - 11);
> -                        break;
> -                }
> +                int selected_console = atoi([[event characters]
> +                                           cStringUsingEncoding:
> +                                           NSASCIIStringEncoding]);
> +                console_select(selected_console - 1);

Why keypad number keys? I don't think any of our other UI front
ends do that. The usual hotkey is ctrl+alt+number for one of the
number keys on the top row of the keyboard.


>
>              // handle keys for graphic console
>              } else if (qemu_console_is_graphic(NULL)) {

thanks
-- PMM
Programmingkid March 3, 2016, 4:57 p.m. UTC | #7
On Mar 3, 2016, at 11:53 AM, Peter Maydell wrote:

> On 3 March 2016 at 03:34, Programmingkid <programmingkidx@gmail.com> wrote:
>> This patch allows for the user to use the keypad number keys to select a
>> console.
>> 
>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>> 
>> ---
>> This patch depends on this patch: http://patchwork.ozlabs.org/patch/591221/
>> 
>> ui/cocoa.m | 11 ++++-------
>> 1 file changed, 4 insertions(+), 7 deletions(-)
>> 
>> diff --git a/ui/cocoa.m b/ui/cocoa.m
>> index 65301ff..d3310bf 100644
>> --- a/ui/cocoa.m
>> +++ b/ui/cocoa.m
>> @@ -562,13 +562,10 @@ QemuCocoaView *cocoaView;
>> 
>>             // handle control + alt Key Combos (ctrl+alt is reserved for QEMU)
>>             if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
>> -                switch (keycode) {
>> -
>> -                    // enable graphic console
>> -                    case Q_KEY_CODE_1 ... Q_KEY_CODE_9: // '1' to '9' keys
>> -                        console_select(keycode - 11);
>> -                        break;
>> -                }
>> +                int selected_console = atoi([[event characters]
>> +                                           cStringUsingEncoding:
>> +                                           NSASCIIStringEncoding]);
>> +                console_select(selected_console - 1);
> 
> Why keypad number keys? I don't think any of our other UI front
> ends do that. The usual hotkey is ctrl+alt+number for one of the
> number keys on the top row of the keyboard.

A number is a number. Should it matter where on the keyboard that number came from?

> 
> 
>> 
>>             // handle keys for graphic console
>>             } else if (qemu_console_is_graphic(NULL)) {
> 
> thanks
> -- PMM
diff mbox

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 65301ff..d3310bf 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -562,13 +562,10 @@  QemuCocoaView *cocoaView;
 
             // handle control + alt Key Combos (ctrl+alt is reserved for QEMU)
             if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
-                switch (keycode) {
-
-                    // enable graphic console
-                    case Q_KEY_CODE_1 ... Q_KEY_CODE_9: // '1' to '9' keys
-                        console_select(keycode - 11);
-                        break;
-                }
+                int selected_console = atoi([[event characters]
+                                           cStringUsingEncoding:
+                                           NSASCIIStringEncoding]);
+                console_select(selected_console - 1);
 
             // handle keys for graphic console
             } else if (qemu_console_is_graphic(NULL)) {