mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-06 20:00:46 -08:00
Fix hang after failed yank-media on Android
* java/org/gnu/emacs/EmacsClipboard.java (getClipboardTargets) (getClipboardData): * java/org/gnu/emacs/EmacsSdk11Clipboard.java (getClipboardTargets, getClipboardData): * java/org/gnu/emacs/EmacsSdk8Clipboard.java (getClipboardTargets, getClipboardData): Return string data as Strings rather than byte arrays. * src/androidselect.c (android_init_emacs_clipboard) (Fandroid_get_clipboard_targets): Adjust to match. (extract_fd_offsets): Remove duplicated semicolon. (Fandroid_get_clipboard_data): Call unblock_input before returning if extract_fd_offsets fails.
This commit is contained in:
parent
d0b36be59a
commit
e020f4e9ce
4 changed files with 45 additions and 67 deletions
|
|
@ -32,8 +32,8 @@ public abstract class EmacsClipboard
|
|||
public abstract boolean clipboardExists ();
|
||||
public abstract byte[] getClipboard ();
|
||||
|
||||
public abstract byte[][] getClipboardTargets ();
|
||||
public abstract AssetFileDescriptor getClipboardData (byte[] target);
|
||||
public abstract String[] getClipboardTargets ();
|
||||
public abstract AssetFileDescriptor getClipboardData (String target);
|
||||
|
||||
/* Create the correct kind of clipboard for this system. */
|
||||
|
||||
|
|
|
|||
|
|
@ -172,12 +172,12 @@ public final class EmacsSdk11Clipboard extends EmacsClipboard
|
|||
clipboard, or NULL if there are none. */
|
||||
|
||||
@Override
|
||||
public byte[][]
|
||||
public String[]
|
||||
getClipboardTargets ()
|
||||
{
|
||||
ClipData clip;
|
||||
ClipDescription description;
|
||||
byte[][] typeArray;
|
||||
String[] typeArray;
|
||||
int i;
|
||||
|
||||
/* N.B. that Android calls the clipboard the ``primary clip''; it
|
||||
|
|
@ -189,17 +189,10 @@ public final class EmacsSdk11Clipboard extends EmacsClipboard
|
|||
|
||||
description = clip.getDescription ();
|
||||
i = description.getMimeTypeCount ();
|
||||
typeArray = new byte[i][i];
|
||||
typeArray = new String[i];
|
||||
|
||||
try
|
||||
{
|
||||
for (i = 0; i < description.getMimeTypeCount (); ++i)
|
||||
typeArray[i] = description.getMimeType (i).getBytes ("UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (i = 0; i < description.getMimeTypeCount (); ++i)
|
||||
typeArray[i] = description.getMimeType (i);
|
||||
|
||||
return typeArray;
|
||||
}
|
||||
|
|
@ -219,26 +212,17 @@ public final class EmacsSdk11Clipboard extends EmacsClipboard
|
|||
|
||||
@Override
|
||||
public AssetFileDescriptor
|
||||
getClipboardData (byte[] target)
|
||||
getClipboardData (String target)
|
||||
{
|
||||
ClipData data;
|
||||
String mimeType;
|
||||
AssetFileDescriptor assetFd;
|
||||
Uri uri;
|
||||
|
||||
/* Decode the target given by Emacs. */
|
||||
try
|
||||
{
|
||||
mimeType = new String (target, "UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/* Now obtain the clipboard data and the data corresponding to
|
||||
that MIME type. */
|
||||
|
||||
mimeType = target;
|
||||
data = manager.getPrimaryClip ();
|
||||
|
||||
if (data == null || data.getItemCount () < 1)
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public final class EmacsSdk8Clipboard extends EmacsClipboard
|
|||
clipboard, or NULL if there are none. */
|
||||
|
||||
@Override
|
||||
public byte[][]
|
||||
public String[]
|
||||
getClipboardTargets ()
|
||||
{
|
||||
return null;
|
||||
|
|
@ -143,7 +143,7 @@ public final class EmacsSdk8Clipboard extends EmacsClipboard
|
|||
|
||||
@Override
|
||||
public AssetFileDescriptor
|
||||
getClipboardData (byte[] target)
|
||||
getClipboardData (String target)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue