diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index 1f52e742..e3687b5c 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -469,6 +469,10 @@ extern "C" { /* Gamma ramps */ #define GLFW_GAMMA_RAMP_SIZE 256 +/* Clipboard formats */ +#define GLFW_CLIPBOARD_FORMAT_NONE 0 +#define GLFW_CLIPBOARD_FORMAT_STRING 1 + /************************************************************************* * Typedefs *************************************************************************/ @@ -591,6 +595,10 @@ GLFWAPI int glfwGetJoystickParam(int joy, int param); GLFWAPI int glfwGetJoystickPos(int joy, float* pos, int numaxes); GLFWAPI int glfwGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons); +/* Clipboard */ +GLFWAPI void glfwSetClipboardData(void *data, size_t size, int format); +GLFWAPI size_t glfwGetClipboardData(void *data, size_t size, int format); + /* Time */ GLFWAPI double glfwGetTime(void); GLFWAPI void glfwSetTime(double time); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cd50b41d..08ce8365 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,23 +27,26 @@ include_directories(${GLFW_SOURCE_DIR}/src ${GLFW_BINARY_DIR}/src ${GLFW_INCLUDE_DIR}) -set(common_SOURCES enable.c error.c fullscreen.c gamma.c init.c input.c +set(common_SOURCES clipboard.c enable.c error.c fullscreen.c gamma.c init.c input.c joystick.c opengl.c time.c window.c) if(_GLFW_COCOA_NSGL) - set(libglfw_SOURCES ${common_SOURCES} cocoa_enable.m cocoa_fullscreen.m + set(libglfw_SOURCES ${common_SOURCES} cocoa_clipboard.c + cocoa_enable.m cocoa_fullscreen.m cocoa_gamma.m cocoa_init.m cocoa_joystick.m cocoa_opengl.m cocoa_time.m cocoa_window.m) # For some reason, CMake doesn't know about .m set_source_files_properties(${libglfw_SOURCES} PROPERTIES LANGUAGE C) elseif(_GLFW_WIN32_WGL) - set(libglfw_SOURCES ${common_SOURCES} win32_enable.c win32_fullscreen.c + set(libglfw_SOURCES ${common_SOURCES} win32_clipboard.c + win32_enable.c win32_fullscreen.c win32_gamma.c win32_init.c win32_joystick.c win32_opengl.c win32_time.c win32_window.c win32_dllmain.c) elseif(_GLFW_X11_GLX) - set(libglfw_SOURCES ${common_SOURCES} x11_enable.c x11_fullscreen.c + set(libglfw_SOURCES ${common_SOURCES} x11_clipboard.c + x11_enable.c x11_fullscreen.c x11_gamma.c x11_init.c x11_joystick.c x11_keysym2unicode.c x11_opengl.c x11_time.c x11_window.c) diff --git a/src/clipboard.c b/src/clipboard.c new file mode 100644 index 00000000..5e38904f --- /dev/null +++ b/src/clipboard.c @@ -0,0 +1,68 @@ +//======================================================================== +// GLFW - An OpenGL library +// Platform: Any +// API version: 3.0 +// WWW: http://www.glfw.org/ +//------------------------------------------------------------------------ +// Copyright (c) 2010 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + +#include +#include + + +////////////////////////////////////////////////////////////////////////// +////// GLFW public API ////// +////////////////////////////////////////////////////////////////////////// + +//======================================================================== +// Set the clipboard contents +//======================================================================== + +GLFWAPI void glfwSetClipboardData(void *data, size_t size, int format) +{ + if (!_glfwInitialized) + { + _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + return; + } + _glfwPlatformSetClipboardData(data, size, format); +} + + +//======================================================================== +// Return the current clipboard contents +//======================================================================== + +GLFWAPI size_t glfwGetClipboardData(void *data, size_t size, int format) +{ + if (!_glfwInitialized) + { + _glfwSetError(GLFW_NOT_INITIALIZED, NULL); + return 0; + } + + return _glfwPlatformGetClipboardData(data, size, format); +} diff --git a/src/cocoa_clipboard.m b/src/cocoa_clipboard.m new file mode 100644 index 00000000..0f78cf21 --- /dev/null +++ b/src/cocoa_clipboard.m @@ -0,0 +1,56 @@ +//======================================================================== +// GLFW - An OpenGL library +// Platform: Cocoa/NSOpenGL +// API version: 3.0 +// WWW: http://www.glfw.org/ +//------------------------------------------------------------------------ +// Copyright (c) 2010 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + +#include +#include + + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +//======================================================================== +// Set the clipboard contents +//======================================================================== + +void _glfwPlatformSetClipboardData(void *data, size_t size, int format) +{ +} + +//======================================================================== +// Return the current clipboard contents +//======================================================================== + +size_t _glfwPlatformGetClipboardData(void *data, size_t size, int format) +{ + return 0; +} + diff --git a/src/internal.h b/src/internal.h index 83559ecc..3b82d47e 100644 --- a/src/internal.h +++ b/src/internal.h @@ -284,6 +284,10 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode); void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp); void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp); +// Clipboard +void _glfwPlatformSetClipboardData(void *data, size_t size, int format); +size_t _glfwPlatformGetClipboardData(void *data, size_t size, int format); + // Joystick int _glfwPlatformGetJoystickParam(int joy, int param); int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes); diff --git a/src/win32_clipboard.c b/src/win32_clipboard.c new file mode 100644 index 00000000..b16c51c4 --- /dev/null +++ b/src/win32_clipboard.c @@ -0,0 +1,56 @@ +//======================================================================== +// GLFW - An OpenGL library +// Platform: Win32/WGL +// API version: 3.0 +// WWW: http://www.glfw.org/ +//------------------------------------------------------------------------ +// Copyright (c) 2010 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + +#include +#include + + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +//======================================================================== +// Set the clipboard contents +//======================================================================== + +void _glfwPlatformSetClipboardData(void *data, size_t size, int format) +{ +} + +//======================================================================== +// Return the current clipboard contents +//======================================================================== + +size_t _glfwPlatformGetClipboardData(void *data, size_t size, int format) +{ + return 0; +} + diff --git a/src/x11_clipboard.c b/src/x11_clipboard.c new file mode 100644 index 00000000..164bad49 --- /dev/null +++ b/src/x11_clipboard.c @@ -0,0 +1,56 @@ +//======================================================================== +// GLFW - An OpenGL library +// Platform: X11/GLX +// API version: 3.0 +// WWW: http://www.glfw.org/ +//------------------------------------------------------------------------ +// Copyright (c) 2010 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + +#include +#include + + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +//======================================================================== +// Set the clipboard contents +//======================================================================== + +void _glfwPlatformSetClipboardData(void *data, size_t size, int format) +{ +} + +//======================================================================== +// Return the current clipboard contents +//======================================================================== + +size_t _glfwPlatformGetClipboardData(void *data, size_t size, int format) +{ + return 0; +} +