1

使用 stumpwm,我无法使用小键盘在评估窗口中输入数字(NumLock 已打开)。通过破解 input.lisp,我发现了以下结果:

#'read-key-and-selection 将为主键盘和小键盘返回不同的值。

             1         2         3         4         5         6         7         8          9
primary pad  (10 . 16) (11 . 16) (12 . 16) (13 . 16) (14 . 16) (15 . 16) (16 . 16) (17 . 16) (18 . 16)
numpad       (87 . 16) (88 . 16) (89 . 16) (83 . 16) (84 . 16) (85 . 16) (79 . 16) (80 . 16) (81 . 16)

它会导致 #'process-input 将小键盘输入视为 :error 。

(defun read-key-or-selection ()
    (loop for ev = (xlib:process-event *display* :handler #'read-key-or-selection-handle-event :timeout nil) do
        (cond ((stringp ev)
            (return ev))
         ((and (consp ev)
               (eq (first ev) :key-press))
           (return (cdr ev))))))

(defun read-key-or-selection-handle-event (&rest event-slots &key display event-key &allow-other-keys)
    (declare (ignore display))
    (case event-key
        ((or :key-release :key-press)
         (apply 'input-handle-key-press-event event-slots))
        (:selection-notify
         (apply 'input-handle-selection-event event-slots))
        (t nil)))

(defun input-handle-key-press-event (&rest event-slots &key event-key root code state &allow-other-keys)
    (declare (ignore event-slots root))
    (list* event-key code state))

从上面的代码来看,#'xlib:process-event 似乎存在问题。但我不知道如何解决它?

请大神指点一下,谢谢!

4

1 回答 1

1

找到一种不规范的方式,但它有效。 https://github.com/sw2wolf/stumpwm/blob/master/input.lisp

于 2013-03-10T02:13:37.300 回答