Commit Graph

525 Commits

Author SHA1 Message Date
Camilla Löwy
a360198f8f Wayland: Implement glfwFocusWindow
This implements window focus requests via the xdg-activation-v1
protocol.  These requests will likely only work when another window of
the same application already has input focus, but that isn't unlike the
behavior of other platforms.

The GLFW_FEATURE_UNAVAILABLE error has been removed from this function
for now.

Related to #2284
Related to #2306
Related to #2439
2024-02-09 13:52:54 +01:00
Camilla Löwy
23962c9dc7 Remove further traces of IRC channel 2024-01-30 20:20:42 +01:00
Camilla Löwy
ad264f5061 Update URL for xdg-activation-v1 protocol docs 2024-01-30 20:20:42 +01:00
Jan Schürkamp
9317970243 Wayland: Implement glfwRequestWindowAttention
This implements window attention requests via the xdg-activation-v1
protocol.

This was updated by @ elmindreda to work with recent Wayland related
 changes to the main branch:
 - Switched to current way of handling Wayland protocol files
 - Added the xdg-activation-v1.xml protocol file to deps/wayland
 - Added missing macros to rename protocol interface globals

The protocol file was copied from wayland-protocols 1.33.

Closes #2287
2024-01-30 20:20:42 +01:00
Camilla Löwy
2590d4cdd4 Wayland: Enable platform by default
This changes the default platform for Unix-like systems (other than
macOS) from only X11 to Wayland and X11.  It also removes the backward
compatibility with the older GLFW_USE_WAYLAND CMake option.

If a bisect took you here because your build broke, hello, sorry, set
the GLFW_BUILD_WAYLAND or GLFW_BUILD_X11 CMake option to disable the
associated platform.

This can be done when configuring GLFW with CMake, from a higher-level
CMakeLists.txt if GLFW is part of your project, or at any point after
configuration by updating the CMake cache with the command-line tool or
the GUI.

The next step is to make Wayland the run-time default when enabled, but
that will hopefully not break any builds.

Related to #2439
2024-01-30 20:20:42 +01:00
Camilla Löwy
51920ede68 Wayland: Fix compilation on FreeBSD
The list of compile-time dependencies on FreeBSD lacked evdev-proto.

Unlike on Linux, the input-event-codes.h header file was not implicitly
included on FreeBSD.

Fixes #2445
2024-01-30 20:20:42 +01:00
Camilla Löwy
ba796ec9c6 Document VS 2013 as minimum VS version
This is part of removing support for VS versions older than VS 2013.
See #2465 for details and feedback.

Related to #2465
2024-01-15 20:17:18 +01:00
Camilla Löwy
2c3eb75748 Wayland: Remove dependency on wayland-protocols
This brings the latest released versions of all used Wayland protocol
files into this repository, removing the need for the user to arrange
a sufficiently new version of wayland-protocols.

The wayland.xml protocol file was copied from wayland 1.22.0.
The additional protocol files were copied from wayland-protocols 1.32.

Because of how files are moved and renamed inside the wayland-protocols
repository, it will not always be possible to update all our protocol
files from a single release without also potentially updating related
code (acceptable) and prematurely breaking compatibility with
compositors that still only support an earlier incompatible version
(unacceptable).

The macro in src/CMakeLists.txt has been modified to hopefully make it
easier to add new protocol files.  This made it necessary to change the
name of a few of the generated header files.

Closes #2053
2024-01-13 22:13:56 +01:00
Doug Binks
b4c3ef9d0f
Clarify documentation for contributing
Added location of credits, news and guides.
2023-12-24 12:23:23 +00:00
Camilla Löwy
9959dc69ca Improve documentation relating to key tokens
Shifted the documentation away from the term 'named keys' as something
different than keys that glfwGetKeyName will return a name for.  The
already existing term 'key token' should now be used to refer to the
GLFW_KEY_* constants.

The associated term 'named mouse button' was also replaced with
'supported mouse button'.

The parts explaining which key tokens will return a valid scancode from
glfwGetKeyScancode have hopefully been clarified.  This issue was
reported in #2055.

The GLFW_KEY_UNKNOWN constant has been moved out of the list of key
tokens to simplify and hopefully clarify the related documentation.

Various other keyboard key related edits were made, hopefully resulting
in improvements.

Related to #2055
2023-12-05 19:10:06 +01:00
Camilla Löwy
1b2605dbcd Fix missing new constant in release notes 2023-12-05 18:36:54 +01:00
Camilla Löwy
0bd3e879e1 Fix unneccessary use of "must"
Passing a context-less window to a function that requires a context only
emits a harmless GLFW_NO_WINDOW_CONTEXT error.
2023-11-16 20:49:23 +01:00
Camilla Löwy
938a3c29b2 Update Doxyfile template for Doxygen 1.9.7 2023-11-16 20:49:23 +01:00
Camilla Löwy
fbdb53b9ca Wayland: Add initial support for libdecor
This is partly based on the implementation of libdecor support in
PR #1693 by @ christianrauch.

Where available, the libdecor library is loaded at init and becomes the
preferred method for window decorations.  On compositors that support
XDG decorations, libdecor in turn uses those.  If not, libdecor has
a plug-in archtecture and may load additional libraries to either use
compositor-specific decorations or draw its own.

If necessary, support for libdecor can be disabled with the
GLFW_WAYLAND_LIBDECOR init hint.  This is mostly in case some part of
the dynamic loading or duplication of header material added here turns
out to cause problems with future versions of libdecor-0.so.0.

