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

Need to insert keydown events into MCL



In trying to make incremental searches playback correctly in my
fred-macros.lisp contribution I seem to need a new mechanism other
than my current one, which uses RUN-FRED-COMMAND. Specifically, I want
a function INSERT-KEY-EVENT that is passed a character and a list of
modifiers, and makes the Mac or MCL think the user just hit those
keys. For example:

(defun TEST-PLAYBACK ()
  (dolist (event-item '((#\r :control) (#\m) (#\a) (#\c) (#\g :control)))
    (insert-key-event (first event-item) (rest event-item))))

I looked at #_PostEvent but IM II-68 warns the modifiers will be the
current ones, so I can't pass the saved ones.

The Journaling Mechanism described starting on IM I-261 requires
writing a journaling device driver, setting global vars, etc. Seems
too much work.

An MCL-specific hack would be just fine, something that might involve
setting-up properly variables like *current-event*,
*current-keystroke*, etc. then calling do-event or whatever.

So I'd appreciate any ideas anyone might have. I'm using MCL 2.0f3.
Thanks.

matt