Update Android port
* doc/lispref/commands.texi (Misc Events): Document variable `disable-inhibit-text-conversion'. * java/org/gnu/emacs/EmacsDialog.java (display1): Try an activity that is certain to be focused first. * lisp/touch-screen.el (touch-screen-track-tap) (touch-screen-track-drag): Bind `disable-inhibit-text-conversion'. * src/keyboard.c (read_key_sequence): Only disable text conversion if an actual function or numeric key is found in the key sequence. (syms_of_keyboard): New variable `disable-inhibit-text-conversion'. * src/lread.c (read_filtered_event): Check new variable. * src/textconv.c (textconv_query): Remove unused label.
This commit is contained in:
parent
aec73dba8f
commit
c74bab6067
6 changed files with 64 additions and 42 deletions
|
@ -2263,6 +2263,12 @@ that takes immediate effect, call the function
|
|||
lock up the input method for a significant amount of time, so do
|
||||
not do this lightly!
|
||||
|
||||
@vindex disable-inhibit-text-conversion
|
||||
In addition, text conversion is automatically disabled after a prefix
|
||||
key is read by the command loop, or through @code{read-key-sequence}.
|
||||
This can be disabled by setting or binding the variable
|
||||
@code{disable-inhibit-text-conversion} to a non-@code{nil} value.
|
||||
|
||||
@cindex @code{delete-frame} event
|
||||
@item (delete-frame (@var{frame}))
|
||||
This kind of event indicates that the user gave the window manager
|
||||
|
|
|
@ -244,23 +244,26 @@ private class EmacsButton implements View.OnClickListener,
|
|||
AlertDialog dialog;
|
||||
Window window;
|
||||
|
||||
/* First, try to display a dialog using the service context. */
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M
|
||||
|| Settings.canDrawOverlays (EmacsService.SERVICE))
|
||||
context = EmacsService.SERVICE;
|
||||
else if (EmacsActivity.focusedActivities.isEmpty ())
|
||||
if (EmacsActivity.focusedActivities.isEmpty ())
|
||||
{
|
||||
/* If focusedActivities is empty then this dialog may have
|
||||
been displayed immediately after a popup dialog is
|
||||
dismissed. */
|
||||
dismissed. Or Emacs might legitimately be in the
|
||||
background. Try the service context first if possible. */
|
||||
|
||||
context = EmacsActivity.lastFocusedActivity;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M
|
||||
|| Settings.canDrawOverlays (EmacsService.SERVICE))
|
||||
context = EmacsService.SERVICE;
|
||||
else
|
||||
context = EmacsActivity.lastFocusedActivity;
|
||||
|
||||
if (context == null)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
/* Display using the activity context when Emacs is in the
|
||||
foreground, as this allows the dialog to be dismissed more
|
||||
consistently. */
|
||||
context = EmacsActivity.focusedActivities.get (0);
|
||||
|
||||
Log.d (TAG, "display1: using context " + context);
|
||||
|
|
|
@ -511,20 +511,21 @@ with that event and DATA.
|
|||
|
||||
Return nil immediately if any other kind of event is received;
|
||||
otherwise, return t once the `touchscreen-end' event arrives."
|
||||
(catch 'finish
|
||||
(while t
|
||||
(let ((new-event (read-event nil)))
|
||||
(cond
|
||||
((eq (car-safe new-event) 'touchscreen-update)
|
||||
(when (and update (assq (caadr event) (cadr new-event)))
|
||||
(funcall update new-event data)))
|
||||
((eq (car-safe new-event) 'touchscreen-end)
|
||||
(throw 'finish
|
||||
;; Now determine whether or not the `touchscreen-end'
|
||||
;; event has the same ID as EVENT. If it doesn't,
|
||||
;; then this is another touch, so return nil.
|
||||
(eq (caadr event) (caadr new-event))))
|
||||
(t (throw 'finish nil)))))))
|
||||
(let ((disable-inhibit-text-conversion t))
|
||||
(catch 'finish
|
||||
(while t
|
||||
(let ((new-event (read-event nil)))
|
||||
(cond
|
||||
((eq (car-safe new-event) 'touchscreen-update)
|
||||
(when (and update (assq (caadr event) (cadr new-event)))
|
||||
(funcall update new-event data)))
|
||||
((eq (car-safe new-event) 'touchscreen-end)
|
||||
(throw 'finish
|
||||
;; Now determine whether or not the `touchscreen-end'
|
||||
;; event has the same ID as EVENT. If it doesn't,
|
||||
;; then this is another touch, so return nil.
|
||||
(eq (caadr event) (caadr new-event))))
|
||||
(t (throw 'finish nil))))))))
|
||||
|
||||
(defun touch-screen-track-drag (event update &optional data)
|
||||
"Track a single drag starting from EVENT.
|
||||
|
@ -543,7 +544,8 @@ otherwise, return either t or `no-drag' once the
|
|||
touch point in EVENT did not move significantly, and t otherwise."
|
||||
(let ((return-value 'no-drag)
|
||||
(start-xy (touch-screen-relative-xy (cdadr event)
|
||||
'frame)))
|
||||
'frame))
|
||||
(disable-inhibit-text-conversion t))
|
||||
(catch 'finish
|
||||
(while t
|
||||
(let ((new-event (read-event nil)))
|
||||
|
|
|
@ -10227,33 +10227,38 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt,
|
|||
|
||||
#ifdef HAVE_TEXT_CONVERSION
|
||||
/* When reading a key sequence while text conversion is in
|
||||
effect, turn it off after the first character read. This
|
||||
makes input methods send actual key events instead.
|
||||
effect, turn it off after the first actual character read.
|
||||
This makes input methods send actual key events instead.
|
||||
|
||||
Make sure only to do this once. Also, disabling text
|
||||
conversion seems to interact badly with menus, so don't
|
||||
disable text conversion if a menu was displayed. */
|
||||
|
||||
if (!disabled_conversion && t && !used_mouse_menu)
|
||||
if (!disabled_conversion && t && !used_mouse_menu
|
||||
&& !disable_inhibit_text_conversion)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* used_mouse_menu isn't set if a menu bar prefix key has
|
||||
just been stored. It appears necessary to look for the
|
||||
prefix key itself. */
|
||||
just been stored. It appears necessary to look for a
|
||||
prefix key itself. Don't look through too many keys for
|
||||
efficiency reasons. */
|
||||
|
||||
for (i = 0; i < t; ++i)
|
||||
for (i = 0; i < min (t, 10); ++i)
|
||||
{
|
||||
if (EQ (keybuf[i], Qmenu_bar))
|
||||
break;
|
||||
if (NUMBERP (keybuf[i])
|
||||
|| (SYMBOLP (keybuf[i])
|
||||
&& EQ (Fget (keybuf[i], Qevent_kind),
|
||||
Qfunction_key)))
|
||||
goto disable_text_conversion;
|
||||
}
|
||||
|
||||
if (i == t)
|
||||
{
|
||||
disable_text_conversion ();
|
||||
record_unwind_protect_void (resume_text_conversion);
|
||||
disabled_conversion = true;
|
||||
}
|
||||
goto replay_key;
|
||||
|
||||
disable_text_conversion:
|
||||
disable_text_conversion ();
|
||||
record_unwind_protect_void (resume_text_conversion);
|
||||
disabled_conversion = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -13377,9 +13382,16 @@ which see. */);
|
|||
DEFVAR_LISP ("post-select-region-hook", Vpost_select_region_hook,
|
||||
doc: /* Abnormal hook run after the region is selected.
|
||||
This usually happens as a result of `select-active-regions'. The hook
|
||||
is called with one argument, the string that was selected. */);;
|
||||
is called with one argument, the string that was selected. */);
|
||||
Vpost_select_region_hook = Qnil;
|
||||
|
||||
DEFVAR_LISP ("disable-inhibit-text-conversion",
|
||||
disable_inhibit_text_conversion,
|
||||
doc: /* Don't disable text conversion inside `read-key-sequence'.
|
||||
If non-nil, text conversion will continue to happen after a prefix
|
||||
key has been read inside `read-key-sequence'. */);
|
||||
disable_inhibit_text_conversion = false;
|
||||
|
||||
pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper);
|
||||
}
|
||||
|
||||
|
|
|
@ -798,7 +798,7 @@ static void substitute_in_interval (INTERVAL, void *);
|
|||
|
||||
If text conversion is enabled and ASCII_REQUIRED && ERROR_NONASCII,
|
||||
temporarily disable any input method which wants to perform
|
||||
edits. */
|
||||
edits, unless `disable-inhibit-text-conversion'. */
|
||||
|
||||
static Lisp_Object
|
||||
read_filtered_event (bool no_switch_frame, bool ascii_required,
|
||||
|
@ -821,7 +821,8 @@ read_filtered_event (bool no_switch_frame, bool ascii_required,
|
|||
/* Don't use text conversion when trying to just read a
|
||||
character. */
|
||||
|
||||
if (ascii_required && error_nonascii)
|
||||
if (ascii_required && error_nonascii
|
||||
&& !disable_inhibit_text_conversion)
|
||||
{
|
||||
disable_text_conversion ();
|
||||
record_unwind_protect_void (resume_text_conversion);
|
||||
|
|
|
@ -231,8 +231,6 @@ textconv_query (struct frame *f, struct textconv_callback_struct *query,
|
|||
}
|
||||
}
|
||||
|
||||
escape:
|
||||
|
||||
/* If pos is outside the accessible part of the buffer or if it
|
||||
overflows, move back to point or to the extremes of the
|
||||
accessible region. */
|
||||
|
|
Loading…
Add table
Reference in a new issue