Commit Graph

593 Commits

Author SHA1 Message Date
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
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
Nicolas Caramelli
8d47dc5894 Update test SPIR-V shader code
Closes #1781.
2020-10-05 23:24:12 +02: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
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
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
Camilla Löwy
efda4afb49 Put fix in correct position
This fixes a mismerge by @elmindreda in
65748fb8f3.
2019-07-25 20:32:51 +02:00
Camilla Löwy
65748fb8f3 Fix Vulkan triangle test segfault on resize
The command buffer handle was not reset after being freed on window
resize, leading to a segfault when the stale handle was used.
2019-07-25 19:56:03 +02:00
Camilla Löwy
6abad2efd2 Fix conflict with DEBUG macro defined by Bazel
The Bazel build system may define DEBUG when compiling on macOS, which
caused the glfwinfo test program to fail to build.

Fixes #1537.
2019-07-24 21:29:46 +02:00
Camilla Löwy
3a5e99e59a Remove unused function in tearing test 2019-06-27 20:07:19 +02:00
Camilla Löwy
d834f01ca4 Rename legacy Vulkan triangle program
Fixes #1477.
2019-05-24 17:28:32 +02:00
Camilla Löwy
537ea4ccf1 Explicitly disable inclusion for test and examples
Thank you, Travis CI, for reminding me that one cannot disable a header
with inclusion guards if it doesn't exist.
2019-05-24 17:28:32 +02:00
Camilla Löwy
51bb76c7c3 Improve (?) reference documentation for callbacks 2019-05-24 14:58:54 +02:00
Camilla Löwy
c415c71947 Clean up glfwinfo Vulkan version output 2019-05-19 21:10:29 +02:00
Camilla Löwy
144c98bcb3 Simplify glfwinfo Vulkan enumerations 2019-05-19 21:10:29 +02:00
Camilla Löwy
fa025d8f80 Convert glfwinfo to C99 2019-05-19 21:10:29 +02:00
Camilla Löwy
700d1f28d8 Add Vulkan 1.1 support to glfwinfo 2019-05-19 21:10:29 +02:00
Camilla Löwy
a255e7ace6 Move to the modern CMake project version option
This replaces the manual ad-hoc version variables we have used since
CMake 2.x (and GLFW 2.x lite).
2019-05-17 16:12:52 +02:00