Simplified clipboard API.

This commit is contained in:
Camilla Berglund
2012-04-12 00:51:58 +02:00
parent 721e0a7fd0
commit f868712f02
9 changed files with 33 additions and 56 deletions
+3 -13
View File
@@ -152,10 +152,9 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
// Return the current clipboard contents
//========================================================================
size_t _glfwPlatformGetClipboardString(_GLFWwindow* window, char* string, size_t size)
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
{
int i;
size_t sourceSize, targetSize;
_glfwLibrary.X11.selection.status = _GLFW_CONVERSION_INACTIVE;
@@ -184,18 +183,9 @@ size_t _glfwPlatformGetClipboardString(_GLFWwindow* window, char* string, size_t
{
_glfwSetError(GLFW_FORMAT_UNAVAILABLE,
"X11/GLX: Failed to convert selection to string");
return 0;
return NULL;
}
sourceSize = strlen(_glfwLibrary.X11.selection.string) + 1;
targetSize = sourceSize;
if (targetSize > size)
targetSize = size;
memcpy(string, _glfwLibrary.X11.selection.string, targetSize);
string[targetSize - 1] = '\0';
return sourceSize;
return _glfwLibrary.X11.selection.string;
}