aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-03-14 13:19:01 +0800
committerPo Lu2023-03-14 13:19:01 +0800
commitd6bddca26c7cf827e098ae783e865fcbcdd48799 (patch)
treeaba22e667c97e4418e84171309f46b9f2e4e7509
parent5964051fcefc52e02c88a41b91797cc7a785d550 (diff)
downloademacs-d6bddca26c7cf827e098ae783e865fcbcdd48799.tar.gz
emacs-d6bddca26c7cf827e098ae783e865fcbcdd48799.zip
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.
-rw-r--r--java/org/gnu/emacs/EmacsWindow.java33
-rw-r--r--src/androidterm.c4
-rw-r--r--src/textconv.c34
-rw-r--r--src/textconv.h1
4 files changed, 33 insertions, 39 deletions
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java
index d786c104153..a8d1beedef7 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -755,6 +755,14 @@ public final class EmacsWindow extends EmacsHandleObject
755 break; 755 break;
756 756
757 case MotionEvent.ACTION_UP: 757 case MotionEvent.ACTION_UP:
758
759 /* Detect mice. If this is a mouse event, give it to
760 onSomeKindOfMotionEvent. */
761 if ((Build.VERSION.SDK_INT
762 >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
763 && event.getToolType (0) == MotionEvent.TOOL_TYPE_MOUSE)
764 return -2;
765
758 /* Primary pointer released with index 0. */ 766 /* Primary pointer released with index 0. */
759 pointerID = event.getPointerId (0); 767 pointerID = event.getPointerId (0);
760 pointerMap.remove (pointerID); 768 pointerMap.remove (pointerID);
@@ -916,6 +924,7 @@ public final class EmacsWindow extends EmacsHandleObject
916 EmacsNative.sendLeaveNotify (this.handle, (int) event.getX (), 924 EmacsNative.sendLeaveNotify (this.handle, (int) event.getX (),
917 (int) event.getY (), 925 (int) event.getY (),
918 event.getEventTime ()); 926 event.getEventTime ());
927
919 return true; 928 return true;
920 929
921 case MotionEvent.ACTION_BUTTON_PRESS: 930 case MotionEvent.ACTION_BUTTON_PRESS:
@@ -949,13 +958,35 @@ public final class EmacsWindow extends EmacsHandleObject
949 return true; 958 return true;
950 959
951 case MotionEvent.ACTION_DOWN: 960 case MotionEvent.ACTION_DOWN:
952 case MotionEvent.ACTION_UP:
953 /* Emacs must return true even though touch events are not 961 /* Emacs must return true even though touch events are not
954 handled here, because the value of this function is used by 962 handled here, because the value of this function is used by
955 the system to decide whether or not Emacs gets ACTION_MOVE 963 the system to decide whether or not Emacs gets ACTION_MOVE
956 events. */ 964 events. */
957 return true; 965 return true;
958 966
967 case MotionEvent.ACTION_UP:
968 /* However, if ACTION_UP reports a different button state from
969 the last known state, look up which button was released and
970 send a ButtonRelease event; this is to work around a bug in
971 the framework where real ACTION_BUTTON_RELEASE events are
972 not delivered. */
973
974 if (Build.VERSION.SDK_INT
975 < Build.VERSION_CODES.ICE_CREAM_SANDWICH)
976 return true;
977
978 if (event.getButtonState () == 0 && lastButtonState != 0)
979 {
980 EmacsNative.sendButtonRelease (this.handle, (int) event.getX (),
981 (int) event.getY (),
982 event.getEventTime (),
983 lastModifiers,
984 whatButtonWasIt (event, false));
985 lastButtonState = event.getButtonState ();
986 }
987
988 return true;
989
959 case MotionEvent.ACTION_SCROLL: 990 case MotionEvent.ACTION_SCROLL:
960 /* Send a scroll event with the specified deltas. */ 991 /* Send a scroll event with the specified deltas. */
961 EmacsNative.sendWheel (this.handle, (int) event.getX (), 992 EmacsNative.sendWheel (this.handle, (int) event.getX (),
diff --git a/src/androidterm.c b/src/androidterm.c
index 72d81744128..0110c4b6dd8 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -4685,8 +4685,6 @@ struct android_conversion_query_context
4685/* Obtain the text from the frame whose window is that specified in 4685/* Obtain the text from the frame whose window is that specified in
4686 DATA using the text conversion query specified there. 4686 DATA using the text conversion query specified there.
4687 4687
4688 Adjust the query position to skip over any active composing region.
4689
4690 Set ((struct android_conversion_query_context *) DATA)->success on 4688 Set ((struct android_conversion_query_context *) DATA)->success on
4691 success. */ 4689 success. */
4692 4690
@@ -4704,7 +4702,7 @@ android_perform_conversion_query (void *data)
4704 if (!f) 4702 if (!f)
4705 return; 4703 return;
4706 4704
4707 textconv_query (f, &context->query, TEXTCONV_SKIP_ACTIVE_REGION); 4705 textconv_query (f, &context->query, 0);
4708 4706
4709 /* context->query.text will have been set even if textconv_query 4707 /* context->query.text will have been set even if textconv_query
4710 returns 1. */ 4708 returns 1. */
diff --git a/src/textconv.c b/src/textconv.c
index 900277016f2..91f6e861c60 100644
--- a/src/textconv.c
+++ b/src/textconv.c
@@ -147,9 +147,6 @@ select_window (Lisp_Object window, Lisp_Object norecord)
147 If FLAGS & TEXTCONV_SKIP_CONVERSION_REGION, then first move PT past 147 If FLAGS & TEXTCONV_SKIP_CONVERSION_REGION, then first move PT past
148 the conversion region in the specified direction if it is inside. 148 the conversion region in the specified direction if it is inside.
149 149
150 If FLAGS & TEXTCONV_SKIP_ACTIVE_REGION, then also move PT past the
151 region if the mark is active.
152
153 Value is 0 if QUERY->operation was not TEXTCONV_SUBSTITUTION 150 Value is 0 if QUERY->operation was not TEXTCONV_SUBSTITUTION
154 or if deleting the text was successful, and 1 otherwise. */ 151 or if deleting the text was successful, and 1 otherwise. */
155 152
@@ -234,37 +231,6 @@ textconv_query (struct frame *f, struct textconv_callback_struct *query,
234 } 231 }
235 } 232 }
236 233
237 /* Likewise for the region if the mark is active. */
238
239 if (flags & TEXTCONV_SKIP_ACTIVE_REGION)
240 {
241 temp = mark;
242
243 if (temp == -1)
244 goto escape;
245
246 start = min (temp, PT);
247 end = max (temp, PT);
248
249 if (pos >= start && pos < end)
250 {
251 switch (query->direction)
252 {
253 case TEXTCONV_FORWARD_CHAR:
254 case TEXTCONV_FORWARD_WORD:
255 case TEXTCONV_CARET_DOWN:
256 case TEXTCONV_NEXT_LINE:
257 case TEXTCONV_LINE_START:
258 pos = end;
259 break;
260
261 default:
262 pos = max (BEGV, start);
263 break;
264 }
265 }
266 }
267
268 escape: 234 escape:
269 235
270 /* If pos is outside the accessible part of the buffer or if it 236 /* If pos is outside the accessible part of the buffer or if it
diff --git a/src/textconv.h b/src/textconv.h
index 9bc9e7d9bd1..6abca97bc52 100644
--- a/src/textconv.h
+++ b/src/textconv.h
@@ -119,7 +119,6 @@ struct textconv_callback_struct
119}; 119};
120 120
121#define TEXTCONV_SKIP_CONVERSION_REGION (1 << 0) 121#define TEXTCONV_SKIP_CONVERSION_REGION (1 << 0)
122#define TEXTCONV_SKIP_ACTIVE_REGION (1 << 1)
123 122
124extern int textconv_query (struct frame *, struct textconv_callback_struct *, 123extern int textconv_query (struct frame *, struct textconv_callback_struct *,
125 int); 124 int);