aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-11-05 10:40:52 +0800
committerPo Lu2023-11-05 10:42:01 +0800
commitc6c5bba06fcc1c467c547e4d35abc6bc5c2f3429 (patch)
tree262a873d8d3fb851ba75e0f408740936facc023b /src
parent41e801fea1caff57203f76693ac4f0fe1ba2df03 (diff)
downloademacs-c6c5bba06fcc1c467c547e4d35abc6bc5c2f3429.tar.gz
emacs-c6c5bba06fcc1c467c547e4d35abc6bc5c2f3429.zip
Implement more Android text editing controls
* lisp/term/android-win.el (android-deactivate-mark-command): New command. (select-all, start-selecting-text, stop-selecting-text): Arrange for commands manipulating the region to be executed when these keys are registered. * src/android.c (android_get_keysym_name): Return the keysym name of each of the new keysyms introduced. * src/androidterm.c (performContextMenuAction): Save special keysyms into key events for the selectAll, startSelectingText and stopSelectingText actions.
Diffstat (limited to 'src')
-rw-r--r--src/android.c28
-rw-r--r--src/androidterm.c13
2 files changed, 40 insertions, 1 deletions
diff --git a/src/android.c b/src/android.c
index 79f16568fd4..3397ec0e740 100644
--- a/src/android.c
+++ b/src/android.c
@@ -5598,6 +5598,27 @@ android_get_keysym_name (int keysym, char *name_return, size_t size)
5598 const char *buffer; 5598 const char *buffer;
5599 jmethodID method; 5599 jmethodID method;
5600 5600
5601 /* These keysyms are special editor actions sent by the input
5602 method. */
5603
5604 switch (keysym)
5605 {
5606 case 65536 + 1:
5607 strncpy (name_return, "select-all", size - 1);
5608 name_return[size] = '\0';
5609 return;
5610
5611 case 65536 + 2:
5612 strncpy (name_return, "start-selecting-text", size - 1);
5613 name_return[size] = '\0';
5614 return;
5615
5616 case 65536 + 3:
5617 strncpy (name_return, "stop-selecting-text", size - 1);
5618 name_return[size] = '\0';
5619 return;
5620 }
5621
5601 method = service_class.name_keysym; 5622 method = service_class.name_keysym;
5602 string 5623 string
5603 = (*android_java_env)->CallNonvirtualObjectMethod (android_java_env, 5624 = (*android_java_env)->CallNonvirtualObjectMethod (android_java_env,
@@ -5607,6 +5628,13 @@ android_get_keysym_name (int keysym, char *name_return, size_t size)
5607 (jint) keysym); 5628 (jint) keysym);
5608 android_exception_check (); 5629 android_exception_check ();
5609 5630
5631 if (!string)
5632 {
5633 strncpy (name_return, "stop-selecting-text", size - 1);
5634 name_return[size] = '\0';
5635 return;
5636 }
5637
5610 buffer = (*android_java_env)->GetStringUTFChars (android_java_env, 5638 buffer = (*android_java_env)->GetStringUTFChars (android_java_env,
5611 (jstring) string, 5639 (jstring) string,
5612 NULL); 5640 NULL);
diff --git a/src/androidterm.c b/src/androidterm.c
index 4a479daf452..1593cac36ba 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -5402,11 +5402,22 @@ NATIVE_NAME (performContextMenuAction) (JNIEnv *env, jobject object,
5402 5402
5403 switch (action) 5403 switch (action)
5404 { 5404 {
5405 /* The subsequent three keycodes are addressed by
5406 android_get_keysym_name rather than in keyboard.c. */
5407
5405 case 0: /* android.R.id.selectAll */ 5408 case 0: /* android.R.id.selectAll */
5409 key = 65536 + 1;
5410 break;
5411
5406 case 1: /* android.R.id.startSelectingText */ 5412 case 1: /* android.R.id.startSelectingText */
5413 key = 65536 + 2;
5414 break;
5415
5407 case 2: /* android.R.id.stopSelectingText */ 5416 case 2: /* android.R.id.stopSelectingText */
5417 key = 65536 + 3;
5418 break;
5419
5408 default: 5420 default:
5409 /* These actions are not implemented. */
5410 return; 5421 return;
5411 5422
5412 case 3: /* android.R.id.cut */ 5423 case 3: /* android.R.id.cut */