Commit Graph

25 Commits

Author SHA1 Message Date
Camilla Löwy
d78b0a4ead X11: Fix sonames for loaded libraries on NetBSD
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.
2022-03-04 00:00:59 +01:00
Camilla Löwy
789d2924c0 Formatting
Make it clear that context attribute helper macros are macros.
2022-03-02 19:38:41 +01:00
Camilla Löwy
7d060ba4f1 X11: Fix sonames for loaded libraries on OpenBSD
The OpenBSD ports tree assigns its own soname version numbers, so the
hardcoded sonames GLFW uses to load libraries on non-macOS Unices are
often incorrect.  Instead OpenBSD recommends that run-time loading
should leave out the version numbers entirely.  The OpenBSD ld.so then
finds the correct library.

This upstreams the ports tree fixes for Xcursor and EGL, and adds the
corresponding fix for all other run-time loaded library sonames.

Tested on OpenBSD 7.0.

This issue was initially reported on IRC.
2021-12-24 01:14:23 +01:00
Ioannis Tsakpinis
727db55c3a
Fix context API checks in native access functions 2021-10-23 16:20:18 +03:00
Camilla Löwy
56a4cb0a3a Add runtime platform selection
This adds compile-time support for multiple platforms and runtime
detection of them.  Window system related platform functions are now
called from shared code via the function pointer struct _GLFWplatform.

The timer, thread and module loading platform functions are still called
directly by name and the implementation chosen at link-time.  These
functions are the same for any backend on a given OS, including the Null
backend.

The platforms are now enabled via CMake dependent options following the
GLFW_BUILD_<platform> pattern instead of a mix of automagic and ad-hoc
option names.  There is no longer any option for the Null backend as it
is now always enabled.

Much of the struct stitching work in platform.h was based on an earlier
experimental branch for runtime platform selection by @ronchaine.

Every platform function related to windows, contexts, monitors, input,
event processing and Vulkan have been renamed so that multiple sets of
them can exist without colliding.  Calls to these are now routed through
the _glfw.platform struct member.  These changes makes up most of this
commit.

For Wayland and X11 the client library loading and display creation is
used to detect a running compositor/server.  The XDG_SESSION_TYPE
environment variable is ignored for now, as X11 is still by far the more
complete implementation.

Closes #1655
Closes #1958
2021-10-13 21:47:11 +02:00
Camilla Löwy
b7d0c6037d Make dynamic module loading part of platform API
This is part of the preparations for runtime platform selection.
2021-10-12 12:54:36 +02:00
Camilla Löwy
cca9008db2 Make native access functions verify context API
The native access functions for context handles did not verify that the
context had been created with the same API the function was for.

This makes these functions emit GLFW_NO_WINDOW_CONTEXT on API mismatch.
2021-10-12 12:54:35 +02:00
Camilla Löwy
22b586b3d8 Add pluggable heap allocator
This adds the glfwInitAllocator function for specifying a custom memory
allocator to use instead of the C runtime library.

The allocator is a struct of type GLFWallocator with fields
corresponding to malloc, realloc and free, while the internal API
corresponds to calloc, realloc and free.

Heap allocation calls are filtered before reaching the user-provided
functions, so deallocation of NULL and allocations of zero bytes are not
passed on, reallocating NULL is transformed into an allocation and
reallocating to size zero is transformed into deallocation.

The clearing of a new block to zero is performed by the internal
calloc-like function.

Closes #544.
Fixes #1628.
Closes #1947.
2021-08-25 21:00:10 +02:00
Camilla Löwy
56aad76b16 Add C dialect reminders to each source file
Files built for Win32 must use C89 style declarations for compatibility
with VS 2010 and 2012, which are still supported by GLFW.
2019-05-24 14:43:49 +02:00
Camilla Löwy
a337c56848 Start 3.4 2019-04-16 23:08:39 +02:00
Camilla Löwy
ab118b2529 Fix copyright years (somewhat) 2019-04-15 20:50:00 +02:00
Camilla Löwy
1f91697cd3 Win32: Fix VS static analysis warnings 2019-04-15 15:37:15 +02:00
Vallentin
e29882523e Fix typos
Closes #1402.
2018-12-26 15:00:39 +01:00
Camilla Löwy
d099181307 Add library name override macros 2017-09-10 21:02:26 +02:00
Camilla Löwy
32f482a6d8 Cleanup 2017-06-08 16:38:45 +02:00
Camilla Löwy
14a3fe0ac0 Make glfwGetError also provide description
Related to #970.
2017-06-08 16:08:36 +02:00
Camilla Löwy
aaf2800c9c Add internal TLS support
Related to #970.
2017-03-19 00:52:46 +01:00
Camilla Löwy
315c9455d5 OSMesa: Use framebuffer size for framebuffer 2017-02-28 22:21:42 +01:00
Camilla Löwy
e9560ef021 Add GLFW_OSMESA_CONTEXT_API
This allows the creation of OpenGL contexts via OSMesa on existing
platforms.  It does not add a compile- or link-time dependency on
OSMesa.

Fixes #281.
2017-02-28 20:38:10 +01:00
Camilla Löwy
32eb50b75e Move to Vulkan style function typedefs
PFN_FunctionName is more readable than SCREAMSOUP_T.

Context creation API function typedefs are kept as-is where the original
header provided them, for compatibility and familiarity reasons.
2016-12-08 16:56:05 +01:00
Camilla Löwy
f4d0c83181 Paperwork done 2016-11-30 14:00:41 +01:00
Camilla Berglund
0e8d129efb OSMesa: Context creation compliance fixes 2016-11-09 01:36:24 +01:00
Camilla Berglund
62012e3c68 OSMesa: Add fallback to OSMesaCreateContextExt 2016-11-09 01:36:23 +01:00
Camilla Berglund
fef21361c5 OSMesa: Cleanup
Fixes formatting, semantics and documentation.  Adds
glfwGetOSMesaContext.  Adds support for OSMesa context attributes.
Updates changelog and credits.  Adds license and copyright headers.
Removes superfluous code (the shared code provides many conveniences).
Removes loading of unused OSMesa functions.  Removes empty platform
structs.  Fixes version string format.  Removes build dependency on
the OSMesa header and library (only the library is needed and only at
runtime).

Closes #850.
2016-11-09 01:36:21 +01:00
Jason Daly
368fa9475d Add headless OSMesa backend
Allows creation and drawing to in-memory OpenGL contexts.

This backend does not provide input.

Related to #850.
2016-11-09 01:23:43 +01:00