1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Move ns-specific event setup to term/ns-win.el (Bug#74619)

* lisp/term/ns-win.el (ns-setup-special-keys): New function,
contains event setup code previously in term/common-win.el.
Call it at top-level.
* lisp/term/common-win.el (x-setup-function-keys): Call
'ns-setup-special-keys'.
This commit is contained in:
Robert Pluim 2024-12-10 09:42:11 +01:00
parent be51f13491
commit ebd8feef14
2 changed files with 24 additions and 16 deletions

View file

@ -45,6 +45,8 @@
map)
"Keymap of possible alternative meanings for some keys.")
(declare-function ns-setup-special-keys "term/ns-win" ())
(defun x-setup-function-keys (frame)
"Set up `function-key-map' on the graphical frame FRAME."
;; Don't do this twice on the same display, or it would break
@ -56,22 +58,7 @@
(set-keymap-parent map (keymap-parent local-function-key-map))
(set-keymap-parent local-function-key-map map))
(when (featurep 'ns)
(setq system-key-alist
(list
;; These are special "keys" used to pass events from C to lisp.
(cons 1 (make-non-key-event 'ns-power-off))
(cons 2 (make-non-key-event 'ns-open-file))
(cons 3 (make-non-key-event 'ns-open-temp-file))
(cons 4 (make-non-key-event 'ns-drag-file))
(cons 5 (make-non-key-event 'ns-drag-color))
(cons 6 (make-non-key-event 'ns-drag-text))
(cons 8 (make-non-key-event 'ns-open-file-line))
;;; (cons 9 (make-non-key-event 'ns-insert-working-text))
;;; (cons 10 (make-non-key-event 'ns-delete-working-text))
(cons 11 (make-non-key-event 'ns-spi-service-call))
(cons 12 (make-non-key-event 'ns-new-frame))
(cons 13 (make-non-key-event 'ns-toggle-toolbar))
(cons 14 (make-non-key-event 'ns-show-prefs))))))
(ns-setup-special-keys)))
(set-terminal-parameter frame 'x-setup-function-keys t)))
(defvar x-invocation-args)

View file

@ -168,6 +168,27 @@ The properties returned may include `top', `left', `height', and `width'."
(define-key global-map [S-mouse-1] 'mouse-save-then-kill)
(global-unset-key [S-down-mouse-1])
;; Moved here from common-win.el because they need to work in a -nw
;; invocation of a (featurep 'ns) => true build (Bug#74619).
(defun ns-setup-special-keys ()
(setq system-key-alist
(list
;; These are special "keys" used to pass events from C to lisp.
(cons 1 (make-non-key-event 'ns-power-off))
(cons 2 (make-non-key-event 'ns-open-file))
(cons 3 (make-non-key-event 'ns-open-temp-file))
(cons 4 (make-non-key-event 'ns-drag-file))
(cons 5 (make-non-key-event 'ns-drag-color))
(cons 6 (make-non-key-event 'ns-drag-text))
(cons 8 (make-non-key-event 'ns-open-file-line))
;;; (cons 9 (make-non-key-event 'ns-insert-working-text))
;;; (cons 10 (make-non-key-event 'ns-delete-working-text))
(cons 11 (make-non-key-event 'ns-spi-service-call))
(cons 12 (make-non-key-event 'ns-new-frame))
(cons 13 (make-non-key-event 'ns-toggle-toolbar))
(cons 14 (make-non-key-event 'ns-show-prefs)))))
(ns-setup-special-keys)
;; Special Nextstep-generated events are converted to function keys. Here
;; are the bindings for them. Note, these keys are actually declared in
;; x-setup-function-keys in common-win.