From bd1ff644ec25c6118bf6a8e54f150d866b3cc2f1 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 13 Jun 2024 10:46:59 +0800 Subject: [PATCH] Correctly define `select' binding on Android * lisp/term/android-win.el (input-decode-map): Cease binding select in the initial frame's input-decode-map. * src/androidterm.c (android_term_init): Binding select in the freshly created kboard. (syms_of_androidterm) : New symbols. (cherry picked from commit 94bcd7964bbb20bc8ff8a91a9656452a97139d60) --- lisp/term/android-win.el | 3 --- src/androidterm.c | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lisp/term/android-win.el b/lisp/term/android-win.el index 0d2d0299282..3e0f71abf91 100644 --- a/lisp/term/android-win.el +++ b/lisp/term/android-win.el @@ -627,9 +627,6 @@ accessible to other programs." (global-set-key [\83] #'ignore) ; KEYCODE_NOTIFICATION on pre-Honeycomb ; releases. -;; `select' key, which I suppose amounts to return. -(define-key input-decode-map [select] [return]) - (provide 'android-win) ;; android-win.el ends here. diff --git a/src/androidterm.c b/src/androidterm.c index 94a115a66a6..f98da97eeba 100644 --- a/src/androidterm.c +++ b/src/androidterm.c @@ -33,6 +33,7 @@ along with GNU Emacs. If not, see . */ #include "textconv.h" #include "coding.h" #include "pdumper.h" +#include "keymap.h" /* This is a chain of structures for all the X displays currently in use. */ @@ -6641,7 +6642,7 @@ android_term_init (void) dpyinfo->resx = android_pixel_density_x; dpyinfo->resy = android_pixel_density_y; dpyinfo->font_resolution = android_scaled_pixel_density; -#endif /* ANDROID_STUBIFY */ +#endif /* !ANDROID_STUBIFY */ /* https://lists.gnu.org/r/emacs-devel/2015-11/msg00194.html */ dpyinfo->smallest_font_height = 1; @@ -6679,7 +6680,13 @@ android_term_init (void) #ifndef ANDROID_STUBIFY sem_init (&edit_sem, false, 0); register_textconv_interface (&text_conversion_interface); -#endif +#endif /* !ANDROID_STUBIFY */ + + /* Binding certain key events in the terminal's `input-decode-map', + which being keyboard-local is not accessible from any point in + android-win.el. */ + Fdefine_key (KVAR (terminal->kboard, Vinput_decode_map), + make_vector (1, Qselect), Qreturn, Qnil); } @@ -6907,6 +6914,10 @@ for instance, `early-init.el', or they will be of no effect. */); Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier)); DEFSYM (Qsuper, "super"); Fput (Qsuper, Qmodifier_value, make_fixnum (super_modifier)); + + /* Key symbols. */ + DEFSYM (Qselect, "select"); + DEFSYM (Qreturn, "return"); } void -- 2.39.2