Fixes #1639
Closes #1693
Related to #1725
2023-03-27 22:03:36 +02:00
Camilla Löwy
dd8a678a66 Update Doxyfile template for Doxygen 1.9.5
This is mostly to disable Doxygen HTML output dark mode (for now).
2022-09-20 19:38:37 +02:00
Camilla Löwy
d299d9f788 Remove Doxyfile tags deprecated by Doxygen 1.9.5 2022-09-15 22:25:10 +02:00
Camilla Löwy
ed1d9e1ca7 Document X11 WM_CLASS hint behavior
Fixes #2180
2022-09-15 22:25:10 +02:00
Camilla Löwy
ef6c9d8b4f Wayland: Fix window opacity on older systems
On systems lacking the EGL_EXT_present_opaque extension, some
compositors treat any buffer with an alpha channel as per-pixel
transparent.

This commit ignores any EGLConfig with an alpha channel if the extension
is missing and the window is created with GLFW_TRANSPARENT_FRAMEBUFFER
set to false.

This is technically not a breaking change since GLFW_ALPHA_BITS is not
a hard constraint, but it is still going to inconvenience anyone using
the framebuffer alpa channel to store other kinds of data.

Related to #1895
2022-08-01 19:19:51 +02:00
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
TheChocolateOre
2e12ef00bb
Fix typos and other issues in docs
This fixes spelling, grammar and punctuation issues, missing words and
stray words across the documentation.  A confusing sentence was removed
from the tutorial.

Closes #2085
2022-07-28 15:56:18 +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
JoelNiemela
060631c965 Fix typos in docs
Closes #2150
2022-07-11 20:52:43 +02:00
Camilla Löwy
78b19548d9 Documentation work
Related to #2113
Related to #2120
2022-07-07 23:48:43 +02:00
Camilla Löwy
d3c2121221 Move CODEOWNERS to .github directory
This slightly de-clutters a directory mostly intended for human-readable
documentation.
2022-04-28 21:19:10 +02:00
Camilla Löwy
46950a5e61 Fix button field names in input guide
Fixes #2056
2022-03-13 15:27:25 +01:00
Camilla Löwy
1eef3a363e Fix dependency list for X11 on Cygwin 2022-03-10 19:15:13 +01:00
Camilla Löwy
cd22e28495 X11: Fix empty event race condition with a pipe
There is a seemingly unavoidable race condition when waiting for data on
the X11 display connection, as long as any other thread is also making
Xlib calls.  The event data we are waiting for could be read by the
other thread as part of looking for the reply to its request, before our
poll has begun.

This commit replaces the X11 event sent by glfwPostEmptyEvent with
writing to an unnamed pipe.  The race condition remains if other Xlib
calls are made on other threads, but glfwPostEmptyEvent should now be
race-free.

This commit is based on work by pcwalton, OlivierSohn, kovidgoyal and
joaodasilva.

Closes #2033
Related to #379
Related to #1281
Related to #1285
2022-03-03 22:16:59 +01:00
Camilla Löwy
e023618daa Remove Doxyfile tag deprecated by Doxygen 1.9.3 2022-02-02 21:49:06 +01:00
Camilla Löwy
293d19a153 Wayland: Require xkbcommon 0.5.0 or greater
The Wayland backend now requires xkbcommon-compose, which was added in
version 0.5.0.  xkbcommon 0.5.0 was released in 2014.

This removes the non-composing fallback path for text input.
2021-12-31 13:27:22 +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
Camilla Löwy
393eac458b Improve Vulkan guide header section 2021-10-27 18:22:05 +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
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
0a9488e3f0 Remove configuration header 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
63da04e5ce Add HTML header and footer to docs dependencies
This should have been included in
150744ecca.
2021-08-26 17:49:54 +02:00
Camilla Löwy
150744ecca Only rebuild documentation when necessary
This teaches CMake about the dependencies of the Doxygen generated
documentation so it isn't rebuilt every time.
2021-08-26 16:03:58 +02:00
Camilla Löwy
8c8def5de5 Start making use of CMake 3.4 string(APPEND) 2021-08-26 16:03:58 +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
d83849792b Add override variable for CMake library type
This adds the GLFW_LIBRARY_TYPE CMake cache variable, which allows users
and higher-level projects to set what type of library GLFW is built as.

When not empty, this value overrides the standard BUILD_SHARED_LIBS
option for GLFW while still allowing it to control the type of other
libraries in a larger project.

This also allows building GLFW as an object library without adding dummy
source files (as required by Xcode) or producing unused library
binaries.

Projects using CMake 3.12 or later can link the resulting GLFW object
library normally using target_link_libraries.

Fixes #279.
Related to #1307.
Closes #1497.
Closes #1574.
Closes #1928.
2021-08-15 22:44:43 +02:00
Camilla Löwy
01778329ec Add custom target for updating gamepad mappings 2021-08-01 20:16:17 +02:00
Camilla Löwy
3dc7349c35 Expand list of distro derivatives slightly 2021-07-29 21:50:24 +02:00
Camilla Löwy
9e1ee3f263 Add Fedora package names to compilation guide 2021-07-29 21:50:24 +02:00
Camilla Löwy
3b95970482 Improve library compilation guide somewhat
Related to #1931.
2021-07-16 19:36:10 +02:00
David V. McKay
1a5e07fd4b
realizing "as you would" is platform dependent
specified "for linux or unix" and added a bit about using Visual Studio on Windows.
2021-07-07 23:44:22 -04:00
David V. McKay
f010d8b77d
Clarify "as you would" for beginners.
fixes #1088
2021-07-07 23:25:35 -04:00
A. Tombs
52d8347d34 Consistent subsections in compile guide
In the compile guide, the "Dependencies for Linux and OSMesa" section
looks to be one level too high in the hierarchy. I've moved it to be in
line with the similarly-named sub-sub-sections.

Closes #1923.
2021-06-23 21:30:07 +02:00