aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2024-04-07 14:39:42 +0800
committerPo Lu2024-04-07 14:51:29 +0800
commit8ee1dc8f1f9aa47260f8151c9eea30fb1ccf878a (patch)
tree1e3ba7d7b803b83ca80eca1d23565b56f004cac4 /java
parentc7a0e4faa2a584063e4ace0ac4da8fb0ae1c5e50 (diff)
downloademacs-8ee1dc8f1f9aa47260f8151c9eea30fb1ccf878a.tar.gz
emacs-8ee1dc8f1f9aa47260f8151c9eea30fb1ccf878a.zip
Resolve disagreements in accounting of tooltip positions on Android
* java/org/gnu/emacs/EmacsService.java (getLocationInWindow): New function. * java/org/gnu/emacs/EmacsWindow.java (translateCoordinates): Derive "root window" position from the origin point of the containing activity's window rather than that of the screen, the two of which differ when "freeform mode" is enabled.
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsService.java17
-rw-r--r--java/org/gnu/emacs/EmacsWindow.java7
2 files changed, 21 insertions, 3 deletions
diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java
index 34682feeedb..052793eabaf 100644
--- a/java/org/gnu/emacs/EmacsService.java
+++ b/java/org/gnu/emacs/EmacsService.java
@@ -387,6 +387,23 @@ public final class EmacsService extends Service
387 EmacsService.<Void>syncRunnable (task); 387 EmacsService.<Void>syncRunnable (task);
388 } 388 }
389 389
390 public void
391 getLocationInWindow (final EmacsView view, final int[] coordinates)
392 {
393 FutureTask<Void> task;
394
395 task = new FutureTask<Void> (new Callable<Void> () {
396 public Void
397 call ()
398 {
399 view.getLocationInWindow (coordinates);
400 return null;
401 }
402 });
403
404 EmacsService.<Void>syncRunnable (task);
405 }
406
390 407
391 408
392 public static void 409 public static void
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java
index 91e97fa8b61..911e082144e 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -1551,10 +1551,11 @@ public final class EmacsWindow extends EmacsHandleObject
1551 { 1551 {
1552 int[] array; 1552 int[] array;
1553 1553
1554 /* This is supposed to translate coordinates to the root 1554 /* This is supposed to translate coordinates to the root window,
1555 window. */ 1555 whose origin point, in this context, is that of the toplevel
1556 activity host to this view. */
1556 array = new int[2]; 1557 array = new int[2];
1557 EmacsService.SERVICE.getLocationOnScreen (view, array); 1558 EmacsService.SERVICE.getLocationInWindow (view, array);
1558 1559
1559 /* Now, the coordinates of the view should be in array. Offset X 1560 /* Now, the coordinates of the view should be in array. Offset X
1560 and Y by them. */ 1561 and Y by them. */