aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-10-28 10:02:58 +0800
committerPo Lu2023-10-28 10:19:41 +0800
commitf0d42c5e47eaba2c8ccee0a804965a2b71923d41 (patch)
treed49ef9b2e71da47ed4ca845ac341b95eed6ac739 /java
parenteb6708f0ac129f2faee31b1f5517641ffb38fcdf (diff)
downloademacs-f0d42c5e47eaba2c8ccee0a804965a2b71923d41.tar.gz
emacs-f0d42c5e47eaba2c8ccee0a804965a2b71923d41.zip
Minor adjustments to Android drag and drop and content URIs
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow) <dndXPosition, dndYPosition>: New fields initialized to -1. (onDragEvent): Remember the position of the previous event to avoid sending duplicates. * src/androidvfs.c (EMACS_PATH_MAX): New define. (android_saf_tree_rename, android_saf_tree_opendir) (android_name_file, android_fstatat, android_faccessat) (android_fchmodat, android_readlinkat): Use EMACS_PATH_MAX where SAF file names might be encountered.
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsWindow.java33
1 files changed, 30 insertions, 3 deletions
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java
index 7662186a0eb..d7a37a8d57f 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -152,6 +152,10 @@ public final class EmacsWindow extends EmacsHandleObject
152 /* The position of this window relative to the root window. */ 152 /* The position of this window relative to the root window. */
153 public int xPosition, yPosition; 153 public int xPosition, yPosition;
154 154
155 /* The position of the last drag and drop event received; both
156 values are -1 if no drag and drop operation is under way. */
157 private int dndXPosition, dndYPosition;
158
155 public 159 public
156 EmacsWindow (short handle, final EmacsWindow parent, int x, int y, 160 EmacsWindow (short handle, final EmacsWindow parent, int x, int y,
157 int width, int height, boolean overrideRedirect) 161 int width, int height, boolean overrideRedirect)
@@ -202,6 +206,9 @@ public final class EmacsWindow extends EmacsHandleObject
202 return size () > 10; 206 return size () > 10;
203 } 207 }
204 }; 208 };
209
210 dndXPosition = -1;
211 dndYPosition = -1;
205 } 212 }
206 213
207 public void 214 public void
@@ -1617,11 +1624,26 @@ public final class EmacsWindow extends EmacsHandleObject
1617 return true; 1624 return true;
1618 1625
1619 case DragEvent.ACTION_DRAG_LOCATION: 1626 case DragEvent.ACTION_DRAG_LOCATION:
1620 /* Send this drag motion event to Emacs. */ 1627 /* Send this drag motion event to Emacs. Skip this when the
1621 EmacsNative.sendDndDrag (handle, x, y); 1628 integer position hasn't changed, for Android sends events
1629 even if the movement from the previous position of the drag
1630 is less than 1 pixel on either axis. */
1631
1632 if (x != dndXPosition || y != dndYPosition)
1633 {
1634 EmacsNative.sendDndDrag (handle, x, y);
1635 dndXPosition = x;
1636 dndYPosition = y;
1637 }
1638
1622 return true; 1639 return true;
1623 1640
1624 case DragEvent.ACTION_DROP: 1641 case DragEvent.ACTION_DROP:
1642 /* Reset this view's record of the previous drag and drop
1643 event's position. */
1644 dndXPosition = -1;
1645 dndYPosition = -1;
1646
1625 /* Judge whether this is plain text, or if it's a file URI for 1647 /* Judge whether this is plain text, or if it's a file URI for
1626 which permissions must be requested. */ 1648 which permissions must be requested. */
1627 1649
@@ -1706,8 +1728,13 @@ public final class EmacsWindow extends EmacsHandleObject
1706 1728
1707 if (builder.length () > 0) 1729 if (builder.length () > 0)
1708 EmacsNative.sendDndUri (handle, x, y, builder.toString ()); 1730 EmacsNative.sendDndUri (handle, x, y, builder.toString ());
1709
1710 return true; 1731 return true;
1732
1733 default:
1734 /* Reset this view's record of the previous drag and drop
1735 event's position. */
1736 dndXPosition = -1;
1737 dndYPosition = -1;
1711 } 1738 }
1712 1739
1713 return true; 1740 return true;