mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-04 22:17:59 +00:00
moved clipboard stuff to PlatformAdapter
This commit is contained in:
parent
d9830aff06
commit
e6feeb3d5c
3 changed files with 32 additions and 9 deletions
|
|
@ -277,18 +277,14 @@ public final class Sys {
|
|||
*/
|
||||
public static String getClipboard() {
|
||||
try {
|
||||
java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
java.awt.datatransfer.Transferable transferable = clipboard.getContents(null);
|
||||
if (transferable.isDataFlavorSupported(java.awt.datatransfer.DataFlavor.stringFlavor)) {
|
||||
return (String)transferable.getTransferData(java.awt.datatransfer.DataFlavor.stringFlavor);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
PlatformAdapter adapter = (PlatformAdapter) Class.forName(PLATFORM).newInstance(); // This avoids a Jet error message
|
||||
return adapter.getClipboard();
|
||||
} catch (Exception e) {
|
||||
Sys.log("Unable to get clipboard contents: " + e);
|
||||
// ignore exception and use native implementation
|
||||
return nGetClipboard();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static native String nGetClipboard();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue