[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keystrokes without windows



>How can you process keystrokes without having a window open?
>
>The main problem we're having is finding and identifying the event 
>associated with a control- or option-character keystroke.  I know about 
>adding a function into the *eventhook* function.  But I don't know how 
>(within that function) to figure out if I'm looking at a keystroke event (or 
>even where to get an event).

Your *eventhook* needs to look at the event record in *current-event*.
The format of this record is documented in Inside Macintosh (look
for the EventRecord structure).

Since I think this warrants as extension of MCL's event handling,
I have prepared a patch that calls VIEW-KEY-EVENT-HANDLER with
arguments of *APPLICATION* and the keystroke if the user types a
key when no window is active. The default method beeps, but you can
write your own as follows:

(defclass my-application (application) ())

(setq *application* (make-instance 'my-application))

(defmethod view-key-event-handler ((a my-application) key)
  ...)

The patch will work standalone or if loaded after patch 1 or patch 2.
If you want it, ask for "no-window-key-events-patch".

-----
Bill St. Clair
bill@cambridge.apple.com