Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Issue 319001: Add a function that can check if a menu item would be fired by a keypress. (Closed)

Created:
11 years, 2 months ago by Nico
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Add a function that can check if a menu item would be fired by a keypress. BUG=Needed for a CL that I'm writing for 15090. TEST=Unittest included. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=30030

Patch Set 1 #

Patch Set 2 : Add comment. #

Total comments: 12

Patch Set 3 : Failing test case for cyrillic #

Patch Set 4 : crazy hack #

Patch Set 5 : more tests #

Patch Set 6 : address comments #

Patch Set 7 : more tests (some fail) #

Patch Set 8 : make new test cases pass, use oracle function #

Patch Set 9 : another test #

Patch Set 10 : rebase tot #

Patch Set 11 : remove done todo, 80cols #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+462 lines, -0 lines) Patch
A chrome/browser/cocoa/nsmenuitem_additions.h View 1 2 3 4 5 1 chunk +18 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/nsmenuitem_additions.mm View 1 2 3 4 5 6 7 1 chunk +100 lines, -0 lines 2 comments Download
A chrome/browser/cocoa/nsmenuitem_additions_unittest.mm View 1 2 3 4 5 6 7 8 9 10 1 chunk +341 lines, -0 lines 0 comments Download
M chrome/chrome.gyp View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Nico
Hi keyboard crowd, can you think of any weird case that I missed in the ...
11 years, 2 months ago (2009-10-22 08:40:28 UTC) #1
James Su
[event charactersIgnoringModifiers] may not be able to support different keyboard layouts. Please help confirm. James ...
11 years, 2 months ago (2009-10-22 12:18:45 UTC) #2
James Su
Just found [NSMenu menuHasKeyEquivalent:forEvent:target:action:]. According to its document, the default implementation is just for looking ...
11 years, 2 months ago (2009-10-22 12:30:17 UTC) #3
Nico
Do you mean physical keyboard layouts? I tested with a German software layout on my ...
11 years, 2 months ago (2009-10-22 15:11:09 UTC) #4
James Su
On 2009/10/22 15:11:09, Nico wrote: > Do you mean physical keyboard layouts? I tested with ...
11 years, 2 months ago (2009-10-22 15:26:35 UTC) #5
jeremy
http://codereview.chromium.org/319001/diff/3001/2002 File chrome/browser/cocoa/nsmenuitem_additions.h (right): http://codereview.chromium.org/319001/diff/3001/2002#newcode10 Line 10: @interface NSMenuItem(ChromeAdditions) Could you add a header comment ...
11 years, 2 months ago (2009-10-22 16:43:18 UTC) #6
Nico
Jeremy suggested that it might be better to just hardcode a list of keyboard shortcuts ...
11 years, 2 months ago (2009-10-22 20:57:52 UTC) #7
jeremy
My fear is that there are other keyboard layouts out there that would require similar ...
11 years, 2 months ago (2009-10-22 21:03:09 UTC) #8
Nico
I venture to claim that this should work for all layouts. Cocoa stores literal text ...
11 years, 2 months ago (2009-10-22 21:11:23 UTC) #9
Nico
Ping. I still think this is one of the smaller evils. (Jeremy: If you replied, ...
11 years, 2 months ago (2009-10-24 02:34:44 UTC) #10
Nico
I take that ping back, I want to look into something first. I will ping ...
11 years, 2 months ago (2009-10-24 05:16:20 UTC) #11
Nico
Another approach to do this is to temporarily put the menu item into a menu, ...
11 years, 2 months ago (2009-10-25 16:59:27 UTC) #12
Nico
I've added another test. Due to the deficiencies in Cocoa (see above), it's not as ...
11 years, 1 month ago (2009-10-25 22:39:40 UTC) #13
James Su
This CL looks good to me mostly. You may go ahead with this approach for ...
11 years, 1 month ago (2009-10-26 03:10:12 UTC) #14
Nico
Thanks, then I'll submit this for now :-) http://codereview.chromium.org/319001/diff/9004/11008 File chrome/browser/cocoa/nsmenuitem_additions.mm (right): http://codereview.chromium.org/319001/diff/9004/11008#newcode82 Line 82: ...
11 years, 1 month ago (2009-10-26 03:22:14 UTC) #15
James Su
11 years, 1 month ago (2009-10-26 03:23:41 UTC) #16
I see. LGTM.

On 2009/10/26 03:22:14, Nico wrote:
> Thanks, then I'll submit this for now :-)
> 
> http://codereview.chromium.org/319001/diff/9004/11008
> File chrome/browser/cocoa/nsmenuitem_additions.mm (right):
> 
> http://codereview.chromium.org/319001/diff/9004/11008#newcode82
> Line 82: eventString = [event characters];
> On 2009/10/26 03:10:13, James Su wrote:
> > Is it possible to make above two if statements easier to understand? For
> > example, is it ok to just compare [self keyEquivalent] to both [event
> > characters] and [event charactersIgnoringModifiers] and returns YES if any
of
> > them matches?
> 
> No, on the dvorak-qwertycmd layout, cmd-z will send "z" in "characters" and
";"
> in "charactersIgnoringModifiers". For a menu item with accelerator "cmd-;",
this
> event should not fire.

Powered by Google App Engine
This is Rietveld 408576698