Skip to contentSkip to conversation

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

PATCH In review Programmingkid 3 participants 8 messages Mar 3, 2016

lore
Share & tools
lore
#0 lore raw

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

This patch allows for the user to use the keypad number keys to select a console.

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

 ui/cocoa.m | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
ui/cocoa.m +4 -7
index 65301ff..d3310bf 100644
@@ -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)) {
Signature · 1 line
2.7.2
#1 lore raw
Quoted 7 lines · Programmingkid

This patch allows for the user to use the keypad number keys to select a console.

---
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

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
Quoted 4 lines · Eric Blake
Quoted 3 lines · Programmingkid

This patch allows for the user to use the keypad number keys to select a console.

Quoted 8 lines
Quoted 4 lines

---
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.

Quoted 5 lines

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.

Quoted 4 lines

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.

#3 lore raw
Quoted 3 lines · Programmingkid

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

#4 lore raw
In reply to Programmingkid
Quoted 5 lines · Programmingkid
Quoted 4 lines

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.

Quoted 8 lines

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.

Quoted 4 lines

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.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#5 lore raw
Quoted 15 lines · Eric Blake
Quoted 5 lines · Programmingkid
Quoted 4 lines

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.

Quoted 8 lines

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.

Quoted 4 lines

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.

Quoted 8 lines

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.

#6 lore raw
In reply to Programmingkid
Quoted 20 lines · Programmingkid

This patch allows for the user to use the keypad number keys to select a console.

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

 ui/cocoa.m | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
ui/cocoa.m +0 -1
index 65301ff..d3310bf 100644
@@ -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) {

ui/cocoa.m QemuCocoaView *cocoaView; · line 568

Quoted 10 lines
ui/cocoa.m +4 -6
-
-                    // 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.

ui/cocoa.m QemuCocoaView *cocoaView; · line 571

Quoted 3 lines
ui/cocoa.m +0 -0
             // handle keys for graphic console
             } else if (qemu_console_is_graphic(NULL)) {

thanks
-- PMM

#7 lore raw
Quoted 27 lines · Peter Maydell
Quoted 26 lines · Programmingkid

This patch allows for the user to use the keypad number keys to select a console.

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

ui/cocoa.m | 11 ++++-------

1 file changed, 4 insertions(+), 7 deletions(-)
ui/cocoa.m +0 -7
index 65301ff..d3310bf 100644
@@ -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;
-                }
Quoted 8 lines

ui/cocoa.m QemuCocoaView *cocoaView; · line 568

Quoted 4 lines
ui/cocoa.m +4 -0
+                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?

Quoted 8 lines

ui/cocoa.m QemuCocoaView *cocoaView; · line 571

Quoted 5 lines
ui/cocoa.m +0 -0
            // handle keys for graphic console
            } else if (qemu_console_is_graphic(NULL)) {

thanks
-- PMM