Update Android port

* java/org/gnu/emacs/EmacsWindow.java (figureChange): Detect
mice on up events as well.
(onSomeKindOfMotionEvent): Work past framework bug.
* src/androidterm.c (android_perform_conversion_query):
* src/textconv.c (textconv_query):
* src/textconv.h (TEXTCONV_SKIP_ACTIVE_REGION): Remove unused
code.
This commit is contained in:
Po Lu 2023-03-14 13:19:01 +08:00
parent 5964051fce
commit d6bddca26c
4 changed files with 33 additions and 39 deletions

View file

@ -755,6 +755,14 @@ private static class Coordinate
break;
case MotionEvent.ACTION_UP:
/* Detect mice. If this is a mouse event, give it to
onSomeKindOfMotionEvent. */
if ((Build.VERSION.SDK_INT
>= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
&& event.getToolType (0) == MotionEvent.TOOL_TYPE_MOUSE)
return -2;
/* Primary pointer released with index 0. */
pointerID = event.getPointerId (0);
pointerMap.remove (pointerID);
@ -916,6 +924,7 @@ else if (event.getSource () != InputDevice.SOURCE_CLASS_POINTER)
EmacsNative.sendLeaveNotify (this.handle, (int) event.getX (),
(int) event.getY (),
event.getEventTime ());
return true;
case MotionEvent.ACTION_BUTTON_PRESS:
@ -949,13 +958,35 @@ else if (event.getSource () != InputDevice.SOURCE_CLASS_POINTER)
return true;
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
/* Emacs must return true even though touch events are not
handled here, because the value of this function is used by
the system to decide whether or not Emacs gets ACTION_MOVE
events. */
return true;
case MotionEvent.ACTION_UP:
/* However, if ACTION_UP reports a different button state from
the last known state, look up which button was released and
send a ButtonRelease event; this is to work around a bug in
the framework where real ACTION_BUTTON_RELEASE events are
not delivered. */
if (Build.VERSION.SDK_INT
< Build.VERSION_CODES.ICE_CREAM_SANDWICH)
return true;
if (event.getButtonState () == 0 && lastButtonState != 0)
{
EmacsNative.sendButtonRelease (this.handle, (int) event.getX (),
(int) event.getY (),
event.getEventTime (),
lastModifiers,
whatButtonWasIt (event, false));
lastButtonState = event.getButtonState ();
}
return true;
case MotionEvent.ACTION_SCROLL:
/* Send a scroll event with the specified deltas. */
EmacsNative.sendWheel (this.handle, (int) event.getX (),

View file

@ -4685,8 +4685,6 @@ struct android_conversion_query_context
/* Obtain the text from the frame whose window is that specified in
DATA using the text conversion query specified there.
Adjust the query position to skip over any active composing region.
Set ((struct android_conversion_query_context *) DATA)->success on
success. */
@ -4704,7 +4702,7 @@ android_perform_conversion_query (void *data)
if (!f)
return;
textconv_query (f, &context->query, TEXTCONV_SKIP_ACTIVE_REGION);
textconv_query (f, &context->query, 0);
/* context->query.text will have been set even if textconv_query
returns 1. */

View file

@ -147,9 +147,6 @@ select_window (Lisp_Object window, Lisp_Object norecord)
If FLAGS & TEXTCONV_SKIP_CONVERSION_REGION, then first move PT past
the conversion region in the specified direction if it is inside.
If FLAGS & TEXTCONV_SKIP_ACTIVE_REGION, then also move PT past the
region if the mark is active.
Value is 0 if QUERY->operation was not TEXTCONV_SUBSTITUTION
or if deleting the text was successful, and 1 otherwise. */
@ -234,37 +231,6 @@ textconv_query (struct frame *f, struct textconv_callback_struct *query,
}
}
/* Likewise for the region if the mark is active. */
if (flags & TEXTCONV_SKIP_ACTIVE_REGION)
{
temp = mark;
if (temp == -1)
goto escape;
start = min (temp, PT);
end = max (temp, PT);
if (pos >= start && pos < end)
{
switch (query->direction)
{
case TEXTCONV_FORWARD_CHAR:
case TEXTCONV_FORWARD_WORD:
case TEXTCONV_CARET_DOWN:
case TEXTCONV_NEXT_LINE:
case TEXTCONV_LINE_START:
pos = end;
break;
default:
pos = max (BEGV, start);
break;
}
}
}
escape:
/* If pos is outside the accessible part of the buffer or if it

View file

@ -119,7 +119,6 @@ struct textconv_callback_struct
};
#define TEXTCONV_SKIP_CONVERSION_REGION (1 << 0)
#define TEXTCONV_SKIP_ACTIVE_REGION (1 << 1)
extern int textconv_query (struct frame *, struct textconv_callback_struct *,
int);