[Openmcl-devel] Key Codes in OpenMCL

Gary Byers gb at clozure.com
Sun Jan 14 23:49:41 PST 2007


Personally, I think that I'd just do:


(case event-code
   (#.#$NSUpArrowFunctionKey (handle-up-arrow))
   (#.#$NSDownArrowFunctionKey (handle-down-arrow))
   ...)

or

(cond ((eql event-code #$NSUpArrowFunctionKey) (handle-up-arrow))
       ((eql event-code #$NSDownArrowFunctionKey) (handle-down-arrow))
       ...)

whichever seems more reasonable/readable.

On Sun, 14 Jan 2007, Brent Fulgham wrote:

>
> On Jan 14, 2007, at 3:03 PM, Gary Byers wrote:
>
>> Cocoa uses a private-use range of the Unicode code space (#\uf700-#\uf8ff)
>> to name characters produced by function keys.  Giving the character whose
>> code is #xf700 (= #$NSUpArrowFunctionKey) a name like 
>> "NSUpArrowFunctionKey"
>> might make a little bit of sense, since there's at least some context
>> in which #xf700 is used as a character code (e.g., in the NSString
>> returned by -[NSEvent characters].
>
> Yes; this is the context I'm looking at presently.
>
>
>> And yes: there should be some user-visible way of naming characters.
>> (What's there now isn't thread-safe - just intended to run in the
>> initial thread during the cold load - and isn't opaque enough.)
>> I don't think that such a mechanism should be used to confuse Carbon
>> event codes with CHAR-CODEs.
>
> So for now, it sounds like I should just add some openmcl reader macro guards 
> and hard-code the character code values until something changes in the 
> implementation.  Right?
>
> Thanks,
>
> -Brent
>



More information about the Openmcl-devel mailing list