Commit Graph

605 Commits

Author SHA1 Message Date
Doug Binks
c97e3a657b Merge branch 'master' into multi-context-windows-merge-master 2022-03-31 16:49:50 +01:00
Camilla Löwy
8aaea57421 Fix gamma test not checking for NULL return value 2021-12-31 13:13:21 +01:00
Camilla Löwy
f8ef3ca719 Add hiding and showing to interactive window test 2021-12-24 00:56:44 +01:00
Camilla Löwy
cd01187b9d Fix initial windowed mode size for test 2021-12-09 20:05:07 +01:00
Camilla Löwy
575d2971d4 Fix glfwinfo not handling --platform=any 2021-10-27 18:22:06 +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
1d8d1ff3d0 Fix output for missing Vulkan surface extensions
When the Vulkan loader is present but there are no required surface
extensions, as will for example happen with the Null platform, glfwinfo
caused an error in glfwGetPhysicalDevicePresentationSupport and produced
confusing output.
2021-10-12 12:54:34 +02:00
Camilla Löwy
7614d088e9 Fix string buffer sizes in window test 2021-10-05 18:11:25 +02:00
Doug Binks
b88a8c9364 Fixed usercontext glad use after merge 2021-09-04 12:41:39 +01:00
Camilla Löwy
7a55ca34b9
Merge branch 'master' into multi-context-windows 2021-09-02 19:31:33 +02:00
Camilla Löwy
62074f3dea Update glad2 and switch to header-only version
This updates to a newer version of glad2 and switches to the header-only
variant.

This also (finally) switches to the newer glad2 loader signature that
allows us to pass in glfwGetInstanceProcAddress directly.
2021-08-26 16:03:40 +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
061a0263a9 Win32: Fix compilation with standalone LLVM
The /clang: suffix passed to Clang-CL was accidentally also passed to
the regular standalone Clang, which caused compilation to fail.  We now
pass /W3 to Clang-CL, which it interprets as -Wall.

The _CRT_SECURE_NO_WARNINGS macro is now defined for both Clang and
Clang-CL.

The /entry: flag passed to link.exe is now also passed to lld-link,
letting the windows subsystem tests and examples link.

Fixes #1807.
Closes #1824.
Closes #1874.
2021-04-22 22:37:37 +02:00
Camilla Löwy
330f7da746 Add Vulkan device presentation support to glfwinfo
The glfwinfo tool now reports the results of
glfwGetPhysicalDevicePresentationSupport for each physical device.
2021-04-22 22:37:13 +02:00
Camilla Löwy
0beadfdc66 Add window surface creation to glfwinfo
The glfwinfo tool now attempts Vulkan surface creation via
glfwCreateWindowSurface and reports the results.
2021-04-22 22:34:40 +02:00
Camilla Löwy
f90df24244 Add GLFW_X11_XCB_VULKAN_SURFACE flag to glfwinfo 2021-04-22 22:33:40 +02:00
Doug Binks
b0d196c43c Formatting consistency fixes 2021-03-23 18:45:29 +00:00
Doug Binks
e91b1820dd Modified clear colour of usercontext test to remove transparency 2021-03-23 12:37:54 +00:00
Doug Binks
ab4b4e95f6 Merge branch 'master' into merge 2021-03-22 15:33:40 +00:00
Nicolas Caramelli
8d47dc5894 Update test SPIR-V shader code
Closes #1781.
2020-10-05 23:24:12 +02:00
Doug Binks
e2016291f1 Merge branch 'master' into multi-context-windows 2020-09-04 17:44:36 +01:00
Camilla Löwy
5c92cd9f52 Make windows test a tolerable example 2020-07-15 19:22:30 +02:00
Camilla Löwy
686e18fd72 Remove window opacity test
It has been superceded by the window property test.
2020-07-15 19:08:09 +02:00
Camilla Löwy
3207fc7120 Add window property test 2020-07-15 19:08:04 +02:00
Doug Binks
d01ad1a78d Improved usercontext.c test 2020-07-15 13:19:47 +01:00
Doug Binks
4caca8b20c glfwMakeUserContextCurrent now calls glfwMakeContextCurrent(NULL) to ensure TLS set. 2020-07-15 11:18:58 +01:00
Doug Binks
3a0a3c540c Merge branch 'master' into multi-context-windows 2020-07-13 11:04:23 +01: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
e6a6a99813 Use stdbool more consistently in glfwinfo 2020-06-28 21:23:29 +02:00
Camilla Löwy
1cecb8beb0 Move glfwinfo argument processing before glfwInit
This will allow init hints to be controlled by command-line arguments.
2020-06-28 21:23:29 +02:00
Camilla Löwy
b420ca7404 Add GLFW_CONTEXT_DEBUG window hint alias
This adds GLFW_CONTEXT_DEBUG as a preferred alias for
the GLFW_OPENGL_DEBUG_CONTEXT window hint, as debug contexts are
defined for both OpenGL and OpenGL ES.

