Skip to content

Higher available clipboard size #769

Closed Answered by octylFractal
Azzurite asked this question in Q&A
Discussion options

You must be logged in to vote

For glfwSetClipboardString I would suggest allocating a separate byte buffer instead, and calling that overload instead of the String overload. For example:

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 glfwGetClipboardString, it doesn't use MemoryStack at all, it decodes the bytes directly into a char[] (or byte[] on Java 9+) which is fed into the

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@Azzurite
Comment options

@SomeTroglodyte
Comment options

@SomeTroglodyte
Comment options

@octylFractal
Comment options

@SomeTroglodyte
Comment options

Answer selected by TheMrMilchmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants