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);
EmacsNative.sendLeaveNotify (this.handle, (int) event.getX (),
(int) event.getY (),
event.getEventTime ());
+
return true;
case MotionEvent.ACTION_BUTTON_PRESS:
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 (),
/* 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. */
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. */
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. */
}
}
- /* 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