Commit Graph

4600 Commits

Author SHA1 Message Date
Camilla Löwy
b55a517ae0 Add credit
Related to #1994
2021-11-22 21:32:34 +01:00
Jan Ekström
544790666b Cocoa: Use MACH_PORT_NULL for default IOKit port
Looking into the definition of kIOMainPortDefault, the following
description can be found:

When specifying a main port to IOKit functions, the NULL argument
indicates "use the default". This is a synonym for NULL, if you'd
rather use a named constant.

Thus, we do not have to utilize an external symbol for the identifier
of the default main IOKit port, but MACH_PORT_NULL suffice. This
simplifies compatibility between macOS versions as the symbol was
renamed with macOS 12.0.

Fixes #1985
Closes #1994
2021-11-22 21:30:53 +01:00
Camilla Löwy
fb0f2f92a3 Add missing changelog entries 2021-10-28 13:22:37 +02:00
Camilla Löwy
83d3fb08ec Fix some spelling errors in changelog 2021-10-28 00:01:24 +02:00
Camilla Löwy
999962bd2f Update changelog and add credit
Related to #1980
2021-10-27 23:14:19 +02:00
Josh Codd
f75c251dec Cocoa: Fix deprecation of kIOMasterPortDefault
This adds a workaround for kIOMasterPortDefault having been deprecated
in favor of kIOMainPortDefault in macOS 12.0.

Closes #1980
2021-10-27 23:09:40 +02:00
Camilla Löwy
575d2971d4 Fix glfwinfo not handling --platform=any 2021-10-27 18:22:06 +02:00
Camilla Löwy
2a78a2cf82 Refactor platform selection for clarity? 2021-10-27 18:22:06 +02: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
Camilla Löwy
393eac458b Improve Vulkan guide header section 2021-10-27 18:22:05 +02:00
Camilla Löwy
db91507956 Remove saving a function pointer only used once
This removes the global struct member for
vkEnumerateInstanceExtensionProperties, which is only used in the same
function that fetches the function from the loader.

The pattern is now more in line with how other single uses of Vulkan
functions are structures, such as window surface creation.
2021-10-27 18:22:05 +02:00
Camilla Löwy
ee6ff939a5 Fix invalid pointer conversions
C does not allow conversions between data pointers and function
pointers.

Yes, the name of the macro is reserved.  That's something for a future
commit to fix.

Fixes #1703
2021-10-27 18:22:05 +02:00
Camilla Löwy
68534cc2ce Null: Remove unused function 2021-10-27 18:22:05 +02: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
Camilla Löwy
53d7622a3a Move list of contributors to separate file
Fixes #1839
2021-10-27 18:19:38 +02:00
Camilla Löwy
41ebcf1eed Add credit
Related to #1965
2021-10-25 23:39:07 +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
3d52f7e345 Limit scope of some loop counters in C99 files 2021-10-25 23:39:06 +02:00
Camilla Löwy
f4d0365a5a Use switch statement instead of if-else-chain
Related to #1739
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
6efaaec9ce Improve headings and TOC layout in Doxygen docs
This more or less restores the original custom layout where the TOC is
on the right side, with a CSS workaround added for portrait orientation.

The indentation of sub-lists in the TOC has been decreased.

The sizes of HTML headings and the "h0" div generated for each Doxygen
page have been adjusted to look better together now that they can meet.

A few headings have been shortened to fit better in the narrower TOC.
2021-10-25 23:38:41 +02:00
Camilla Löwy
38dd515524 Use Win32 instead of Windows in Doxygen headings
This was especially bad in the window guide, where the TOC ended up
having "Window related hints" and "Windows specific window hints" close
to one another.

This commit only fixes headings.  There are likely issues in the actual
text as well.
2021-10-23 20:28:47 +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
ff9d9515f6 Remove typedefs only used in one place 2021-10-12 12:54:37 +02:00
Camilla Löwy
36ea36736d Cocoa: Change helper function suffix to Cocoa
This makes it clearer which platform a helper function belongs to.
2021-10-12 12:54:37 +02:00
Camilla Löwy
09f9773e6f Cocoa: Make timer functions backend independent
This is work towards allowing the Null backend to build for macOS
using the Darwin timer API, without the Cocoa backend being enabled.
2021-10-12 12:54:37 +02:00
Camilla Löwy
bdfe6b09af Win32: Make timer functions backend independent
This is work towards allowing the Null backend to build for Windows
using the Win32 timer API, without the Win32 backend being enabled.
2021-10-12 12:54:37 +02:00
Camilla Löwy
b6834bf2a1 Win32: Remove timeGetTime fallback for timer
The performance counter API is guaranteed to succeed on Windows XP and
later so there is no need for a fallback.

