From 0b65053ffd8b890353ee7cfb7b3dcabbc0db8fc3 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 16 Sep 2015 16:27:28 +0200 Subject: [PATCH] Clarify documentation of glfwGetClipboardString The reference documentation for glfwGetClipboardString did not link to GLFW_FORMAT_UNAVAILABLE. Fixes #605. --- docs/input.dox | 7 ++++++- include/GLFW/glfw3.h | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/input.dox b/docs/input.dox index 6633a54f..844bcce6 100644 --- a/docs/input.dox +++ b/docs/input.dox @@ -544,9 +544,14 @@ converted to one, you can retrieve it with @ref glfwGetClipboardString. See the reference documentation for the lifetime of the returned string. @code -const char* clipboard = glfwGetClipboardString(window); +const char* text = glfwGetClipboardString(window); +if (text) + insert_text(text); @endcode +If the clipboard is empty or if its contents could not be converted, `NULL` is +returned. + The contents of the system clipboard can be set to a UTF-8 encoded string with @ref glfwSetClipboardString. diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 8b9c9e71..9f4e79f7 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -3079,7 +3079,9 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); /*! @brief Returns the contents of the clipboard as a string. * * This function returns the contents of the system clipboard, if it contains - * or is convertible to a UTF-8 encoded string. + * or is convertible to a UTF-8 encoded string. If the clipboard is empty of + * if its contents cannot be converted, `NULL` is returned and a @ref + * GLFW_FORMAT_UNAVAILABLE error is generated. * * @param[in] window The window that will request the clipboard contents. * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`