Commit Graph

48 Commits

Author SHA1 Message Date
Camilla Löwy
76a5f781db Add glfwInitVulkanLoader
This removes the GLFW_VULKAN_STATIC CMake option and the
_GLFW_VULKAN_STATIC configuration macro and replaces them with the
glfwInitVulkanLoader function, allowing a single library binary to
provide both behaviors.

This is based on the design from PR #1374 by @pmuetschard.

Closes #1374
Closes #1890
2021-10-27 18:22:05 +02: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
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
bbbbd3e870 Clarify documentation for hints 2021-05-13 15:03:19 +02:00
Camilla Löwy
a25e8eb50d Add docs for GLFW_X11_XCB_VULKAN_SURFACE
Related to #1793.
2021-04-22 22:33:07 +02:00
Camilla Löwy
782e6b6cef Make joystick platform code init on demand
This makes joystick support initialize the first time a joystick
function is called, including those gamepad functions that are layered
on top of joystick functions.

Related to #1284.
Related to #1646.
2020-07-21 17:38:56 +02:00
Camilla Löwy
f5f060e6bf Init hint documentation work
The documentation for window hints had several features that had not
been carried over to init hints.

This also removes listing glfwInitHint for each hint, which was an
artifact of the removal of glfwInitHintString.
2020-06-29 00:02:41 +02:00
Camilla Löwy
0dea8a4441 EGL: Add support for EGL_ANGLE_platform_angle
This adds basic support for selecting the platform type (rendering
backend) when running on ANGLE.

Related to #1380.
2020-06-29 00:02:22 +02:00
Camilla Löwy
72366ac9a9 Cocoa: Finish launching NSApp in glfwInit
This moves the remaining bits of NSApplication initialization into
_glfwPlatformInit.  As a side-effect of this, any command-line program
initializing GLFW will get a menu bar, which is not ideal.

If this has happened to you and a bisect led you here, please see the
GLFW_COCOA_MENUBAR init hint introduced in GLFW 3.3.

If this patch is a terrible idea, please get in touch in the 3.4 release
timeframe.

This is a replacement for 6e6805000a,
which attempts to preserve the existing menu bar creation behavior for
the 3.3-stable branch.

Fixes #1649.
2020-03-12 01:56:35 +01:00
Camilla Löwy
422bf79e8f Documentation work 2019-04-05 03:26:52 +02:00
Camilla Löwy
d5ab3e919a Cleanup
Replace client area with content area.
2019-01-25 12:46:46 +01:00
Camilla Löwy
23dfeee4cb Add semver link to documentation 2018-04-09 00:05:59 +02:00
Camilla Löwy
6158801aeb Change glfwInitHintString to glfwWindowHintString
Fixes #1139.
2017-12-19 15:08:27 +01:00
Emmanuel Gil Peyrot
c3cba58a71 Remove trailing whitespace 2017-12-14 15:36:55 +01:00
Camilla Löwy
1be81a1540 Documentation work 2017-10-22 16:30:19 +02:00
Camilla Löwy
1955c37c48 Documentation work 2017-09-12 22:54:00 +02:00
Camilla Löwy
5bc1c38159 Documentation work
[ci skip]
2017-08-09 12:20:51 +02:00
Camilla Löwy
213dd2d0d6 Add glfwInitHintString
Adds string type init hints.  Adds X11 specific init hints for WM_CLASS
components.  Documentation work.

Fixes #893.
2017-07-25 23:53:52 +02:00
Camilla Löwy
539a728063 Documentation work
[ci skip]
2017-06-30 12:45:29 +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
6350641f0a Add glfwGetError
Related to #970.

If you have opinions on the design or implementation of this function,
please come join us in #970 before it is frozen for release.
2017-05-03 18:30:11 +02:00
Camilla Löwy
16ddfafeaa Allow object creation from callbacks 2017-05-03 15:10:36 +02:00
Camilla Löwy
798d7c6d68 Implement glfwGetJoystickHats
This moves the buttons-as-hats logic to shared code and adds the
GLFW_JOYSTICK_HAT_BUTTONS input mode as a way to disable this legacy
behavior.

Fixes #889.
2017-03-06 03:23:29 +01:00
Camilla Löwy
c50aba1335 Cocoa: Add support for MainMenu.nib loading 2017-03-01 04:36:00 +01:00
Camilla Löwy
6d9a58bfef Add glfwInitHint
This allows setting hints that control how the library is initialized,
transforming more compile-time options into run-time ones.
2017-03-01 04:35:41 +01:00
Camilla Löwy
f69829f7b4 Documentation work
[ci skip]
2017-02-14 14:56:29 +01:00
Camilla Berglund
0f12be7549 Documentation work 2016-08-12 01:57:17 +02:00
Camilla Berglund
c98d09f15d Documentation work 2016-08-12 01:46:17 +02:00
Camilla Berglund
f6ec835599 Fix documentation for timer thread safety 2016-06-02 16:13:47 +02:00
Camilla Berglund
13e2ad2840 Documentation work 2016-03-29 11:37:22 +02:00
Camilla Berglund
793eef1d0a Fix missing word 2016-03-08 15:29:03 +01:00
Camilla Berglund
80c203f3bb Separate guide and reference documentation tags 2016-02-19 10:38:30 +01:00
Camilla Berglund
65870346e4 Add Vulkan functions to thread safety section 2016-02-18 15:17:27 +01:00
Camilla Berglund
0df4e06f11 Make more RFC 2119 compliant use of may 2015-12-13 14:49:01 +01:00
Camilla Berglund
d00579bf60 Clarify pre-initialization threading limitations 2015-11-05 11:38:45 +01:00
Camilla Berglund
0eccf75f65 Replace GL booleans with public macros 2015-10-13 00:46:02 +02:00
Camilla Berglund
2cc3c16ab1 Documentation tweak. 2015-06-15 20:40:15 +02:00
Camilla Berglund
d493a82f9e Various error fixes.
Fixed incorrect error types.  Added missing error string prefixes.
Removed some invalid or superfluous error emissions.  Clarified some
error strings.  Joined error string lines to aid grep.  Replaced some
generic error strings with specific ones.  Documentation work.

Fixes #450.
2015-03-15 15:52:27 +01:00
Camilla Berglund
4188c263e3 Documentation work. 2015-01-18 17:30:10 +01:00
Camilla Berglund
ce8f97c23c Documentation work.
Fixes #212.
Fixes #420.
2015-01-16 01:34:12 +01:00
Camilla Berglund
4e375d0e74 Documentation work. 2015-01-11 18:25:54 +01:00
Camilla Berglund
2085876da6 Documentation work. 2015-01-05 16:17:50 +01:00
Camilla Berglund
44372b89f6 Documentation work. 2014-12-18 02:53:14 +01:00
Camilla Berglund
496567d3f1 Documentation work. 2014-10-13 15:48:40 +02:00
Camilla Berglund
96d230becb Documentation work. 2014-10-07 12:24:31 +02:00
Camilla Berglund
95654cfada Documentation work. 2014-10-06 15:01:58 +02:00
Camilla Berglund
4591ad2d64 Documentation work. 2014-09-22 11:08:33 +02:00
Camilla Berglund
e8e05d462c Documentation work.
Fixes #276.
2014-06-19 11:38:22 +02:00