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.
A window created maximized and undecorated would cover the whole monitor
Windows placed it on instead of just that monitor's workarea.
This commit adjusts the maximized rect to cover just the workarea,
similar to how undecorated windows that become maximized are handled
during WM_GETMINMAXINFO.
Fixes#1806
The NetBSD sonames for X11 and related libraries is more stable than on
OpenBSD but the version numbers are still bumped more often than their
Linux counterparts, even excluding the one-time version bump across all
X11 related libraries.
This commit moves to using version-less sonames for X11 and related
libraries on NetBSD, which will hopefully be more forward-compatible
than hard-coding NetBSD-specific sonames.
This may not be the correct long-term solution but it runs now.
Binaries also appear to need an LD_LIBRARY_PATH or rpath entry of
/usr/X11R7/lib in order for the libraries to be found by dlopen.
Tested on NetBSD 9.2.
If the polling was interrupted by a signal or by incomplete or unrelated
data on any file descriptor, handleEvents could return before the full
timeout had elapsed.
This retries the Wayland prepare-to-read and poll until the full timeout
has elapsed or until any event was processed. Unfortunately, due to how
the Wayland client API is designed, this also includes the delete_id
for the frame callback created by eglSwapBuffers.
This means glfwWaitEvents* are still not fully functional on Wayland.
See #1911 for more details.
The display sync requests in glfwPostEmptyEvent could just accumulate as
the display was never flushed on secondary threads.
This adds a proper flush after each sync request.
Fixes#1520Closes#1521
This moves the X11 polling implementation to a separate file where it
can be used by either the X11 or Wayland backend or both.
This code should be POSIX compatible where necessary but will use the
lower latency but non-standard polling functions ppoll or pollts where
those are available.
This commit is based on work by OlivierSohn and kovidgoyal.
Fixes#1281Closes#1285
Cancel the prepared-to-read state on the calling thread before starting
to call back to user code.
Emitting close requests here is not a good choice but that is for
a future commit to address.
This uses ppoll for waiting on file descriptors with a timeout, where
that function has been available a while. On NetBSD, which will be
getting ppoll in the next release, the equivalent pollts is used.
This commit is based on work by OlivierSohn and kovidgoyal.
Related to #1281
Related to #1285
There is a seemingly unavoidable race condition when waiting for data on
the X11 display connection, as long as any other thread is also making
Xlib calls. The event data we are waiting for could be read by the
other thread as part of looking for the reply to its request, before our
poll has begun.
This commit replaces the X11 event sent by glfwPostEmptyEvent with
writing to an unnamed pipe. The race condition remains if other Xlib
calls are made on other threads, but glfwPostEmptyEvent should now be
race-free.
This commit is based on work by pcwalton, OlivierSohn, kovidgoyal and
joaodasilva.
Closes#2033
Related to #379
Related to #1281
Related to #1285