\f
;;;; Function keys
-(substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
- global-map)
-
(defun x-setup-function-keys (frame)
"Setup Function Keys for mac."
-;; Map certain keypad keys into ASCII characters
-;; that people usually expect.
-(define-key local-function-key-map [backspace] [?\d])
-(define-key local-function-key-map [delete] [?\d])
-(define-key local-function-key-map [tab] [?\t])
-(define-key local-function-key-map [linefeed] [?\n])
-(define-key local-function-key-map [clear] [?\C-l])
-(define-key local-function-key-map [return] [?\C-m])
-(define-key local-function-key-map [escape] [?\e])
-(define-key local-function-key-map [M-backspace] [?\M-\d])
-(define-key local-function-key-map [M-delete] [?\M-\d])
-(define-key local-function-key-map [M-tab] [?\M-\t])
-(define-key local-function-key-map [M-linefeed] [?\M-\n])
-(define-key local-function-key-map [M-clear] [?\M-\C-l])
-(define-key local-function-key-map [M-return] [?\M-\C-m])
-(define-key local-function-key-map [M-escape] [?\M-\e])
-)
+ ;; Don't do this twice on the same display, or it would break
+ ;; normal-erase-is-backspace-mode.
+ (unless (terminal-parameter frame 'x-setup-function-keys)
+ (with-selected-frame frame
+ ;; Map certain keypad keys into ASCII characters
+ ;; that people usually expect.
+ (define-key local-function-key-map [backspace] [?\d])
+ (define-key local-function-key-map [delete] [?\d])
+ (define-key local-function-key-map [tab] [?\t])
+ (define-key local-function-key-map [linefeed] [?\n])
+ (define-key local-function-key-map [clear] [?\C-l])
+ (define-key local-function-key-map [return] [?\C-m])
+ (define-key local-function-key-map [escape] [?\e])
+ (define-key local-function-key-map [M-backspace] [?\M-\d])
+ (define-key local-function-key-map [M-delete] [?\M-\d])
+ (define-key local-function-key-map [M-tab] [?\M-\t])
+ (define-key local-function-key-map [M-linefeed] [?\M-\n])
+ (define-key local-function-key-map [M-clear] [?\M-\C-l])
+ (define-key local-function-key-map [M-return] [?\M-\C-m])
+ (define-key local-function-key-map [M-escape] [?\M-\e])
+ (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
+ local-function-key-map global-map))
+ (set-terminal-parameter frame 'x-setup-function-keys t))))
;; These tell read-char how to convert
;; these special chars to ASCII.
if (EQ (display, Qunbound))
display = Qnil;
dpyinfo = check_x_display_info (display);
-#ifdef MULTI_KBOARD
kb = dpyinfo->terminal->kboard;
-#else
- kb = &the_only_kboard;
-#endif
name = mac_get_arg (parameters, Qname, "name", "Name", RES_TYPE_STRING);
if (!STRINGP (name)
image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
dpyinfo_refcount = dpyinfo->reference_count;
#endif /* GLYPH_DEBUG */
-#ifdef MULTI_KBOARD
FRAME_KBOARD (f) = kb;
-#endif
/* Specify the parent under which to make this window. */
parms = Fcopy_alist (parms);
-#ifdef MULTI_KBOARD
kb = dpyinfo->terminal->kboard;
-#else
- kb = &the_only_kboard;
-#endif
/* Get the name of the frame to use for resource lookup. */
name = mac_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING);
image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
dpyinfo_refcount = dpyinfo->reference_count;
#endif /* GLYPH_DEBUG */
-#ifdef MULTI_KBOARD
FRAME_KBOARD (f) = kb;
-#endif
f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
f->output_data.mac->explicit_parent = 0;
/* FIXME: This keyboard setup is 100% untested, just copied from
w32_create_terminal in order to set window-system now that it's
a keyboard object. */
-#ifdef MULTI_KBOARD
/* We don't yet support separate terminals on Mac, so don't try to share
keyboards between virtual terminals that are on the same physical
terminal like X does. */
if (current_kboard == initial_kboard)
current_kboard = terminal->kboard;
terminal->kboard->reference_count++;
-#endif
return terminal;
}