glfwSetClipboardString function

void glfwSetClipboardString(
  1. Pointer<GLFWwindow> window,
  2. String string
)

! @brief Sets the clipboard to the specified string.

This function sets the system clipboard to the specified, UTF-8 encoded string.

@paramin window Deprecated. Any valid window or NULL. @paramin string A UTF-8 encoded string.

@errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_PLATFORM_ERROR.

@pointer_lifetime The specified string is copied before this function returns.

@thread_safety This function must only be called from the main thread.

@sa @ref clipboard @sa @ref glfwGetClipboardString

@since Added in version 3.0.

@ingroup input

GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string)

Implementation

void glfwSetClipboardString(Pointer<GLFWwindow> window, String string) {
  final glfwSetClipboardStringLookupFunction = libglfw.lookupFunction<
      Void Function(Pointer<GLFWwindow> window, Pointer<Utf8> string),
      void Function(Pointer<GLFWwindow> window,
          Pointer<Utf8> string)>('glfwSetClipboardString');
  final stringPointer = string.toNativeUtf8();
  final result = glfwSetClipboardStringLookupFunction(window, stringPointer);
  calloc.free(stringPointer);
  return result;
}