Higher available clipboard size #769
|
So when you do We want to be able to copy/paste larger content. Are there any problems to look out for when setting the Since this is a general setting affecting all |
Replies: 1 comment 7 replies
|
For String forClipboard = "my very long string";
ByteBuffer buffer = MemoryUtil.memUTF8(forClipboard);
try {
glfwSetClipboardString(window, buffer);
} finally {
MemoryUtil.memFree(buffer);
}
// Note: I didn't test this code, there may be minor errors. The general idea should be sound.Depending on how much you use it, it might be worth allocating a single buffer up-front and re-using it. For |
For
glfwSetClipboardStringI would suggest allocating a separate byte buffer instead, and calling that overload instead of theStringoverload. For example:Depending on how much you use it, it might be worth allocating a single buffer up-front and re-using it.
For
glfwGetClipboardString, it doesn't useMemoryStackat all, it decodes the bytes directly into achar[](orbyte[]on Java 9+) which is fed into the