Related to #1720.
2020-06-28 19:27:48 +02:00
Doug Binks
a08bfd9891 User Contexts API with Win32 implementation. 2020-06-03 19:46:22 +01: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
49c5d837b4 Replace CMake threads variable with modern target 2019-12-15 18:37:56 +01:00
Camilla Löwy
59055d585f Update minimum required CMake version to 3.1 2019-12-09 23:48:26 +01:00
Camilla Löwy
8a1f4940fc Remove reference to non-existent CMake variable 2019-12-09 23:48:26 +01:00
Camilla Löwy
c016b26852 Remove non-GUI binaries from GUI-only setup 2019-12-09 23:48:26 +01:00
Camilla Löwy
2fb336268f Shorten name of Info.plist template file
Our template file is not simply a copy of the file included in CMake and
so should not be named as if it was.
2019-12-09 23:35:50 +01:00
Camilla Löwy
ce9d124243 Remove command-line options from GUI-only test 2019-12-09 23:35:50 +01:00
Camilla Löwy
d74c18117d Remove dependency on platform header paths
The tests and examples should not need these paths.
2019-12-09 23:33:37 +01:00
Camilla Löwy
92c70b2a83 Rename CMake variable for GUI-only programs
Hopefully this is less ambiguous.
2019-12-09 23:33:37 +01:00
Camilla Löwy
7dbdd2e6a5 Add more standard cursors
This adds the standard cursors for diagonal and omnidirectional
resize/move and operation-not-allowed.  It also adds new (better?) names
for the horizontal and vertical resize/move and pointing hand cursors.

References:
 - https://developer.apple.com/documentation/appkit/nscursor
 - https://stackoverflow.com/questions/10733228/
 - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setsystemcursor
 - https://freedesktop.org/wiki/Specifications/cursor-spec/
 - https://tronche.com/gui/x/xlib/appendix/b/

Related to #427.
2019-11-28 22:24:00 +01:00
Camilla Löwy
953a1c3f8b Cleanup 2019-11-11 22:37:18 +01:00
Guillaume Racicot
bc5523e994 Set C standard at 99 for all test targets
Related to #1593.
2019-11-11 22:37:18 +01:00
Camilla Löwy
8e288dc94c Win32: Add GLFW_WIN32_KEYBOARD_MENU
This platform specific window hint enables access to the Windows window
menu via the keyboard shortcuts.
2019-11-11 22:37:18 +01:00
Camilla Löwy
de23429455 Add reminder for why events test is not closing 2019-11-11 22:37:18 +01:00
Camilla Löwy
08f01c31a0 Add gamepad information to events test output 2019-11-11 22:37:18 +01:00
Camilla Löwy
20e522cdf4 Make events test output only UTF-8 in C locale 2019-11-11 22:37:18 +01:00
Camilla Löwy
f71b55f83d Clean up monitors tool output 2019-10-16 02:33:12 +02:00
luz.paz
7105ff2dfd Fix typos
Found via `codespell -q 3 -S ./deps -L fo,numer,te,uint,wille`
2019-09-16 12:30:25 +02:00