This removes our last dependency on winmm.
2021-10-12 12:54:37 +02:00
Camilla Löwy
35f3b58c21 Win32: Make thread functions backend independent
This is work towards allowing the Null backend to build for Windows
using the Win32 threading API, without the Win32 backend being enabled.
2021-10-12 12:54:36 +02:00
Camilla Löwy
f5758d75d0 Remove context creation backend headers
These headers come from when GLFW only supported a single context
creation API at a time, chosen at compile-time.

Since EGL and OSMesa are now always enabled and the platform-specific
APIs are tied to their specific window system, there is no reason to
keep these declarations separate from the internal.h and *_platform.h
header files.
2021-10-12 12:54:36 +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
e31deedc99 Make timer init part of platform API
This is part of runtime platform selection because the null backend
needs the timer implementation for the current OS.
2021-10-12 12:54:36 +02:00
Camilla Löwy
6d51b39106 Select mapping platform name at runtime
This is done in preparation for runtime platform selection.
2021-10-12 12:54:35 +02:00
Camilla Löwy
d0776e04a3 Null: Add non-functional EGL support
This is done in preparation for runtime platform selection, to make sure
every platform can build with EGL enabled.

It may be possible to add support for things like the ANGLE null
platform later.
2021-10-12 12:54:35 +02:00
Camilla Löwy
8b8d10bc01 Move library dependency logic to src directory
This finally eliminates the glfw_INCLUDE_DIRS and glfw_LIBRARIES CMake
variables entirely.
2021-10-12 12:54:35 +02:00
Camilla Löwy
0a9488e3f0 Remove configuration header 2021-10-12 12:54:35 +02:00
Camilla Löwy
efe764b492 Remove blank line before the end of some structs 2021-10-12 12:54:35 +02:00
Camilla Löwy
983c44b255 Document possible native access function errors 2021-10-12 12:54:35 +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
0391b7b277 Remove Doxyfile tags deprecated by Doxygen 1.9.2 2021-10-12 12:54:35 +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
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
7614d088e9 Fix string buffer sizes in window test 2021-10-05 18:11:25 +02:00
Camilla Löwy
6ed5294223 Cocoa: Fix unresponsive cursor after cursor warp
This is a companion to 157ebb80aa and
fixes the same issue for calls to glfwSetCursorPos.

Related to #1962
2021-09-12 20:01:34 +02:00
Ioannis Tsakpinis
157ebb80aa Cocoa: Fix unresponsive cursor after ungrab
There is a suppression interval (0.25 seconds by default) after a call
to CGWarpMouseCursorPosition, during which local hardware events
(keyboard and mouse) are ignored. GLFW already calls
CGEventSourceSetLocalEventsSuppressionInterval with a value of 0.0, but
it doesn't help in this case, there is still a short delay before the
cursor can be moved. Moving the CGAssociateMouseAndMouseCursorPosition
call after the cursor position has been restored, fixes the issue.

Closes #1962
2021-09-10 18:52:47 +02:00
Waris Boonyasiriwat
e7758c506d Wayland: Fix cursor offset when shape changes
The Wayland protocol spec[1] states that set_cursor must be called
with the serial number of the enter event.  However, GLFW is passing in
the serial number of the latest received event, which does not meet the
protocol spec.

[1] https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_pointer

As a result, set_cursor calls were simply ignored by the compositor.

This fix complies with the protocol more closely by specifically caching
the enter event serial, and using it for all set_cursor calls.

Fixes #1706
Closes #1899
2021-09-02 19:09:33 +02:00
Camilla Löwy
4cbe743b74 Wayland: Fix standard cursor name selection
Regression introduced by 08e5a17063.
2021-09-02 18:30:41 +02:00
Koray Kilinc
216d5e8402 Wayland: Fix some keys not repeating
According to the libxkbcommon documentation[1], xkb_keymap_key_repeats
requires keymap and keycode as input:

int xkb_keymap_key_repeats( struct xkb_keymap * keymap,
			    xkb_keycode_t key)

However, in inputChar in wl_input.c we are passing in xkb_keysym_t,
which was a type mismatch.

This results in some keys not repeating when they should and vice versa.

[1] https://xkbcommon.org/doc/current/group__components.html#ga9d7f998efeca98b3afc7c257bbac90a8

Closes #1908.
2021-08-31 20:48:12 +02:00