The code assumed that at least some data would be received via the INCR
mechanism and that, as a result, the string buffer would be allocated.
Bug found by Clang static analysis.
(cherry picked from commit 23e6e8e4b7)
The clipboard string should not be freed on SelectionClear. The user
may have received it from glfwGetClipboardString and it should remain
valid until the next call to a public clipboard string function.
(cherry picked from commit f60547ac80)
This adds support for file path drop events in text/uri-list format.
It is based on work by Pilzschaf in #2040.
Closes#2040
(cherry picked from commit 4cb36872a5)
The Wayland backend was the only one where half the window and input
related code was in the init module. As those bits want to share more
utility code with the window module, the interface between them grows.
To prevent that, this gathers nearly all window and input related code
into the window module.
This is adapted to 3.3-stable from
b7a3af9b79.
The code assumed that all data offers were selections that supported
plaintext UTF-8.
The initial data offer events are now handled almost tolerably. Only
selection data offers are used for clipboard string and only if they
provide plaintext UTF-8. Drag and drop data offers are now rejected as
soon as they enter a surface.
Related to #2040
(cherry picked from commit 8d87be1268)
The string pointer used to write the contents of our clipboard data
offer was never updated, causing it to repeat parts of the beginning of
the string until the correct number of bytes had been written.
(cherry picked from commit 4c110bba41)
If data source creation fails, the string containing the data for it
would be freed a second time during termination.
(cherry picked from commit b386371f57)
Passing any part of the result of glfwGetClipboardString to
glfwSetClipboardString would result in, at best, a use-after-free error.
(cherry picked from commit 9c95cfb9f1)
Emitting an error for one specific type of failure in retrieving the
correct name for a display is not very useful, especially when
initialization is otherwise unaffected.
There should be a path for information like that but this isn't it.
Fixes#1791
(cherry picked from commit 955fbd9d26)
Operations that take an instance handle should be passed the handle of
whatever module we are inside instead of blindly passing the handle of
the executable.
This commit makes GLFW retrieve its own instance on initialization.
This makes the most difference for window classes, which are
per-instance. Using the executable instance led to name conflicts if
there were several copies of GLFW in a single process.
Note that having this is still a bad idea unless you know what things to
avoid, and those things are mostly platform-specific. This is partly
because the library wasn't designed for it and partly because it needs
to save, update and restore various per-process and per-session settings
like current context and video mode.
However, multiple simultaneous copies of GLFW in a single Win32 process
should now at least initialize, like is already the case on other
platforms.
Fixes#469Fixes#1296Fixes#1395
Related to #927
Related to #1885
(cherry picked from commit 07a5518c3e)
There were no checks for invalid values or asserts for all invalid NULL
pointers to glfwSetWindowIcon or glfwCreateCursor.
Fixes#1862
(cherry picked from commit 66a4882eb1)
The bug described in 03cfe957e7 was
already present for another key where modifiers changes its scancode.
Related to #1993
(cherry picked from commit 8d9231fe5e)
Alt+PrtSc emits a different scancode than just PrtSc. Since the GLFW
API assumes each key corresponds to only one scancode, this cannot be
added to the keycodes array.
Instead we replace the scancode at the point of entry.
Fixes#1993
(cherry picked from commit 03cfe957e7)
On a Unix system, if you define GLFW_INCLUDE_NONE and
GLFW_EXPOSE_NATIVE_GLX, then include glfw3.h and glfw3native.h, you will
get a redefinition warning for GLAPIENTRY.
The glfw3.h header defines GLAPIENTRY as a service for OpenGL related
headers that assume it's already defined. However, glx.h includes gl.h,
which defines GLAPIENTRY unconditionally.
If not for Hyrum's law, the better solution would have been not to
define GLAPIENTRY if GLFW_INCLUDE_NONE is defined.
Fixes#2010
This is adapted to 3.3-stable from
535c3ce632 and
ce85c7dcaf.
It is true that plain MinGW lacks this header, but that is not the main
reason for reimplementing IsWindowsVersionOrGreater.
(cherry picked from commit aa803f7de5)
The normal way of maximizing a window also makes it visible. This
implements window maximization manually for when the window passed to
glfwMaximizeWindow is hidden.
This will very likely not be forward-compatible and should be replaced.
(cherry picked from commit 723f3eb40d)