Commit Graph

115 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
a25e8eb50d Add docs for GLFW_X11_XCB_VULKAN_SURFACE
Related to #1793.
2021-04-22 22:33:07 +02:00
Camilla Löwy
05dd2fa298 Win32: Disable fb transparency when it is broken
On Windows 7, when GLFW framebuffer transparency and the DWM are enabled
but DWM transparency is disabled (i.e. when the Transparency setting is
disabled under Personalization > Color), the contents of the framebuffer
is combined with the last frame using additive blending instead of
replacing the previous contents.

This commit limits GLFW framebuffer transparency on Windows 7 to when
DWM transparency is enabled, removing the previous workaround of setting
a layered window color key that led to rendering artifacts.

Fixes #1512.
2020-07-29 15:21:45 +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
a122d91303 Documentation work for GLFW_MOUSE_PASSTHROUGH
Related to #1568.
2020-07-15 18:02:38 +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
36f8250321 Add missing entries to new symbols list
Related to #1692.
2020-06-28 19:27:49 +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
27295b508f Note removal of wl_shell support in release notes 2020-05-19 18:56:25 +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
4ec7daf3e9 Cocoa: Replace display link with IOKit query
This removes the final dependency on CoreVideo, using a display link to
get the refresh rate of monitors where Core Graphics report a refresh
rate of zero.  Instead we now query the I/O registry directly, similarly
to what the display link does at creation.

Thanks to @OneSadCookie for pointers to this solution.
2019-12-25 21:53:04 +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
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
376897a344 Replace notes for previous releases with links
The news / release notes page was getting a bit long.
2019-10-28 20:02:12 +01:00
Camilla Löwy
8ee589e43b Disable examples and tests when a subproject
This changes the default value of the GLFW_BUILD_EXAMPLES and
GLFW_BUILD_TESTS CMake options to false when GLFW is being added as
a subdirectory by another CMake project.

If you want the previous behavior, force these options to true before
adding the GLFW subdirectory:

set(GLFW_BUILD_EXAMPLES ON CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS ON CACHE BOOL "" FORCE)
add_subdirectory(path/to/glfw)

Doing this is backward compatible with earlier versions of GLFW.

The GLFW_BUILD_DOCS option is left enabled as it also requires Doxygen
to have any effect, is quicker to build and is more likely to be useful
when GLFW is a subproject.
2019-05-17 16:12:52 +02:00
Camilla Löwy
a337c56848 Start 3.4 2019-04-16 23:08:39 +02:00
Camilla Löwy
f4f1002d14 Documentation work 2019-04-15 02:46:07 +02:00
Camilla Löwy
d7e30b1c74 Replace glad and the Vulkan SDK with glad2
This removes all dependencies from the GLFW test programs on the Vulkan
SDK.

It also removes support for linking the GLFW shared library (dynamic
library, DLL) against the Vulkan loader static library.
2019-04-15 02:45:48 +02:00
Camilla Löwy
0fa77ea63a Documentation work 2019-04-08 20:51:34 +02:00
Camilla Löwy
422bf79e8f Documentation work 2019-04-05 03:26:52 +02:00
Camilla Löwy
5644b66bac Documentation work 2019-04-01 19:57:54 +02:00
Camilla Löwy
c0a3a9aefe Sort release notes by seemingly arbitrary criteria 2019-03-29 00:47:04 +01:00
Camilla Löwy
a43d1a4937 Documentation work
Fixes #920.
Related to #1322.
2019-03-05 16:59:46 +01:00
Camilla Löwy
1155c83013 Rename raw input to raw mouse motion, cleanup
This renames 'raw input' to 'raw mouse motion' as there are other kinds
of raw input.  The update path is restructured to avoid reinitializing
all of disabled cursor mode.  Modification of shared state is moved out
into shared code.  Raw mouse motion is disabled by default for
compatibility.

Related to #1401.
2019-02-22 13:04:11 +01:00
Camilla Löwy
d5ab3e919a Cleanup
Replace client area with content area.
2019-01-25 12:46:46 +01:00
MrVallentin
85fd5aa6c4 Use HTTPS when possible 2018-11-03 11:57:47 +01:00
Emmanuel Gil Peyrot
cc805c0963 Mir: Remove this experimental backend
As of the release of Mir 1.0, libmirclient has been deprecated[1] and
its developers recommend clients using it to switch to Wayland.  This
patch removes support for libmirclient and instruct users to use the
experimental Wayland backend instead.

