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
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 change broke key names for dead keys, because that depends on
the effect on the global state of simulating two key presses.
Issue found by CTest tests.
Reverts #2018
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.
The window content scale correction at creation overwrote the inital,
more pleasant placement of the window by CW_USEDEFAULT, if the window
was created with GLFW_MAXIMIZED set. This is because the translation
to screen coordinates was done using the current position, not the
position from the restored window rect.