/* The position of this window relative to the root window. */
public int xPosition, yPosition;
+ /* The position of the last drag and drop event received; both
+ values are -1 if no drag and drop operation is under way. */
+ private int dndXPosition, dndYPosition;
+
public
EmacsWindow (short handle, final EmacsWindow parent, int x, int y,
int width, int height, boolean overrideRedirect)
return size () > 10;
}
};
+
+ dndXPosition = -1;
+ dndYPosition = -1;
}
public void
return true;
case DragEvent.ACTION_DRAG_LOCATION:
- /* Send this drag motion event to Emacs. */
- EmacsNative.sendDndDrag (handle, x, y);
+ /* Send this drag motion event to Emacs. Skip this when the
+ integer position hasn't changed, for Android sends events
+ even if the movement from the previous position of the drag
+ is less than 1 pixel on either axis. */
+
+ if (x != dndXPosition || y != dndYPosition)
+ {
+ EmacsNative.sendDndDrag (handle, x, y);
+ dndXPosition = x;
+ dndYPosition = y;
+ }
+
return true;
case DragEvent.ACTION_DROP:
+ /* Reset this view's record of the previous drag and drop
+ event's position. */
+ dndXPosition = -1;
+ dndYPosition = -1;
+
/* Judge whether this is plain text, or if it's a file URI for
which permissions must be requested. */
if (builder.length () > 0)
EmacsNative.sendDndUri (handle, x, y, builder.toString ());
-
return true;
+
+ default:
+ /* Reset this view's record of the previous drag and drop
+ event's position. */
+ dndXPosition = -1;
+ dndYPosition = -1;
}
return true;
\f
+/* Account for SAF file names two times as large as PATH_MAX; larger
+ values are prohibitively slow, but smaller values can't face up to
+ some long file names within several nested layers of directories.
+
+ Buffers holding components or other similar file name constitutents
+ which don't represent SAF files must continue to use PATH_MAX, for
+ that is the restriction imposed by the Unix file system. */
+
+#define EMACS_PATH_MAX (PATH_MAX * 2)
+
/* Delete redundant instances of `.' and `..' from NAME in-place.
NAME must be *LENGTH long, excluding a mandatory trailing NULL
byte.
{
char *last, *dst_last;
struct android_saf_tree_vnode *vp, *vdst;
- char path[PATH_MAX], path1[PATH_MAX];
+ char path[EMACS_PATH_MAX], path1[EMACS_PATH_MAX];
char *fill, *dst_id;
int rc;
/* The names of the source and destination directories will have
to be copied to path. */
- if (last - vp->name >= PATH_MAX
- || dst_last - vdst->name >= PATH_MAX)
+ if (last - vp->name >= EMACS_PATH_MAX
+ || dst_last - vdst->name >= EMACS_PATH_MAX)
{
errno = ENAMETOOLONG;
return -1;
directory is required, as it provides the directory whose entries
will be modified. */
- if (last - vp->name >= PATH_MAX)
+ if (last - vp->name >= EMACS_PATH_MAX)
{
errno = ENAMETOOLONG;
return -1;
struct android_saf_tree_vdir *dir;
char *fill, *end;
jobject cursor;
- char component[PATH_MAX];
+ char component[EMACS_PATH_MAX];
vp = (struct android_saf_tree_vnode *) vnode;
if (!end)
emacs_abort ();
- if (end - fill >= PATH_MAX)
+ if (end - fill >= EMACS_PATH_MAX)
{
errno = ENAMETOOLONG;
xfree (dir);
least N bytes.
NAME may be either an absolute file name or a name relative to the
- current working directory. It must not be longer than PATH_MAX
+ current working directory. It must not be longer than EMACS_PATH_MAX
bytes.
Value is NULL upon failure with errno set accordingly, or the
static struct android_vnode *
android_name_file (const char *name)
{
- char buffer[PATH_MAX + 1], *head;
+ char buffer[EMACS_PATH_MAX + 1], *head;
const char *end;
size_t len;
int nslash, c;
struct android_vnode *vp;
len = strlen (name);
- if (len > PATH_MAX)
+ if (len > EMACS_PATH_MAX)
{
errno = ENAMETOOLONG;
return NULL;
android_fstatat (int dirfd, const char *restrict pathname,
struct stat *restrict statbuf, int flags)
{
- char buffer[PATH_MAX + 1];
+ char buffer[EMACS_PATH_MAX + 1];
struct android_vnode *vp;
int rc;
/* Now establish whether DIRFD is a file descriptor corresponding to
an open VFS directory stream. */
- if (!android_fstatat_1 (dirfd, pathname, buffer, PATH_MAX + 1))
+ if (!android_fstatat_1 (dirfd, pathname, buffer, EMACS_PATH_MAX + 1))
{
pathname = buffer;
goto vfs;
android_faccessat (int dirfd, const char *restrict pathname,
int mode, int flags)
{
- char buffer[PATH_MAX + 1];
+ char buffer[EMACS_PATH_MAX + 1];
struct android_vnode *vp;
int rc;
/* Now establish whether DIRFD is a file descriptor corresponding to
an open VFS directory stream. */
- if (!android_fstatat_1 (dirfd, pathname, buffer, PATH_MAX + 1))
+ if (!android_fstatat_1 (dirfd, pathname, buffer, EMACS_PATH_MAX + 1))
{
pathname = buffer;
goto vfs;
android_fchmodat (int dirfd, const char *pathname, mode_t mode,
int flags)
{
- char buffer[PATH_MAX + 1];
+ char buffer[EMACS_PATH_MAX + 1];
struct android_vnode *vp;
int rc;
/* Now establish whether DIRFD is a file descriptor corresponding to
an open VFS directory stream. */
- if (!android_fstatat_1 (dirfd, pathname, buffer, PATH_MAX + 1))
+ if (!android_fstatat_1 (dirfd, pathname, buffer, EMACS_PATH_MAX + 1))
{
pathname = buffer;
goto vfs;
android_readlinkat (int dirfd, const char *restrict pathname,
char *restrict buf, size_t bufsiz)
{
- char buffer[PATH_MAX + 1];
+ char buffer[EMACS_PATH_MAX + 1];
struct android_vnode *vp;
ssize_t rc;
/* Now establish whether DIRFD is a file descriptor corresponding to
an open VFS directory stream. */
- if (!android_fstatat_1 (dirfd, pathname, buffer, PATH_MAX + 1))
+ if (!android_fstatat_1 (dirfd, pathname, buffer, EMACS_PATH_MAX + 1))
{
pathname = buffer;
goto vfs;