aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-02-17 21:31:43 +0800
committerPo Lu2023-02-17 21:31:43 +0800
commite88730a4b439b3b534048c6f419d651a4c0cc76d (patch)
treef50730706aa04830f092bbf8c1f945437a3324ff /src
parentd70bb47aeb586bfa5feb29d6f3759604eb93829a (diff)
downloademacs-e88730a4b439b3b534048c6f419d651a4c0cc76d.tar.gz
emacs-e88730a4b439b3b534048c6f419d651a4c0cc76d.zip
Work around race condition bug in Android 13's input manager
* src/androidterm.c (android_get_selection): Use ephemeral last point. * src/textconv.c (report_selected_window_change): Set w->ephemeral_last_point to the window's point now.
Diffstat (limited to 'src')
-rw-r--r--src/androidterm.c2
-rw-r--r--src/textconv.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/src/androidterm.c b/src/androidterm.c
index 8a07bfa7455..0fbee1e9867 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -4841,7 +4841,7 @@ android_get_selection (void *data)
4841 /* Return W's point at the time of the last redisplay. This is 4841 /* Return W's point at the time of the last redisplay. This is
4842 rather important to keep the input method consistent with the 4842 rather important to keep the input method consistent with the
4843 contents of the display. */ 4843 contents of the display. */
4844 context->point = w->last_point; 4844 context->point = w->ephemeral_last_point;
4845 } 4845 }
4846} 4846}
4847 4847
diff --git a/src/textconv.c b/src/textconv.c
index 8f5a4987d5a..7704f1b62a6 100644
--- a/src/textconv.c
+++ b/src/textconv.c
@@ -1477,11 +1477,24 @@ conversion_disabled_p (void)
1477void 1477void
1478report_selected_window_change (struct frame *f) 1478report_selected_window_change (struct frame *f)
1479{ 1479{
1480 struct window *w;
1481
1480 reset_frame_state (f); 1482 reset_frame_state (f);
1481 1483
1482 if (!text_interface) 1484 if (!text_interface)
1483 return; 1485 return;
1484 1486
1487 /* When called from window.c, F's selected window has already been
1488 redisplayed, but w->last_point has not yet been updated. Update
1489 it here to avoid race conditions when the IM asks for the initial
1490 selection position immediately after. */
1491
1492 if (WINDOWP (f->selected_window))
1493 {
1494 w = XWINDOW (f->selected_window);
1495 w->ephemeral_last_point = window_point (w);
1496 }
1497
1485 text_interface->reset (f); 1498 text_interface->reset (f);
1486} 1499}
1487 1500