]> git.eshelyaron.com Git - emacs.git/commitdiff
Resolve disagreements in accounting of tooltip positions on Android
authorPo Lu <luangruo@yahoo.com>
Sun, 7 Apr 2024 06:39:42 +0000 (14:39 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sun, 7 Apr 2024 16:34:44 +0000 (18:34 +0200)
* 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.

(cherry picked from commit 8ee1dc8f1f9aa47260f8151c9eea30fb1ccf878a)

java/org/gnu/emacs/EmacsService.java
java/org/gnu/emacs/EmacsWindow.java

index 34682feeedb7ab86cc3644f7486f9829a17229e5..052793eabaf7aebedfad62e33d783d12db8cb74b 100644 (file)
@@ -387,6 +387,23 @@ public final class EmacsService extends Service
     EmacsService.<Void>syncRunnable (task);
   }
 
+  public void
+  getLocationInWindow (final EmacsView view, final int[] coordinates)
+  {
+    FutureTask<Void> task;
+
+    task = new FutureTask<Void> (new Callable<Void> () {
+       public Void
+       call ()
+       {
+         view.getLocationInWindow (coordinates);
+         return null;
+       }
+      });
+
+    EmacsService.<Void>syncRunnable (task);
+  }
+
 \f
 
   public static void
index b0957bcab44de78063b06f6d2cf507324fb4f651..6d44cace9a284da7749740d766fc61d3ec724708 100644 (file)
@@ -1551,10 +1551,11 @@ public final class EmacsWindow extends EmacsHandleObject
   {
     int[] array;
 
-    /* This is supposed to translate coordinates to the root
-       window.  */
+    /* This is supposed to translate coordinates to the root window,
+       whose origin point, in this context, is that of the toplevel
+       activity host to this view.  */
     array = new int[2];
-    EmacsService.SERVICE.getLocationOnScreen (view, array);
+    EmacsService.SERVICE.getLocationInWindow (view, array);
 
     /* Now, the coordinates of the view should be in array.  Offset X
        and Y by them.  */