implement primary selection api on cocoa as stubs, can be useful for #5357

This commit is contained in:
Kovid Goyal 2022-08-06 12:59:15 +05:30
parent a487a78200
commit d04d4444af
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 9 additions and 2 deletions

View File

@ -2479,6 +2479,13 @@ void _glfwPlatformSetClipboardString(const char* string)
[pasteboard setString:@(string) forType:NSPasteboardTypeString]; [pasteboard setString:@(string) forType:NSPasteboardTypeString];
} }
void _glfwPlatformSetPrimarySelectionString(const char* string) {
(void)string;
// Apple doesnt have a primary selection
}
const char* _glfwPlatformGetPrimarySelectionString(void) { return ""; }
const char* _glfwPlatformGetClipboardString(void) const char* _glfwPlatformGetClipboardString(void)
{ {
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];

2
glfw/input.c vendored
View File

@ -1540,7 +1540,7 @@ GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle UNUSED)
return _glfwPlatformGetClipboardString(); return _glfwPlatformGetClipboardString();
} }
#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND) #if defined(_GLFW_X11) || defined(_GLFW_WAYLAND) || defined(__APPLE__)
GLFWAPI void glfwSetPrimarySelectionString(GLFWwindow* handle UNUSED, const char* string) GLFWAPI void glfwSetPrimarySelectionString(GLFWwindow* handle UNUSED, const char* string)
{ {
assert(string != NULL); assert(string != NULL);

2
glfw/internal.h vendored
View File

@ -675,7 +675,7 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
void _glfwPlatformSetClipboardString(const char* string); void _glfwPlatformSetClipboardString(const char* string);
const char* _glfwPlatformGetClipboardString(void); const char* _glfwPlatformGetClipboardString(void);
#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND) #if defined(_GLFW_X11) || defined(_GLFW_WAYLAND) || defined(__APPLE__)
void _glfwPlatformSetPrimarySelectionString(const char* string); void _glfwPlatformSetPrimarySelectionString(const char* string);
const char* _glfwPlatformGetPrimarySelectionString(void); const char* _glfwPlatformGetPrimarySelectionString(void);
#endif #endif