Commit Graph

386 Commits

Author SHA1 Message Date
Camilla Löwy
0f9a9578f3 Add window hints for initial position
This adds window hints for the initial position, in screen coordinates,
of a window.  The special value GLFW_ANY_POSITION means the window
manager will be allowed to position the window.

It is not possible to set window positions on Wayland and GLFW will
always behave as if these hints are set to GLFW_ANY_POSITION.

Fixes #1603
Fixes #1747
2022-07-29 11:50:13 +02:00
Camilla Löwy
2efc598d70 Fix native access macros being mutually exclusive
The documentation was updated with the introduction of run-time platform
selection, but the preprocessor logic was not.
2022-07-28 15:56:47 +02:00
Camilla Löwy
488008e0a2 Add cursor mode GLFW_CURSOR_CAPTURED
This adds a cursor mode that provides a visible cursor confined to the
content area of the window.

Fixes #58
2022-07-25 18:02:57 +02:00
Michael Pennington
b9ed25d2e9 Wayland: Add GLFW_WAYLAND_APP_ID window hint
This adds a window hint string for the xdg_toplevel::app_id, which is
used by desktop environments to connect windows with application icons
and other information.  This is similar to the WM_CLASS property on X11.

A few very minor fixes were done by @elmindreda during merge.

Fixes #2121
Closes #2122
2022-07-24 17:51:54 +02:00
Camilla Löwy
aa80d24d01 Documentation work
Fixes #1596
2022-07-12 19:08:01 +02:00
Camilla Löwy
2796e61af7 Documentation work 2022-07-11 20:54:22 +02:00
Camilla Löwy
05f6c13d11 Add support for GLFW_NATIVE_INCLUDE_NONE macro
By default, the glfw3native.h header will include the platform-specific
headers necessary for the return types of GLFW native access functions.

Sometimes it is preferrable to declare those types

This commit adds support for the GLFW_NATIVE_INCLUDE_NONE macro, which
when defined disables the inclusion of all platform-specific headers.

Fixes #1348
2022-06-08 22:14:38 +02:00
Camilla Löwy
edec334b32 Cocoa: Use system header to declare id type
Related to #1348
2022-06-08 22:14:38 +02:00
Camilla Löwy
ce85c7dcaf Fix GLAPIENTRY not being defined for native access
This is a follow-up to 535c3ce632.

That commit made glfw3native.h undefine GLAPIENTRY whenever
GLFW_EXPOSE_NATIVE_GLX or GLFW_EXPOSE_NATIVE_OSMESA was defined, on the
assumption that it was glfw3.h that had defined GLAPIENTRY.

If gl.h or an extension loader header has been included before glfw3.h,
then it has defined inclusion guards preventing GLAPIENTRY from being
defined later when the GLX or OSMesa header includes gl.h.

This commit ensures GLAPIENTRY is only undefined if glfw3.h defined it.

Related to #2010
2022-05-06 19:18:47 +02:00
Camilla Löwy
685de9089f Fix and clarify comments for GLFWAPI 2022-04-28 21:58:44 +02:00
Camilla Löwy
06089a91a6 Document delayed initialization of EGL display 2022-04-28 21:18:49 +02:00
Camilla Löwy
66a4882eb1 Add checks for some invalid values to public API
There were no checks for invalid values or asserts for all invalid NULL
pointers to glfwSetWindowIcon or glfwCreateCursor.

Fixes #1862
2022-03-18 00:23:20 +01:00
Camilla Löwy
add0521efb Fix accidental C99 in C89 header 2022-03-16 18:41:27 +01:00
Camilla Löwy
535c3ce632 Fix GLAPIENTRY redefinition warning
On a Unix system, if you define GLFW_INCLUDE_NONE and
GLFW_EXPOSE_NATIVE_GLX, then include glfw3.h and glfw3native.h, you will
get a redefinition warning for GLAPIENTRY.

The glfw3.h header defines GLAPIENTRY as a service for OpenGL related
headers that assume it's already defined.  However, glx.h includes gl.h,
which defines GLAPIENTRY unconditionally.

If not for Hyrum's law, the better solution would have been not to
define GLAPIENTRY if GLFW_INCLUDE_NONE is defined.

Fixes #2010
2022-03-16 18:40:26 +01:00
Camilla Löwy
8edbc4971d Wayland: Document delayed window showing 2021-12-27 01:31:38 +01:00
Camilla Löwy
05b0e2fab2 Update docs for specific Vulkan surface extensions
Related to #2014
2021-12-26 18:10:18 +01:00
InKryption
c19f36b28d Add missing errors section for glfwGetGamepadName
The reference documentation for glfwGetGamepadName lacked the possible
errors section.

Closes #2007
2021-12-08 19:20:45 +01:00
Stephen Gutekanst
37fc28bff6 Fix docs calling GLFW_CONTEXT_REVISION a hint
This docstring previously indicated that GLFW_CONTEXT_REVISION was
a window hint and attribute, but in fact it is only a window attribute
(there is no code which uses this constant in any other context.)

We noticed this in https://github.com/hexops/mach/pull/71/files#r749741814

Closes #1992

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-25 23:44:12 +01:00
InKryption
bb193325cc Add missing error to glfwGetClipboardString docs
Add GLFW_FORMAT_UNAVAILABLE to the list of possible errors in the
reference documentation for glfwGetClipboardString.

Slightly edited by @elmindreda.

Closes #1998
2021-11-25 23:24:26 +01:00
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
luz paz
0fe96ec202 Fix various typos
Found via `codespell -q 3 -S ./deps -L fo,numer,te,uint,wille`

