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
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);
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.
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)))
#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
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);
}
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,
/* 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);
}
}
- 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. */