[1] https://discourse.ubuntu.com/t/mir-news-28th-september-2018/8184
2018-10-05 11:59:26 +02:00
Camilla Löwy
089ea9af22 Add GLFW_SCALE_TO_MONITOR
This adds the GLFW_SCALE_TO_MONITOR window hint for automatically
resizing the content area of a window to the requested size times the
monitor content scale each time it is placed on a new monitor.  This
only applies to windowed mode windows and includes the initial placement
at window creation.

This hint only has an effect on platforms where screen coordinates and
pixels always map 1:1 such as Windows and X11.  Platforms like macOS
instead change the resolution of the framebuffer independently of the
window size.

Related to #676.
Related to #1115.
2018-09-03 23:12:39 +02:00
Coşku Baş
ccef385f02 Fix content scale callback func name
Related to #1310.
2018-08-09 19:03:42 +02:00
Doug Binks
0be4f3f75a Add GLFW_FOCUS_ON_SHOW window hint and attribute
This adds a window hint and attribute for controlling whether
glfwShowWindow gives the specified window input focus in addition to
making it visible.

Fixes #1189.
Closes #1275.
2018-05-29 15:51:36 +02:00
Camilla Löwy
ab3bfb4205 Cocoa: Update MoltenVK support for LunarG SDK
GLFW now checks for the libvulkan.1.dylib loader instead of what is now
the ICD.  This removes checking for libMoltenVK.dylib to avoid cryptic
errors.  This unfortunately also breaks compatibility with the
standalone MoltenVK SDK.

This also removes support for the static loader library as that is not
present in the LunarG SDK.

Related to #870.
2018-03-01 21:45:46 +01:00
Camilla Löwy
d6b3a60fbc Documentation work
Added missing bits of documentation for GLFW_HOVERED.
2018-01-11 14:13:54 +01:00
Camilla Löwy
370eac3c48 Add glfwSetWindowContentScaleCallback
Related to #677.
Related to #1115.
2018-01-09 18:00:22 +01:00
Camilla Löwy
7c2c7858c6 Add monitor and joystick user pointers 2017-12-19 15:08:28 +01:00
Camilla Löwy
6158801aeb Change glfwInitHintString to glfwWindowHintString
Fixes #1139.
2017-12-19 15:08:27 +01:00
Camilla Löwy
11e47f08b1 Add glfwGetWindowOpacity and glfwSetWindowOpacity
This adds support for setting the opacity of the whole window, including
any decorations.

Fixes #1089.
2017-11-15 15:46:01 +01:00
Camilla Löwy
49130ab8ec Rename framebuffer transparency hint
This is a breaking change of an unreleased API.
2017-11-14 17:21:36 +01:00
Camilla Löwy
16bf872117 Add content scale queries
This adds glfwGetWindowContentScale and glfwGetMonitorContentScale for
querying the recommended drawing scale factor for DPI-aware rendering.

Parts of this patch are based on code by @ferreiradaselva.

Fixes #235.
Fixes #439.
Fixes #677.
Fixes #845.
Fixes #898.
2017-10-26 17:26:36 +02: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
Camilla Löwy
b7a0f225ea Cleanup
Don't advertise native functions in public API guides.  Don't list
primary selection access as most notable new feature.  Don't have
different levels of abstraction among selection helper functions.  Don't
forget to take credit.

Related to #1056.
2017-08-13 21:22:36 +02:00
Kristian Nielsen
29a75ab09d X11: Add native access to primary selection
This adds the native access functions glfwSetX11SelectionString and
glfwGetX11SelectionString under GLFW_EXPOSE_NATIVE_X11.  They are
similar to glfwSetClipboardString and glfwGetClipboardString but operate
on the PRIMARY selection.

The primary selection is widely used in X11, and so seems important to
support.  Primary selection is mostly an X11-specific thing, hence it's
exposed as an X11 native interface.

Fixes #894.
Closes #1056.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2017-08-13 18:52:24 +02:00
Camilla Löwy
5b7281bd41 Add glfwGetJoystickGUID
This function completes the first round of support for
SDL_GameControllerDB.

Fixes #900.
2017-07-30 16:15:12 +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
953106e74d Add support for SDL_GameControllerDB
This adds support for importing and applying mappings from the
SDL_GameControllerDB database.

Related to #900.
2017-07-07 15:52:33 +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
baa9cd8968 Cleanup
Closes #988.
2017-05-11 20:10:04 +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