Closes #1965
2021-10-25 23:39:06 +02:00
Camilla Löwy
309d79376f Fix GLFW_INCLUDE_GLEXT being ignored for glcorearb
The GLFW_INCLUDE_GLCOREARB branch was left out when GLFW_INCLUDE_GLEXT
was originally added, for reasons that are lost to history.  The current
versions of these headers seem to co-exist just fine.

Issue reported on IRC.
2021-10-25 23:39: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
983c44b255 Document possible native access function errors 2021-10-12 12:54:35 +02:00
Camilla Löwy
4be0444ee6 Remove potentially incorrect claim 2021-10-12 12:54:19 +02:00
Camilla Löwy
6a20053102 Fix docs for Windows monitor size calculation
This sentence was truncated by 951a9583fa
and then not updated when content scale support was added with
16bf872117.
2021-10-12 00:23:37 +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
4e557437f2 Name parameters for callback function types
Started adding these because of Doxygen warnings but it should have been
done regardless.
2021-08-25 20:48:40 +02:00
Camilla Löwy
15e05adf67 Add notes on getting the HDC of a window on Win32
Related to #1913.
2021-06-14 21:21:17 +02:00
Camilla Löwy
04f21abb52 Make GLFW_DOUBLEBUFFER a window attribute 2021-05-14 19:02:25 +02:00
Camilla Löwy
e17ffcd0db Fix header version macro descriptions in docs 2021-05-12 19:09:59 +02:00
Camilla Löwy
0e9ec7788b Fix description of video mode ordering in docs
The two final sorting criteria were not included in the documentation.

Fixes #1889.
2021-04-22 23:09:44 +02:00
Camilla Löwy
85bce8a8ea Replace GL_ARB_debug_output in comments 2021-04-22 22:37:37 +02:00
Camilla Löwy
4c90e21e8f Fix grammar in MoltenVK support docs 2021-04-22 22:33:40 +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
Nicolas Caramelli
84f95a7d7f Add GLFW_X11_XCB_VULKAN_SURFACE init hint
This hint controls whether GLFW will try to use VK_KHR_xcb_surface
before falling back to VK_KHR_xlib_surface.

Closes #1793.
2021-04-14 23:38:22 +02:00
Emmanuel Gil Peyrot
1ed1489831 Fix typo in GLFWwindowmaximizefun documentation
Thanks brianzuvich!

Fixes #1764.
2020-09-07 20:19:51 +02:00
Camilla Löwy
a122d91303 Documentation work for GLFW_MOUSE_PASSTHROUGH
Related to #1568.
2020-07-15 18:02:38 +02:00
Rokas Kupstys
d285a9fdeb Add support for mouse input transparency
This adds the GLFW_MOUSE_PASSTHROUGH window hint and attribute for
controlling whether mouse input passes through the window to whatever
window is behind it.

Fixes #1236.
Closes #1568.
2020-07-15 17:59:55 +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
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
4e3b43383a Re-word docs for GLFW_OPENGL_DEBUG_CONTEXT attrib
Related to #1720.
2020-06-28 19:25:28 +02:00
Luflosi
b66f105f3e
Fix typos 2020-06-23 16:41:37 +02:00
Tatsuya Yatagawa
81f475bccb Fix GLU header inclusion being disabled
This fixes a regression introduced by
105cf32e0b where GLFW_INCLUDE_GLU had no
effect if the GLFW header detected an earlier OpenGL header or loader
library header.

Closes #1712.
2020-06-17 18:31:44 +02:00
Camilla Löwy
9a87c2a4b4 Add feature available/implemented errors
This adds two new error codes: GLFW_FEATURE_UNAVAILABLE for when
a GLFW feature cannot be reasonably implemented on that platform, and
GLFW_FEATURE_UNIMPLEMENTED for when it can be but has not been yet.

This replaces the current situation where the Wayland code emitted
GLFW_PLATFORM_ERROR in both cases while the macOS code silently did
nothing.

If your application exits on any GLFW error, these error codes should at
least be easy to filter out from that behavior.

Ideally, GLFW_FEATURE_UNAVAILABLE should be rare and
GLFW_FEATURE_UNIMPLEMENTED should never be emitted at all.

Fixes #1692.
2020-06-02 17:18:18 +02:00
A. Tombs
7486e12f88 Add statement to docs for glfwTerminate
It is safe to call glfwTerminate both before initialization and after
termination.

Closes #1698.
2020-05-27 23:19:52 +02:00
Camilla Löwy
105cf32e0b Fix desktop GL header not always being suppressed
If an OpenGL ES header or the glcorearb header is included before the
GLFW header (with no options defined), the legacy OpenGL header will be
implicitly included and the compilation will fail.

This disables the default behavior if we detect any known OpenGL, OpenGL
ES or extension loader inclusion guard macro.

Sources:
 - Khronos headers
 - Windows SDK
 - MinGW
 - MinGW-w64
 - flextGL
 - glad
 - glad2
 - GLEW
 - Galogen
 - gl3w
 - GLXW
 - glbinding
 - Epoxy
 - Glatter
 - glLoadGen
 - Regal
 - GLee
 - OpenGL.framework
 - Debian
 - FreeBSD
 - ANGLE
 - SwiftShader

Related to #1695.
2020-05-27 20:21:01 +02:00
Camilla Löwy
41a19ed49c Disambiguate Vulkan support reference link 2020-05-05 00:38:14 +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
4381b86b6b X11: Fix CJK IME input when locale CTYPE is "C"
Fixes #1587.
Fixes #1636.
2020-02-12 19:01:16 +01:00