Commit Graph

118 Commits

Author SHA1 Message Date
Camilla Löwy
2c0f34b60f WGL: Fix count of displayable pixel formats
We only care about displayable pixel formats (as defined in
WGL_ARB_pixel_format) for window context creation.

This changes pixel format enumeration to ignore non-displayable formats,
which are specified to be listed after displayable ones, by always using
the return value of DescribePixelFormat as the pixel format count.
2022-08-22 19:15:41 +02: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
4005f70eef WGL: Limit DWM swap interval hack to Vista and 7
This hack breaks when switching a window to fullscreen, if the OpenGL
ICD detects this and switches its swapchain to exclusive mode.

This limits the hack to Windows Vista and 7.  This hack was added
because of vsync jitter under DWM on Windows 7 and I have been unable
to reproduce it on any later version.

Is this change causing any problems on any version of Windows?  Please
open an issue!

Fixes #1072
2021-10-27 18:22:05 +02: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
fd79b02840 Move single/double-buffer filtering to backends
There is no need to enumerate framebuffer configs that will just be
filtered out later by the GLFW_DOUBLEBUFFER hard constraint.
2021-05-14 19:02:25 +02:00
Camilla Löwy
84ec99bb01 Remove pointless comments 2019-05-24 14:43:49 +02:00
Camilla Löwy
22a6c02a4c WGL: Add extension function macro aliases
This should have been done when the WGL extension members were moved
from the context struct to the library struct.
2019-05-24 14:43:49 +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
Cliff Smolinsky
87458617e0 Win32: Bypass composition check on Windows 8+
DWM composition is always enabled on Windows 8 and later, so there's no
need to call DwmIsCompositionEnabled on those platforms.

Fixes #1452.
Closes #1453.
2019-04-01 18:11:55 +02:00
Camilla Löwy
ec3784f3d7 WGL: Unify query error handling 2019-02-17 18:34:56 +01:00
Camilla Löwy
782f7fe0c7 WGL: Fix leak on format attrib query failure
This was found by Coverity Scan.
2019-02-17 18:34:56 +01:00
Camilla Löwy
b41cd34143 Cleanup 2019-01-25 12:46:46 +01:00
Camilla Löwy
3d748cf530 Cleanup
Related to #1381.
2019-01-17 00:12:59 +01:00
Doug Binks
babafc13db WGL: Add array-based call to wglGetPixelFormatAttribivARB
This improves performance of pixel format enumeration and helps the very
poor performance reported on a small number of machines.

Closes #1381.
2019-01-17 00:12:59 +01:00
Camilla Löwy
2053f3ed22 Cleanup 2019-01-17 00:11:17 +01:00
Camilla Löwy
6bd264244a WGL: Cleanup 2018-10-22 00:51:08 +02:00
Camilla Löwy
a67d8afbd4 Win32: Clean up DWM detection 2018-08-24 15:06:39 +02:00
Camilla Löwy
1034b6e0db Move context management out of glfwCreateWindow
Related to #25.
2018-01-09 17:58:54 +01:00
Camilla Löwy
32e78aeb2e Add GLFW_TRANSPARENT attribute and documentation
This completes support for window framebuffer transparency on Windows,
macOS and X11.  Note that the hint/attribute may be renamed before
release to clarify its relationship to GLFW_OPACITY.

Fixes #197.
Closes #1079.
Related to #663.
Related to #715.
Related to #723.
Related to #1078.
2017-09-27 21:54:04 +02:00
Bailey Cosier
93e66661d3 Cleanup
This is an extract of a commit, minimally edited to ensure it compiles.

Closes #1078.
Related to #197.
2017-09-27 21:33:03 +02:00
Christopher Pelloux
51f0cd3b51 Win32: Implement GLFW_TRANSPARENT
This is a squashed extract of several commits, minimally edited to
ensure it compiles.

Related to #197.
Related to #723.
2017-09-27 21:33:03 +02:00
Camilla Löwy
0d6937b33b Cleanup 2017-08-20 14:41:49 +02:00
Camilla Löwy
32f482a6d8 Cleanup 2017-06-08 16:38:45 +02:00
Camilla Löwy
52f7684487 WGL: Add WGL_ARB_create_context_no_error support 2017-06-08 16:09:15 +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
731ff91acd WGL: Add support for WGL_EXT_colorspace 2017-05-10 19:36:26 +02:00
Camilla Löwy
aaf2800c9c Add internal TLS support
Related to #970.
2017-03-19 00:52:46 +01:00
Camilla Löwy
c28778e28c Win32: Improve platform error messages
Related to #733.
2017-01-20 01:35:24 +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
53fafad915 Start 3.3 2016-08-18 23:55:49 +02:00
Camilla Berglund
923568a279 Add support for WGL_ARB_create_context errors 2016-08-01 20:46:59 +02:00
Camilla Berglund
d5e00e6b0f Initialize context creation APIs on demand 2016-07-20 13:10:51 +02:00
Camilla Berglund
1b82546b90 Cleanup 2016-06-23 15:34:23 +02:00
Camilla Berglund
e250c226ca Cleanup 2016-06-23 14:48:25 +02:00
Camilla Berglund
7f2e4d8ace Win32: Fix possible leak of dummy context 2016-06-23 14:17:54 +02:00
Camilla Berglund
6f313ff245 Win32: Use helper window to load WGL extensions
This removes window re-creation logic by performing the initial context
creation on the helper window, simplifying both window and context
creation and paving the way for attaching to existing window handles
without compromising on context or framebuffer hint support.
2016-06-22 23:33:34 +02:00
Camilla Berglund
f2ba78e04b Rename static functions to allow unity build
Fixes regression introduced by GLFW_CONTEXT_CREATION_API.

Fixes #783.
2016-06-15 01:35:07 +02:00
Camilla Berglund
757eea2779 Update email address 2016-06-01 21:25:20 +02:00
Camilla Berglund
6a8e169001 Update copyright notice year 2016-06-01 21:25:19 +02:00
Camilla Berglund
bda031f4ac Cleanup 2016-05-29 15:34:08 +02:00
Camilla Berglund
ef80beab81 Add run-time context creation API selection
Fixes #145.
2016-05-04 17:00:07 +02:00
Camilla Berglund
f96d865b93 Cleanup 2016-03-28 20:16:53 +02:00