This is a follow-up to 535c3ce632.
That commit made glfw3native.h undefine GLAPIENTRY whenever
GLFW_EXPOSE_NATIVE_GLX or GLFW_EXPOSE_NATIVE_OSMESA was defined, on the
assumption that it was glfw3.h that had defined GLAPIENTRY.
If gl.h or an extension loader header has been included before glfw3.h,
then it has defined inclusion guards preventing GLAPIENTRY from being
defined later when the GLX or OSMesa header includes gl.h.
This commit ensures GLAPIENTRY is only undefined if glfw3.h defined it.
Related to #2010
This avoids glfwCreateWindow emitting GLFW_FEATURE_UNAVAILABLE or
GLFW_FEATURE_UNIMPLEMENTED on Wayland because shared code was calling
unimplemented or unavailable platform functions during final setup.
It also makes it consistent with the final setup of full screen windows.
There will not currently be more than one set of threading or timer APIs
selected regardless of how many window systems are enabled, so there is
no need for this extra complexity.
Versions of wayland-scanner prior to 1.17.91 named every global array of
wl_interface pointers 'types', making it impossible to combine several
unmodified private-code files into a single compilation unit.
This overrides that name with a macro for each file, allowing them to
coexist.
Fixes#2016Closes#2032
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.
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.
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.
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
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.
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
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
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