Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
Here's what I ended up with. It's really not pretty but I think it should handle everything. I derived this from code on Carbon-dev (see "iGetKeys sample code problems in Tiger") so I think it's only fair to give back :) BTW, word to the wise, the Carbon-dev code looks like it has an endian bug,

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
Hmm, OK. I guess there's no harm in leaving in the KCHR handling code. I was hoping to simplify things (this routine is already big and yucky) but I guess that's just not in the cards. Nothing about this whole hotkey ordeal has been simple! Ken Thomases wrote: On Apr 17, 2008, at 11:38 AM, J

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread Ken Thomases
On Apr 17, 2008, at 11:38 AM, John Stiles wrote: Quick question: in Leopard, are there any keyboards left which don't have a uchr? I found some sample code which includes a fallback case for if no 'uchr' resource is found (it uses plain KeyTranslate in this case) and I'm wondering whether

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread Jean-Daniel Dupas
Now that you say it, "[" is produced using "alt + shift + (" on french keyboard, and "alt + (" output "{". So "cmd + [" is actualy on french keyboard "cmd + alt + shift + (" shortcut are really not good candidate for internationalization. Le 17 avr. 08 à 19:11, Hank Heijink (Mailinglists) a

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
I think you missed the part where I explained about how the user can customize the hotkeys to whatever they want :) Right now the UI is set up so that they pick a key, then they pick what modifiers they want. It makes way more sense from an end-user perspective to choose the "1" key and then c

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread Hank Heijink (Mailinglists)
I assume you picked cmd-shift-[ because the curly brace makes sense, in which case you really are looking for cmd-{. If someone has a keyboard where the shifted version of [ is @ (no idea if such a keyboard actually exists), you might not want your shortcut to be cmd- shift-[. So, I think

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread Jean-Daniel Dupas
I don't think so. The API to retreive KCHR is deprecated and does not exists on 64 bits, so it would mean that a kchr keyboard cannot be used with 64 bits software. Le 17 avr. 08 à 18:38, John Stiles a écrit : Quick question: in Leopard, are there any keyboards left which don't have a u

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
OK, I've got this implemented. Good news: it seems to work great for punctuation and letters. Bad news: it doesn't seem to work for other keys, like F-keys or arrow keys. Or rather, it generates a result, but not the same values as NSF1FunctionKey or NSUpArrowFunctionKey. It's coming up with low

RE: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
es Cc: cocoa dev Subject: Re: -charactersIgnoringModifiers and the shift key Le 17 avr. 08 à 18:18, John Stiles a écrit : Sweet, I will take a look at this and post back when I have results or questions. Thanks! Greg Titus wrote: I think you'd ask the NSEvent for its -keyCode,

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
Quick question: in Leopard, are there any keyboards left which don't have a uchr? I found some sample code which includes a fallback case for if no 'uchr' resource is found (it uses plain KeyTranslate in this case) and I'm wondering whether this is still relevant in the Leopard-and-above timef

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread Jean-Daniel Dupas
Le 17 avr. 08 à 18:18, John Stiles a écrit : Sweet, I will take a look at this and post back when I have results or questions. Thanks! Greg Titus wrote: I think you'd ask the NSEvent for its -keyCode, then pass that key code to UCKeyTranslate() with all the modifier key state (including

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
Sweet, I will take a look at this and post back when I have results or questions. Thanks! Greg Titus wrote: I think you'd ask the NSEvent for its -keyCode, then pass that key code to UCKeyTranslate() with all the modifier key state (including shift) turned off in order to get a unicode string

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread Greg Titus
I think you'd ask the NSEvent for its -keyCode, then pass that key code to UCKeyTranslate() with all the modifier key state (including shift) turned off in order to get a unicode string for what that key would mean if the user hadn't been pressing any modifiers. Hope that helps, - G

-charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
I have an NSEvent and I need to know what key the user has pressed, minus any of the modifiers. NSEvent -charactersIgnoringModifiers seems like a good place to start, but it has one serious flaw—it does not ignore the Shift key. So, for instance, it won't change ~ to `, ! to 1 or { to [. I ne