Dismiss Android Back key events that are canceled
* java/org/gnu/emacs/EmacsWindow.java (onKeyDown): Disregard KEYCODE_BACK events. (onKeyUp): If the event is KEYCODE_BACK, deliver the disregarded key press event, unless FLAG_CANCELED is set.
This commit is contained in:
parent
505edceaf4
commit
207ee7f988
1 changed files with 31 additions and 6 deletions
|
@ -648,6 +648,21 @@ private static class Coordinate
|
|||
long serial;
|
||||
String characters;
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK)
|
||||
{
|
||||
/* New Android systems display Back navigation buttons on a
|
||||
row of virtual buttons at the bottom of the screen. These
|
||||
buttons function much as physical buttons do, in that key
|
||||
down events are produced when a finger taps them, even if
|
||||
the finger is not ultimately released after the OS's
|
||||
gesture navigation is activated.
|
||||
|
||||
Deliver onKeyDown events in onKeyUp instead, so as not to
|
||||
navigate backwards during gesture navigation. */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
state = eventModifiers (event);
|
||||
|
||||
/* Ignore meta-state understood by Emacs for now, or key presses
|
||||
|
@ -677,7 +692,7 @@ private static class Coordinate
|
|||
public void
|
||||
onKeyUp (int keyCode, KeyEvent event)
|
||||
{
|
||||
int state, state_1;
|
||||
int state, state_1, unicode_char;
|
||||
long time;
|
||||
|
||||
/* Compute the event's modifier mask. */
|
||||
|
@ -691,11 +706,21 @@ private static class Coordinate
|
|||
= state & ~(KeyEvent.META_ALT_MASK | KeyEvent.META_CTRL_MASK
|
||||
| KeyEvent.META_SYM_ON | KeyEvent.META_META_MASK);
|
||||
|
||||
EmacsNative.sendKeyRelease (this.handle,
|
||||
event.getEventTime (),
|
||||
state, keyCode,
|
||||
getEventUnicodeChar (event,
|
||||
state_1));
|
||||
unicode_char = getEventUnicodeChar (event, state_1);
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK)
|
||||
{
|
||||
/* If the key press's been canceled, return immediately. */
|
||||
|
||||
if ((event.getFlags () & KeyEvent.FLAG_CANCELED) != 0)
|
||||
return;
|
||||
|
||||
EmacsNative.sendKeyPress (this.handle, event.getEventTime (),
|
||||
state, keyCode, unicode_char);
|
||||
}
|
||||
|
||||
EmacsNative.sendKeyRelease (this.handle, event.getEventTime (),
|
||||
state, keyCode, unicode_char);
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue