Changeset 12430


Ignore:
Timestamp:
Jul 20, 2009, 11:46:50 AM (10 years ago)
Author:
gb
Message:

Try to un-break the recent changes that led to ticket:562. Rather
than trying to determine whether or not a key-event is bound to
a "System Default Behavior" command, introduce HI:NATIVE-KEY-EVENT-P
(which is SETFable). The former approach broke ESCAPE (and other
things) because a "key" can actually be a sequence (involving prefixes,
etc.) and parsing that sequence is stateful.

There are still some issues with this approach (what happens if a "native
key event" is pressed while in the middle of a prefixed sequence ? Should
we clean up that state ?) but it avoids the stateful parsing issues, and
it may be more intuitive to say that something is a "native key event" than
it would be to say that it's bount to a magic Hemlock command that causes
it to be treated like one.

Location:
trunk/source/cocoa-ide
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/cocoa-editor.lisp

    r12422 r12430  
    984984           (let ((hemlock-key (nsevent-to-key-event event quote-p)))
    985985             (if (and hemlock-key
    986                       (not (hi::bound-to-system-default-behavior-p view hemlock-key)))
     986                      (not (hi:native-key-event-p hemlock-key)))
    987987               (progn
    988988                 (#/setHiddenUntilMouseMoves: ns:ns-cursor t)
  • trunk/source/cocoa-ide/hemlock/src/command.lisp

    r12422 r12430  
    4545(add-hook make-buffer-hook #'hcmd-new-buffer-hook-fun)
    4646(dolist (buff *buffer-list*) (hcmd-new-buffer-hook-fun buff))
    47 
    48 
    49 (defcommand "System Default Behavior" (p)
    50   "Pass the native key event to which this command is bound to the native
    51 window system."
    52   "Pass the native key event to which this command is bound to the native
    53 window system."
    54   (declare (ignore p))
    55   (editor-error "This command shouldn't be called."))
    5647
    5748
  • trunk/source/cocoa-ide/hemlock/src/interp.lisp

    r12422 r12430  
    416416  ;; Get the command used to invoke "System Default Behavior"
    417417  (getstring (value hemlock::system-default-behavior-command-name) *command-names*))
     418
     419(defvar *native-key-events* (make-hash-table :test #'eq))
     420
     421
     422
     423(defun native-key-event-p (key)
     424  (check-type key key-event)
     425  (gethash key *native-key-events*))
     426
     427
     428(defun (setf native-key-event-p) (flag key)
     429  (check-type key key-event)
     430  (if flag
     431    (setf (gethash key *native-key-events*) flag)
     432    (remhash key *native-key-events*)))
  • trunk/source/cocoa-ide/hemlock/src/main.lisp

    r12422 r12430  
    155155     defined.  By default, this is \"Illegal\"."
    156156    :value "Illegal")
    157   (defhvar "System Default Behavior Command Name"
    158     "The name of the command to handle keys which should by handled by the
    159      native window system (not by Hemlock.)
    160      By default, this is \"System Default Behavior\"."
    161     :value "System Default Behavior")
    162157  )
    163158
  • trunk/source/cocoa-ide/hemlock/src/package.lisp

    r12324 r12430  
    441441   #:abort-to-toplevel #:abort-current-command
    442442   #:set-scroll-position
     443   #:native-key-event-p
    443444
    444445   ;; from line.lisp
  • trunk/source/cocoa-ide/hemlock/src/views.lisp

    r12422 r12430  
    209209           (invoke-command main-binding *last-prefix-argument*)))))))
    210210
    211 (defmethod bound-to-system-default-behavior-p ((view hemlock-view)
    212                                                key)
    213   (eq (get-command-binding-for-key view key)
    214       (hi::get-system-default-behavior-command)))
    215211
    216212
Note: See TracChangeset for help on using the changeset viewer.