mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Deprecate window parameter of clipboard functions
This commit is contained in:
parent
f2756d0b3f
commit
31cbb20ba2
@ -168,6 +168,7 @@ information on what to include when reporting a bug.
|
|||||||
- Added `GLFW_OSMESA_CONTEXT_API` for creating OpenGL contexts with
|
- Added `GLFW_OSMESA_CONTEXT_API` for creating OpenGL contexts with
|
||||||
[OSMesa](https://www.mesa3d.org/osmesa.html) (#281)
|
[OSMesa](https://www.mesa3d.org/osmesa.html) (#281)
|
||||||
- Added `GenerateMappings.cmake` script for updating gamepad mappings
|
- Added `GenerateMappings.cmake` script for updating gamepad mappings
|
||||||
|
- Deprecated window parameter of clipboard string functions
|
||||||
- Removed `GLFW_USE_RETINA` compile-time option
|
- Removed `GLFW_USE_RETINA` compile-time option
|
||||||
- Removed `GLFW_USE_CHDIR` compile-time option
|
- Removed `GLFW_USE_CHDIR` compile-time option
|
||||||
- Removed `GLFW_USE_MENUBAR` compile-time option
|
- Removed `GLFW_USE_MENUBAR` compile-time option
|
||||||
|
@ -846,7 +846,7 @@ converted to one, you can retrieve it with @ref glfwGetClipboardString. See the
|
|||||||
reference documentation for the lifetime of the returned string.
|
reference documentation for the lifetime of the returned string.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
const char* text = glfwGetClipboardString(window);
|
const char* text = glfwGetClipboardString(NULL);
|
||||||
if (text)
|
if (text)
|
||||||
{
|
{
|
||||||
insert_text(text);
|
insert_text(text);
|
||||||
@ -860,13 +860,9 @@ The contents of the system clipboard can be set to a UTF-8 encoded string with
|
|||||||
@ref glfwSetClipboardString.
|
@ref glfwSetClipboardString.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSetClipboardString(window, "A string with words in it");
|
glfwSetClipboardString(NULL, "A string with words in it");
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The clipboard functions take a window handle argument because some window
|
|
||||||
systems require a window to communicate with the system clipboard. Any valid
|
|
||||||
window may be used.
|
|
||||||
|
|
||||||
|
|
||||||
@section path_drop Path drop input
|
@section path_drop Path drop input
|
||||||
|
|
||||||
|
@ -4655,7 +4655,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
|||||||
* This function sets the system clipboard to the specified, UTF-8 encoded
|
* This function sets the system clipboard to the specified, UTF-8 encoded
|
||||||
* string.
|
* string.
|
||||||
*
|
*
|
||||||
* @param[in] window The window that will own the clipboard contents.
|
* @param[in] window Deprecated. Any valid window or `NULL`.
|
||||||
* @param[in] string A UTF-8 encoded string.
|
* @param[in] string A UTF-8 encoded string.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
@ -4684,7 +4684,7 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
|
|||||||
* if its contents cannot be converted, `NULL` is returned and a @ref
|
* if its contents cannot be converted, `NULL` is returned and a @ref
|
||||||
* GLFW_FORMAT_UNAVAILABLE error is generated.
|
* GLFW_FORMAT_UNAVAILABLE error is generated.
|
||||||
*
|
*
|
||||||
* @param[in] window The window that will request the clipboard contents.
|
* @param[in] window Deprecated. Any valid window or `NULL`.
|
||||||
* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
|
* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
|
||||||
* if an [error](@ref error_handling) occurred.
|
* if an [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
|
@ -1740,7 +1740,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(const char* string)
|
||||||
{
|
{
|
||||||
NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil];
|
NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil];
|
||||||
|
|
||||||
@ -1750,7 +1750,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|||||||
forType:NSStringPboardType];
|
forType:NSStringPboardType];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
const char* _glfwPlatformGetClipboardString(void)
|
||||||
{
|
{
|
||||||
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
||||||
|
|
||||||
|
@ -1099,21 +1099,16 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
|
|||||||
|
|
||||||
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
|
||||||
assert(window != NULL);
|
|
||||||
assert(string != NULL);
|
assert(string != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
_glfwPlatformSetClipboardString(window, string);
|
_glfwPlatformSetClipboardString(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
|
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
|
||||||
assert(window != NULL);
|
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
return _glfwPlatformGetClipboardString(window);
|
return _glfwPlatformGetClipboardString();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI double glfwGetTime(void)
|
GLFWAPI double glfwGetTime(void)
|
||||||
|
@ -647,8 +647,8 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode);
|
|||||||
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
|
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
|
||||||
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
|
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string);
|
void _glfwPlatformSetClipboardString(const char* string);
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window);
|
const char* _glfwPlatformGetClipboardString(void);
|
||||||
|
|
||||||
int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode);
|
int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode);
|
||||||
void _glfwPlatformUpdateGamepadGUID(char* guid);
|
void _glfwPlatformUpdateGamepadGUID(char* guid);
|
||||||
|
@ -858,13 +858,13 @@ int _glfwPlatformGetKeyScancode(int key)
|
|||||||
return _glfw.mir.scancodes[key];
|
return _glfw.mir.scancodes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(const char* string)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
const char* _glfwPlatformGetClipboardString(void)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
@ -266,11 +266,11 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(const char* string)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
const char* _glfwPlatformGetClipboardString(void)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1796,7 +1796,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(const char* string)
|
||||||
{
|
{
|
||||||
int characterCount;
|
int characterCount;
|
||||||
HANDLE object;
|
HANDLE object;
|
||||||
@ -1839,7 +1839,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
const char* _glfwPlatformGetClipboardString(void)
|
||||||
{
|
{
|
||||||
HANDLE object;
|
HANDLE object;
|
||||||
WCHAR* buffer;
|
WCHAR* buffer;
|
||||||
|
@ -1008,14 +1008,14 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(const char* string)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Wayland: Clipboard setting not implemented yet");
|
"Wayland: Clipboard setting not implemented yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
const char* _glfwPlatformGetClipboardString(void)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
@ -2773,7 +2773,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(const char* string)
|
||||||
{
|
{
|
||||||
free(_glfw.x11.clipboardString);
|
free(_glfw.x11.clipboardString);
|
||||||
_glfw.x11.clipboardString = strdup(string);
|
_glfw.x11.clipboardString = strdup(string);
|
||||||
@ -2791,7 +2791,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
const char* _glfwPlatformGetClipboardString(void)
|
||||||
{
|
{
|
||||||
return getSelectionString(_glfw.x11.CLIPBOARD);
|
return getSelectionString(_glfw.x11.CLIPBOARD);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
{
|
{
|
||||||
const char* string;
|
const char* string;
|
||||||
|
|
||||||
string = glfwGetClipboardString(window);
|
string = glfwGetClipboardString(NULL);
|
||||||
if (string)
|
if (string)
|
||||||
printf("Clipboard contains \"%s\"\n", string);
|
printf("Clipboard contains \"%s\"\n", string);
|
||||||
else
|
else
|
||||||
@ -79,7 +79,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
if (mods == MODIFIER)
|
if (mods == MODIFIER)
|
||||||
{
|
{
|
||||||
const char* string = "Hello GLFW World!";
|
const char* string = "Hello GLFW World!";
|
||||||
glfwSetClipboardString(window, string);
|
glfwSetClipboardString(NULL, string);
|
||||||
printf("Setting clipboard to \"%s\"\n", string);
|
printf("Setting clipboard to \"%s\"\n", string);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user