Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pirvi-public
glfw
Commits
31cbb20b
Commit
31cbb20b
authored
Nov 04, 2017
by
Camilla Löwy
Browse files
Deprecate window parameter of clipboard functions
parent
f2756d0b
Changes
12
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
31cbb20b
...
...
@@ -168,6 +168,7 @@ information on what to include when reporting a bug.
-
Added
`GLFW_OSMESA_CONTEXT_API`
for creating OpenGL contexts with
[
OSMesa
](
https://www.mesa3d.org/osmesa.html
)
(
#281
)
-
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_CHDIR`
compile-time option
-
Removed
`GLFW_USE_MENUBAR`
compile-time option
...
...
docs/input.dox
View file @
31cbb20b
...
...
@@ -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.
@code
const char* text = glfwGetClipboardString(
window
);
const char* text = glfwGetClipboardString(
NULL
);
if (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.
@code
glfwSetClipboardString(
window
, "A string with words in it");
glfwSetClipboardString(
NULL
, "A string with words in it");
@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
...
...
include/GLFW/glfw3.h
View file @
31cbb20b
...
...
@@ -4655,7 +4655,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
* This function sets the system clipboard to the specified, UTF-8 encoded
* 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.
*
* @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
* 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`
* if an [error](@ref error_handling) occurred.
*
...
...
src/cocoa_window.m
View file @
31cbb20b
...
...
@@ -1740,7 +1740,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
updateCursorImage
(
window
);
}
void
_glfwPlatformSetClipboardString
(
_GLFWwindow
*
window
,
const
char
*
string
)
void
_glfwPlatformSetClipboardString
(
const
char
*
string
)
{
NSArray
*
types
=
[
NSArray
arrayWithObjects
:
NSStringPboardType
,
nil
];
...
...
@@ -1750,7 +1750,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
forType:
NSStringPboardType
];
}
const
char
*
_glfwPlatformGetClipboardString
(
_GLFWwindow
*
window
)
const
char
*
_glfwPlatformGetClipboardString
(
void
)
{
NSPasteboard
*
pasteboard
=
[
NSPasteboard
generalPasteboard
];
...
...
src/input.c
View file @
31cbb20b
...
...
@@ -1099,21 +1099,16 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
GLFWAPI
void
glfwSetClipboardString
(
GLFWwindow
*
handle
,
const
char
*
string
)
{
_GLFWwindow
*
window
=
(
_GLFWwindow
*
)
handle
;
assert
(
window
!=
NULL
);
assert
(
string
!=
NULL
);
_GLFW_REQUIRE_INIT
();
_glfwPlatformSetClipboardString
(
window
,
string
);
_glfwPlatformSetClipboardString
(
string
);
}
GLFWAPI
const
char
*
glfwGetClipboardString
(
GLFWwindow
*
handle
)
{
_GLFWwindow
*
window
=
(
_GLFWwindow
*
)
handle
;
assert
(
window
!=
NULL
);
_GLFW_REQUIRE_INIT_OR_RETURN
(
NULL
);
return
_glfwPlatformGetClipboardString
(
window
);
return
_glfwPlatformGetClipboardString
();
}
GLFWAPI
double
glfwGetTime
(
void
)
...
...
src/internal.h
View file @
31cbb20b
...
...
@@ -647,8 +647,8 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode);
void
_glfwPlatformGetGammaRamp
(
_GLFWmonitor
*
monitor
,
GLFWgammaramp
*
ramp
);
void
_glfwPlatformSetGammaRamp
(
_GLFWmonitor
*
monitor
,
const
GLFWgammaramp
*
ramp
);
void
_glfwPlatformSetClipboardString
(
_GLFWwindow
*
window
,
const
char
*
string
);
const
char
*
_glfwPlatformGetClipboardString
(
_GLFWwindow
*
window
);
void
_glfwPlatformSetClipboardString
(
const
char
*
string
);
const
char
*
_glfwPlatformGetClipboardString
(
void
);
int
_glfwPlatformPollJoystick
(
_GLFWjoystick
*
js
,
int
mode
);
void
_glfwPlatformUpdateGamepadGUID
(
char
*
guid
);
...
...
src/mir_window.c
View file @
31cbb20b
...
...
@@ -858,13 +858,13 @@ int _glfwPlatformGetKeyScancode(int key)
return
_glfw
.
mir
.
scancodes
[
key
];
}
void
_glfwPlatformSetClipboardString
(
_GLFWwindow
*
window
,
const
char
*
string
)
void
_glfwPlatformSetClipboardString
(
const
char
*
string
)
{
_glfwInputError
(
GLFW_PLATFORM_ERROR
,
"Mir: Unsupported function %s"
,
__PRETTY_FUNCTION__
);
}
const
char
*
_glfwPlatformGetClipboardString
(
_GLFWwindow
*
window
)
const
char
*
_glfwPlatformGetClipboardString
(
void
)
{
_glfwInputError
(
GLFW_PLATFORM_ERROR
,
"Mir: Unsupported function %s"
,
__PRETTY_FUNCTION__
);
...
...
src/null_window.c
View file @
31cbb20b
...
...
@@ -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
;
}
...
...
src/win32_window.c
View file @
31cbb20b
...
...
@@ -1796,7 +1796,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
updateCursorImage
(
window
);
}
void
_glfwPlatformSetClipboardString
(
_GLFWwindow
*
window
,
const
char
*
string
)
void
_glfwPlatformSetClipboardString
(
const
char
*
string
)
{
int
characterCount
;
HANDLE
object
;
...
...
@@ -1839,7 +1839,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
CloseClipboard
();
}
const
char
*
_glfwPlatformGetClipboardString
(
_GLFWwindow
*
window
)
const
char
*
_glfwPlatformGetClipboardString
(
void
)
{
HANDLE
object
;
WCHAR
*
buffer
;
...
...
src/wl_window.c
View file @
31cbb20b
...
...
@@ -1008,14 +1008,14 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
}
}
void
_glfwPlatformSetClipboardString
(
_GLFWwindow
*
window
,
const
char
*
string
)
void
_glfwPlatformSetClipboardString
(
const
char
*
string
)
{
// TODO
_glfwInputError
(
GLFW_PLATFORM_ERROR
,
"Wayland: Clipboard setting not implemented yet"
);
}
const
char
*
_glfwPlatformGetClipboardString
(
_GLFWwindow
*
window
)
const
char
*
_glfwPlatformGetClipboardString
(
void
)
{
// TODO
_glfwInputError
(
GLFW_PLATFORM_ERROR
,
...
...
src/x11_window.c
View file @
31cbb20b
...
...
@@ -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
);
_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
);
}
...
...
tests/clipboard.c
View file @
31cbb20b
...
...
@@ -67,7 +67,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
{
const
char
*
string
;
string
=
glfwGetClipboardString
(
window
);
string
=
glfwGetClipboardString
(
NULL
);
if
(
string
)
printf
(
"Clipboard contains
\"
%s
\"\n
"
,
string
);
else
...
...
@@ -79,7 +79,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
if
(
mods
==
MODIFIER
)
{
const
char
*
string
=
"Hello GLFW World!"
;
glfwSetClipboardString
(
window
,
string
);
glfwSetClipboardString
(
NULL
,
string
);
printf
(
"Setting clipboard to
\"
%s
\"\n
"
,
string
);
}
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment