From 0d2d85d19c16ae936fb6b076a1a9ccdd732e65c0 Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Fri, 15 Aug 2025 11:27:59 +0200 Subject: [PATCH 01/16] Revert "Wayland: Keyboard leave event handler now processes key repeats" --- src/wl_window.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index b33a2262f..2b172c9c2 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1778,24 +1778,6 @@ static void keyboardHandleLeave(void* userData, if (!window) return; - // Handle any key repeats up to this point. We don't poll as this should be infrequent. - uint64_t repeats; - if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8) - { - if(_glfw.wl.keyboardFocus) - { - for (uint64_t i = 0; i < repeats; i++) - { - _glfwInputKey(_glfw.wl.keyboardFocus, - translateKey(_glfw.wl.keyRepeatScancode), - _glfw.wl.keyRepeatScancode, - GLFW_PRESS, - _glfw.wl.xkb.modifiers); - inputText(_glfw.wl.keyboardFocus, _glfw.wl.keyRepeatScancode); - } - } - } - struct itimerspec timer = {0}; timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL); From bfa1c424e56093bc4a08184ec68543e45b468374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 14 Aug 2025 21:19:13 +0200 Subject: [PATCH 02/16] Wayland: Fix fallback decoration menu placement The fallback decorations would place the menu at the wrong position, by not translating the last decoration surface position into toplevel surface coordinates. This also limits the menu to the caption area of the top decoration surface, similar to how other toolkits work. --- README.md | 1 + src/wl_window.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index cebdf0896..6efa1ae70 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ information on what to include when reporting a bug. fallback decorations - [Wayland] Bugfix: Fallback decorations would report scroll events - [Wayland] Bugfix: Keyboard repeat events halted when any key is released (#2568) + - [Wayland] Bugfix: Fallback decorations would show menu at wrong position - [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631) - [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface` - [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless` diff --git a/src/wl_window.c b/src/wl_window.c index 2b172c9c2..b9aa405d1 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -405,13 +405,19 @@ static void handleFallbackDecorationButton(_GLFWwindow* window, } else if (button == BTN_RIGHT) { - if (window->wl.xdg.toplevel) - { - xdg_toplevel_show_window_menu(window->wl.xdg.toplevel, - _glfw.wl.seat, serial, - window->wl.cursorPosX, - window->wl.cursorPosY); - } + if (!window->wl.xdg.toplevel) + return; + + if (window->wl.fallback.focus != window->wl.fallback.top.surface) + return; + + if (ypos < GLFW_BORDER_SIZE) + return; + + xdg_toplevel_show_window_menu(window->wl.xdg.toplevel, + _glfw.wl.seat, serial, + xpos, + ypos - GLFW_CAPTION_HEIGHT - GLFW_BORDER_SIZE); } } From 3cf9f6726d1062c219d861755768ec5a2a238ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 18 Aug 2025 16:17:55 +0200 Subject: [PATCH 03/16] Wayland: Fix fallback decoration cursor updating When a click through to the fallback decorations caused the end of a modal like the window menu, the cursor shape would not be updated until the next time the cursor moved. This commit adds an update of the cursor for the pointer enter event for fallback decoration surfaces, in addition to the updates at pointer motion events. --- README.md | 2 ++ src/wl_window.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 6efa1ae70..f7c3b07d3 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,8 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Fallback decorations would report scroll events - [Wayland] Bugfix: Keyboard repeat events halted when any key is released (#2568) - [Wayland] Bugfix: Fallback decorations would show menu at wrong position + - [Wayland] Bugfix: The cursor was not updated when clicking through from + a modal to a fallback decoration - [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631) - [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface` - [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless` diff --git a/src/wl_window.c b/src/wl_window.c index b9aa405d1..ed767055d 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1542,7 +1542,10 @@ static void pointerHandleEnter(void* userData, else { if (window->wl.fallback.decorations) + { window->wl.fallback.focus = surface; + updateFallbackDecorationCursor(window, sx, sy); + } } } From 7ef6efeb662e0833645e4b03b910e054fc7d8a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 14 Aug 2025 21:38:37 +0200 Subject: [PATCH 04/16] Wayland: Fix cursor position after a modal If a modal surface like the window menu was active, clicking on the GLFW window content area to close it would correctly emit the cursor enter event but would not propagate the cursor position from the event. --- README.md | 2 ++ src/wl_window.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index f7c3b07d3..c0a473d41 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,8 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Fallback decorations would show menu at wrong position - [Wayland] Bugfix: The cursor was not updated when clicking through from a modal to a fallback decoration + - [Wayland] Bugfix: The cursor position was not updated when clicking through + from a modal to the content area - [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631) - [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface` - [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless` diff --git a/src/wl_window.c b/src/wl_window.c index ed767055d..4220d17e0 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1538,6 +1538,13 @@ static void pointerHandleEnter(void* userData, window->wl.hovered = GLFW_TRUE; _glfwSetCursorWayland(window, window->wl.currentCursor); _glfwInputCursorEnter(window, GLFW_TRUE); + + if (window->cursorMode != GLFW_CURSOR_DISABLED) + { + window->wl.cursorPosX = wl_fixed_to_double(sx); + window->wl.cursorPosY = wl_fixed_to_double(sy); + _glfwInputCursorPos(window, window->wl.cursorPosX, window->wl.cursorPosY); + } } else { From acb92944d4e97e6efa36057927c9fcf114710226 Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Tue, 19 Aug 2025 11:30:52 +0200 Subject: [PATCH 05/16] Revert readme for "Wayland: Keyboard leave event handler now processes key repeats" --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c0a473d41..6eb6b9bd1 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,6 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727) - [Wayland] Bugfix: Reset key repeat timer when window destroyed (#2741,#2727) - [Wayland] Bugfix: Memory would leak if reading a data offer failed midway - - [Wayland] Bugfix: Keyboard leave event handler now processes key repeats (#2736) - [Wayland] Bugfix: Retrieved cursor position would be incorrect when hovering over fallback decorations - [Wayland] Bugfix: Fallback decorations would report scroll events From 63a7e8b7f82497b0459acba5c1ce7f39aa2bc0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 18 Aug 2025 21:06:50 +0200 Subject: [PATCH 06/16] Add and update Wayland-specific notes in docs Fixes #2746 --- CONTRIBUTORS.md | 1 + docs/monitor.md | 4 ++++ docs/window.md | 12 ++++++++++++ include/GLFW/glfw3.h | 45 ++++++++++++++++++++++++-------------------- 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 295a4c477..d8eb7aee0 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -55,6 +55,7 @@ video tutorials. - Jason Daly - danhambleton - Jarrod Davis + - decce - Olivier Delannoy - Paul R. Deppe - Michael Dickens diff --git a/docs/monitor.md b/docs/monitor.md index 12d98541a..df5fda9ae 100644 --- a/docs/monitor.md +++ b/docs/monitor.md @@ -255,3 +255,7 @@ hardware gamma correction, which today is typically an approximation of sRGB gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior. +@note @wayland An application cannot read or modify the monitor gamma ramp. The +@ref glfwGetGammaRamp, @ref glfwSetGammaRamp and @ref glfwSetGamma functions +emit @ref GLFW_FEATURE_UNAVAILABLE. + diff --git a/docs/window.md b/docs/window.md index 371baa562..dd6d8a2aa 100644 --- a/docs/window.md +++ b/docs/window.md @@ -893,6 +893,12 @@ int xpos, ypos; glfwGetWindowPos(window, &xpos, &ypos); ``` +@note @wayland An applications cannot know the positions of its windows or +whether one has been moved. The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y +window hints are ignored. The @ref glfwGetWindowPos and @ref glfwSetWindowPos +functions emit @ref GLFW_FEATURE_UNAVAILABLE. The window position callback will +not be called. + ### Window title {#window_title} @@ -1038,6 +1044,12 @@ You can also get the current iconification state with @ref glfwGetWindowAttrib. int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED); ``` +@note @wayland An application cannot know if any of its windows have been +iconified or restore one from iconification. The @ref glfwRestoreWindow +function can only restore windows from maximization and the iconify callback +will not be called. The [GLFW_ICONIFIED](@ref GLFW_ICONIFIED_attrib) attribute +will be false. The @ref glfwIconifyWindow function works normally. + ### Window maximization {#window_maximize} diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 79b062884..b0ce7f660 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -2915,8 +2915,8 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE, * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland Gamma handling is a privileged protocol, this function - * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. + * @remark @wayland Monitor gamma is a privileged protocol, so this function + * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * * @thread_safety This function must only be called from the main thread. * @@ -2939,8 +2939,8 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland Gamma handling is a privileged protocol, this function - * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while + * @remark @wayland Monitor gamma is a privileged protocol, so this function + * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while * returning `NULL`. * * @pointer_lifetime The returned structure and its arrays are allocated and @@ -2983,8 +2983,8 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); * * @remark @win32 The gamma ramp size must be 256. * - * @remark @wayland Gamma handling is a privileged protocol, this function - * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. + * @remark @wayland Monitor gamma is a privileged protocol, so this function + * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * * @pointer_lifetime The specified gamma ramp is copied before this function * returns. @@ -3430,8 +3430,8 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* i * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland There is no way for an application to retrieve the global - * position of its windows. This function will emit @ref + * @remark @wayland Window positions are not currently part of any common + * Wayland protocol, so this function cannot be implemented and will emit @ref * GLFW_FEATURE_UNAVAILABLE. * * @thread_safety This function must only be called from the main thread. @@ -3464,8 +3464,8 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland There is no way for an application to set the global - * position of its windows. This function will emit @ref + * @remark @wayland Window positions are not currently part of any common + * Wayland protocol, so this function cannot be implemented and will emit @ref * GLFW_FEATURE_UNAVAILABLE. * * @thread_safety This function must only be called from the main thread. @@ -3807,10 +3807,6 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t - * be able to restore it. This is a design decision of the xdg-shell - * protocol. - * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_iconify @@ -3838,6 +3834,10 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * + * @remark @wayland Restoring a window from maximization is not currently part + * of any common Wayland protocol, so this function can only restore windows + * from maximization. + * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_iconify @@ -4058,8 +4058,8 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); * affected by any resizing or mode switching, although you may need to update * your viewport if the framebuffer size has changed. * - * @remark @wayland The desired window position is ignored, as there is no way - * for an application to set this property. + * @remark @wayland Window positions are not currently part of any common + * Wayland protocol. The window position arguments are ignored. * * @thread_safety This function must only be called from the main thread. * @@ -4096,8 +4096,9 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int * errors. However, this function should not fail as long as it is passed * valid arguments and the library has been [initialized](@ref intro_init). * - * @remark @wayland The Wayland protocol provides no way to check whether a - * window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`. + * @remark @wayland Checking whether a window is iconified is not currently + * part of any common Wayland protocol, so the @ref GLFW_ICONIFIED attribute + * cannot be implemented and is always `GLFW_FALSE`. * * @thread_safety This function must only be called from the main thread. * @@ -4219,8 +4220,8 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * - * @remark @wayland This callback will never be called, as there is no way for - * an application to know its global position. + * @remark @wayland This callback will not be called. The Wayland protocol + * provides no way to be notified of when a window is moved. * * @thread_safety This function must only be called from the main thread. * @@ -4395,6 +4396,10 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * + * @remark @wayland This callback will not be called. The Wayland protocol + * provides no way to be notified of when a window is iconified, and no way to + * check whether a window is currently iconified. + * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_iconify From 5c87937e444bef5b796f6f877bd9bcf549e3ef9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 21 Aug 2025 19:07:33 +0200 Subject: [PATCH 07/16] Update README --- README.md | 129 +++++++++++++++++++++++++++--------------------------- 1 file changed, 64 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 6eb6b9bd1..5148467a7 100644 --- a/README.md +++ b/README.md @@ -9,34 +9,28 @@ GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc. -GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On -Linux both Wayland and X11 are supported. +GLFW is written primarily in C99, with parts of macOS support being written in +Objective-C. + +GLFW supports Windows, macOS and Linux, and also works on many other Unix-like +systems. On Linux both Wayland and X11 are supported. GLFW is licensed under the [zlib/libpng license](https://www.glfw.org/license.html). You can [download](https://www.glfw.org/download.html) the latest stable release -as source or Windows binaries. Each release starting with 3.0 also has -a corresponding [annotated tag](https://github.com/glfw/glfw/releases) with -source and binary archives. +as source or Windows and macOS binaries. There are [release +tags](https://github.com/glfw/glfw/releases) with source and binary archives +attached for every version since 3.0. The [documentation](https://www.glfw.org/docs/latest/) is available online and is -included in all source and binary archives. See the [release -notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and -deprecations in the latest release. For more details see the [version -history](https://www.glfw.org/changelog.html). - -The `master` branch is the stable integration branch and _should_ always compile -and run on all supported platforms, although details of newly added features may -change until they have been included in a release. New features and many bug -fixes live in [other branches](https://github.com/glfw/glfw/branches/all) until -they are stable enough to merge. - -If you are new to GLFW, you may find the -[tutorial](https://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If -you have used GLFW 2 in the past, there is a [transition -guide](https://www.glfw.org/docs/latest/moving.html) for moving to the GLFW -3 API. +also included in source and binary archives, except those generated +automatically by Github. The documentation contains guides, a tutorial and the +API reference. The [release +notes](https://www.glfw.org/docs/latest/news.html) list the new features, +caveats and deprecations in the latest release. The [version +history](https://www.glfw.org/changelog.html) lists every user-visible change +for every release. GLFW exists because of the contributions of [many people](CONTRIBUTORS.md) around the world, whether by reporting bugs, providing community support, adding @@ -44,57 +38,37 @@ features, reviewing or testing code, debugging, proofreading docs, suggesting features or fixing bugs. -## Compiling GLFW - -GLFW is written primarily in C99, with parts of macOS support being written in -Objective-C. GLFW itself requires only the headers and libraries for your OS -and window system. It does not need any additional headers for context creation -APIs (WGL, GLX, EGL, NSGL, OSMesa) or rendering APIs (OpenGL, OpenGL ES, Vulkan) -to enable support for them. - -GLFW supports compilation on Windows with Visual C++ (2013 and later) and -MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC -and Clang. It will likely compile in other environments as well, but this is -not regularly tested. - -There are [pre-compiled binaries](https://www.glfw.org/download.html) available -for all supported compilers on Windows and macOS. - -See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for -more information about how to compile GLFW yourself. - - -## Using GLFW - -See the [documentation](https://www.glfw.org/docs/latest/) for tutorials, guides -and the API reference. - - -## Contributing to GLFW - -See the [contribution -guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for -more information. - - ## System requirements -GLFW supports Windows 7 and later and macOS 10.11 and later. Linux and other -Unix-like systems running the X Window System are supported even without -a desktop environment or modern extensions, although some features require -a running window or clipboard manager. The OSMesa backend requires Mesa 6.3. +GLFW supports Windows 7 and later and macOS 10.11 and later. On GNOME Wayland, +window decorations will be very basic unless the +[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor) package is +installed. Linux and other Unix-like systems running X11 are supported even +without a desktop environment or modern extensions, although some features +require a clipboard manager or a modern window manager. See the [compatibility guide](https://www.glfw.org/docs/latest/compat.html) -in the documentation for more information. +for more detailed information. -## Dependencies +## Compiling GLFW -GLFW itself needs only CMake 3.16 or later and the headers and libraries for your -OS and window system. +GLFW supports compilation with Visual C++ (2013 and later), GCC and Clang. Both +Clang-CL and MinGW-w64 are supported. Other C99 compilers will likely also +work, but this is not regularly tested. + +There are [pre-compiled binaries](https://www.glfw.org/download.html) +available for Windows and macOS. + +GLFW itself needs only CMake and the headers and libraries for your operating +system and window system. No other SDKs are required. + +See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for +more information about compiling GLFW and the exact dependencies required for +each window system. The examples and test programs depend on a number of tiny libraries. These are -located in the `deps/` directory. +bundled in the `deps/` directory. The repository has no submodules. - [getopt\_port](https://github.com/kimgr/getopt_port/) for examples with command-line options @@ -107,8 +81,33 @@ located in the `deps/` directory. - [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI - [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk -The documentation is generated with [Doxygen](https://doxygen.org/) if CMake can -find that tool. +The documentation is generated with [Doxygen](https://doxygen.org/) when the +library is built, provided CMake could find a sufficiently new version of it +during configuration. + + +## Using GLFW + +See the [HTML documentation](https://www.glfw.org/docs/latest/) for a tutorial, +guides and the API reference. + + +## Contributing to GLFW + +See the [contribution +guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for +more information. + +The `master` branch is the stable integration branch and _should_ always compile +and run on all supported platforms. Details of a newly added feature, +including the public API, may change until it has been included in a release. + +The `latest` branch is equivalent to the [highest numbered](https://semver.org/) +release, although it may not always point to the same commit as the tag for that +release. + +The `ci` branch is used to trigger continuous integration jobs for code under +testing and should never be relied on for any purpose. ## Reporting bugs From 04a67c826718c7099c532bd90aa9d2ac97958d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 28 Aug 2025 18:56:48 +0200 Subject: [PATCH 08/16] Fix X11 clipboard compatibility description --- docs/compat.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/compat.md b/docs/compat.md index 5072d5c11..a97192b3f 100644 --- a/docs/compat.md +++ b/docs/compat.md @@ -50,10 +50,11 @@ compositing window manager to un-redirect full screen GLFW windows. If the running window manager uses compositing but does not support this property then additional copying may be performed for each buffer swap of full screen windows. -GLFW uses the [clipboard manager protocol][ClipboardManager] to push a clipboard -string (i.e. selection) owned by a GLFW window about to be destroyed to the -clipboard manager. If there is no running clipboard manager, the clipboard -string will be unavailable once the window has been destroyed. +GLFW uses the [clipboard manager protocol][ClipboardManager] to keep the +clipboard string availble for the user after the libary has been terminated. If +there is no running clipboard manager and the clipboard contents has been set +with @ref glfwSetClipboardString, the clipboard will be emptied when the library +is terminated. [clipboardManager]: https://www.freedesktop.org/wiki/ClipboardManager/ From c9b129753aa3a002de90c8458e4c8121a2fe6d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 21 Aug 2025 21:36:19 +0200 Subject: [PATCH 09/16] Update Doxygen version handling --- docs/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 50522173a..4cf863653 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,4 +1,8 @@ +# Because of bugs and limitations in its Markdown support, only fairly recent +# versions of Doxygen can produce acceptable output +set(MINIMUM_DOXYGEN_VERSION 1.9.8) + # NOTE: The order of this list determines the order of items in the Guides # (i.e. Pages) list in the generated documentation set(source_files @@ -32,10 +36,10 @@ foreach(file IN LISTS source_files) endforeach() set(DOXYGEN_SKIP_DOT TRUE) -find_package(Doxygen) +find_package(Doxygen ${MINIMUM_DOXYGEN_VERSION} QUIET) -if (NOT DOXYGEN_FOUND OR DOXYGEN_VERSION VERSION_LESS "1.9.8") - message(STATUS "Documentation generation requires Doxygen 1.9.8 or later") +if (NOT DOXYGEN_FOUND) + message(STATUS "Documentation generation requires Doxygen ${MINIMUM_DOXYGEN_VERSION} or later") else() configure_file(Doxyfile.in Doxyfile @ONLY) add_custom_command(OUTPUT "html/index.html" From 1fdd39cf3e5badfd61d051d686b21c1963bbb045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 21 Aug 2025 21:36:59 +0200 Subject: [PATCH 10/16] Fix documentation target dependency Related to #2704 --- CONTRIBUTORS.md | 1 + docs/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d8eb7aee0..22ef76d0a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -23,6 +23,7 @@ video tutorials. - Denis Bernard - BiBi - Doug Binks + - bitb4ker - blanco - Waris Boonyasiriwat - Kyle Brenneman diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 4cf863653..629c16441 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -50,7 +50,7 @@ else() COMMENT "Generating HTML documentation" VERBATIM) - add_custom_target(docs ALL SOURCES "html/index.html") + add_custom_target(docs ALL DEPENDS "html/index.html") set_target_properties(docs PROPERTIES FOLDER "GLFW3") if (GLFW_INSTALL) From f8582d26d0c88c67ddee5606dcf688107e875d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 21 Aug 2025 23:51:45 +0200 Subject: [PATCH 11/16] Add Markdown files as sources to IDE docs target --- docs/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 629c16441..ffa7768ea 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -50,7 +50,7 @@ else() COMMENT "Generating HTML documentation" VERBATIM) - add_custom_target(docs ALL DEPENDS "html/index.html") + add_custom_target(docs ALL SOURCES ${source_files} DEPENDS "html/index.html") set_target_properties(docs PROPERTIES FOLDER "GLFW3") if (GLFW_INSTALL) From bfcb98fb6cfcee008207f9252bd5c76a98e76e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 12 Mar 2024 19:59:04 +0100 Subject: [PATCH 12/16] Replace some Doxygen aliases with Markdown --- docs/Doxyfile.in | 8 +-- docs/intro.md | 2 +- docs/monitor.md | 4 +- docs/vulkan.md | 6 +- docs/window.md | 10 +-- include/GLFW/glfw3.h | 162 +++++++++++++++++++++---------------------- 6 files changed, 93 insertions(+), 99 deletions(-) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 067619c7d..27c4b3f67 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -278,13 +278,7 @@ ALIASES = "thread_safety=@par Thread safety^^" \ "analysis=@par Analysis^^" \ "reentrancy=@par Reentrancy^^" \ "errors=@par Errors^^" \ - "callback_signature=@par Callback signature^^" \ - "glfw3=__GLFW 3:__" \ - "x11=__X11:__" \ - "wayland=__Wayland:__" \ - "win32=__Windows:__" \ - "macos=__macOS:__" \ - "linux=__Linux:__" + "callback_signature=@par Callback signature^^" # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For diff --git a/docs/intro.md b/docs/intro.md index f2060c330..e09989e03 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -63,7 +63,7 @@ before the application exits. Modern systems are very good at freeing resources allocated by programs that exit, but GLFW sometimes has to change global system settings and these might not be restored without termination. -@macos When the library is initialized the main menu and dock icon are created. +__macOS:__ When the library is initialized the main menu and dock icon are created. These are not desirable for a command-line only program. The creation of the main menu and dock icon can be disabled with the @ref GLFW_COCOA_MENUBAR init hint. diff --git a/docs/monitor.md b/docs/monitor.md index df5fda9ae..8e01a8f25 100644 --- a/docs/monitor.md +++ b/docs/monitor.md @@ -255,7 +255,7 @@ hardware gamma correction, which today is typically an approximation of sRGB gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior. -@note @wayland An application cannot read or modify the monitor gamma ramp. The -@ref glfwGetGammaRamp, @ref glfwSetGammaRamp and @ref glfwSetGamma functions +@note __Wayland:__ An application cannot read or modify the monitor gamma ramp. +The @ref glfwGetGammaRamp, @ref glfwSetGammaRamp and @ref glfwSetGamma functions emit @ref GLFW_FEATURE_UNAVAILABLE. diff --git a/docs/vulkan.md b/docs/vulkan.md index cb67302fb..48fa79fd1 100644 --- a/docs/vulkan.md +++ b/docs/vulkan.md @@ -35,7 +35,7 @@ By default, GLFW will load the Vulkan loader dynamically at runtime via its stan `vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux and other Unix-like systems and `libvulkan.1.dylib` on macOS. -@macos GLFW will also look up and search the `Frameworks` subdirectory of your +__macOS:__ GLFW will also look up and search the `Frameworks` subdirectory of your application bundle. If your code is using a Vulkan loader with a different name or in a non-standard location @@ -47,7 +47,7 @@ entry point retrieval. This prevents GLFW from dynamically loading the Vulkan l glfwInitVulkanLoader(vkGetInstanceProcAddr); ``` -@macos To make your application be redistributable you will need to set up the application +__macOS:__ To make your application be redistributable you will need to set up the application bundle according to the LunarG SDK documentation. This is explained in more detail in the [SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html). @@ -186,7 +186,7 @@ check whether any extensions you wish to enable are already in the returned array, as it is an error to specify an extension more than once in the `VkInstanceCreateInfo` struct. -@macos MoltenVK is (as of July 2022) not yet a fully conformant implementation +__macOS:__ MoltenVK is (as of July 2022) not yet a fully conformant implementation of Vulkan. As of Vulkan SDK 1.3.216.0, this means you must also enable the `VK_KHR_portability_enumeration` instance extension and set the `VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR` bit in the instance creation diff --git a/docs/window.md b/docs/window.md index dd6d8a2aa..2140f0975 100644 --- a/docs/window.md +++ b/docs/window.md @@ -363,10 +363,10 @@ which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via @ref glfwGetProcAddress. -@note @wayland The EGL API _is_ the native context creation API, so this hint +@note __Wayland:__ The EGL API _is_ the native context creation API, so this hint will have no effect. -@note @x11 On some Linux systems, creating contexts via both the native and EGL +@note __X11:__ On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now. @@ -400,7 +400,7 @@ requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x. -@note @macos The OS only supports core profile contexts for OpenGL versions 3.2 +@note __macOS:__ The OS only supports core profile contexts for OpenGL versions 3.2 and later. Before creating an OpenGL context of version 3.2 or later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hint accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS. @@ -893,7 +893,7 @@ int xpos, ypos; glfwGetWindowPos(window, &xpos, &ypos); ``` -@note @wayland An applications cannot know the positions of its windows or +@note __Wayland:__ An applications cannot know the positions of its windows or whether one has been moved. The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints are ignored. The @ref glfwGetWindowPos and @ref glfwSetWindowPos functions emit @ref GLFW_FEATURE_UNAVAILABLE. The window position callback will @@ -1044,7 +1044,7 @@ You can also get the current iconification state with @ref glfwGetWindowAttrib. int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED); ``` -@note @wayland An application cannot know if any of its windows have been +@note __Wayland:__ An application cannot know if any of its windows have been iconified or restore one from iconification. The @ref glfwRestoreWindow function can only restore windows from maximization and the iconify callback will not be called. The [GLFW_ICONIFIED](@ref GLFW_ICONIFIED_attrib) attribute diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index b0ce7f660..3ce1c0191 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -1228,13 +1228,13 @@ extern "C" { * The top-left to bottom-right diagonal resize/move shape. This is usually * a diagonal double-headed arrow. * - * @note @macos This shape is provided by a private system API and may fail + * @note __macOS:__ This shape is provided by a private system API and may fail * with @ref GLFW_CURSOR_UNAVAILABLE in the future. * - * @note @wayland This shape is provided by a newer standard not supported by + * @note __Wayland:__ This shape is provided by a newer standard not supported by * all cursor themes. * - * @note @x11 This shape is provided by a newer standard not supported by all + * @note __X11:__ This shape is provided by a newer standard not supported by all * cursor themes. */ #define GLFW_RESIZE_NWSE_CURSOR 0x00036007 @@ -1243,13 +1243,13 @@ extern "C" { * The top-right to bottom-left diagonal resize/move shape. This is usually * a diagonal double-headed arrow. * - * @note @macos This shape is provided by a private system API and may fail + * @note __macOS:__ This shape is provided by a private system API and may fail * with @ref GLFW_CURSOR_UNAVAILABLE in the future. * - * @note @wayland This shape is provided by a newer standard not supported by + * @note __Wayland:__ This shape is provided by a newer standard not supported by * all cursor themes. * - * @note @x11 This shape is provided by a newer standard not supported by all + * @note __X11:__ This shape is provided by a newer standard not supported by all * cursor themes. */ #define GLFW_RESIZE_NESW_CURSOR 0x00036008 @@ -1264,10 +1264,10 @@ extern "C" { * The operation-not-allowed shape. This is usually a circle with a diagonal * line through it. * - * @note @wayland This shape is provided by a newer standard not supported by + * @note __Wayland:__ This shape is provided by a newer standard not supported by * all cursor themes. * - * @note @x11 This shape is provided by a newer standard not supported by all + * @note __X11:__ This shape is provided by a newer standard not supported by all * cursor themes. */ #define GLFW_NOT_ALLOWED_CURSOR 0x0003600A @@ -1629,7 +1629,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos); * @sa @ref glfwSetWindowSizeCallback * * @since Added in version 1.0. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -1649,7 +1649,7 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height); * @sa @ref glfwSetWindowCloseCallback * * @since Added in version 2.5. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -1669,7 +1669,7 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow* window); * @sa @ref glfwSetWindowRefreshCallback * * @since Added in version 2.5. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -1800,7 +1800,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, flo * @sa @ref glfwSetMouseButtonCallback * * @since Added in version 1.0. - * @glfw3 Added window handle and modifier mask parameters. + * __GLFW 3:__ Added window handle and modifier mask parameters. * * @ingroup input */ @@ -1891,7 +1891,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffse * @sa @ref glfwSetKeyCallback * * @since Added in version 1.0. - * @glfw3 Added window handle, scancode and modifier mask parameters. + * __GLFW 3:__ Added window handle, scancode and modifier mask parameters. * * @ingroup input */ @@ -1912,7 +1912,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int actio * @sa @ref glfwSetCharCallback * * @since Added in version 2.4. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup input */ @@ -2020,7 +2020,7 @@ typedef void (* GLFWjoystickfun)(int jid, int event); * @sa @ref glfwGetVideoModes * * @since Added in version 1.0. - * @glfw3 Added refresh rate member. + * __GLFW 3:__ Added refresh rate member. * * @ingroup monitor */ @@ -2083,7 +2083,7 @@ typedef struct GLFWgammaramp * @sa @ref window_icon * * @since Added in version 2.1. - * @glfw3 Removed format and bytes-per-pixel members. + * __GLFW 3:__ Removed format and bytes-per-pixel members. * * @ingroup window */ @@ -2183,12 +2183,12 @@ typedef struct GLFWallocator * @errors Possible errors include @ref GLFW_PLATFORM_UNAVAILABLE and @ref * GLFW_PLATFORM_ERROR. * - * @remark @macos This function will change the current directory of the + * @remark __macOS:__ This function will change the current directory of the * application to the `Contents/Resources` subdirectory of the application's * bundle, if present. This can be disabled with the @ref * GLFW_COCOA_CHDIR_RESOURCES init hint. * - * @remark @macos This function will create the main menu and dock icon for the + * @remark __macOS:__ This function will create the main menu and dock icon for the * application. If GLFW finds a `MainMenu.nib` it is loaded and assumed to * contain a menu bar. Otherwise a minimal menu bar is created manually with * common commands like Hide, Quit and About. The About entry opens a minimal @@ -2203,7 +2203,7 @@ typedef struct GLFWallocator * to something other than `wayland` or `x11`, the regular detection mechanism * will be used instead. * - * @remark @x11 This function will set the `LC_CTYPE` category of the + * @remark __X11:__ This function will set the `LC_CTYPE` category of the * application locale according to the current environment if that category is * still "C". This is because the "C" locale breaks Unicode text input. * @@ -2679,7 +2679,7 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * - * @remark @win32 On Windows 8 and earlier the physical size is calculated from + * @remark __Win32:__ On Windows 8 and earlier the physical size is calculated from * the current resolution and system DPI instead of querying the monitor EDID data. * * @thread_safety This function must only be called from the main thread. @@ -2713,7 +2713,7 @@ GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @wayland Fractional scaling information is not yet available for + * @remark __Wayland:__ Fractional scaling information is not yet available for * monitors, so this function only returns integer content scales. * * @thread_safety This function must only be called from the main thread. @@ -2861,7 +2861,7 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback); * @sa @ref glfwGetVideoMode * * @since Added in version 1.0. - * @glfw3 Changed to return an array of modes for a specific monitor. + * __GLFW 3:__ Changed to return an array of modes for a specific monitor. * * @ingroup monitor */ @@ -2915,7 +2915,7 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE, * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland Monitor gamma is a privileged protocol, so this function + * @remark __Wayland:__ Monitor gamma is a privileged protocol, so this function * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * * @thread_safety This function must only be called from the main thread. @@ -2939,7 +2939,7 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland Monitor gamma is a privileged protocol, so this function + * @remark __Wayland:__ Monitor gamma is a privileged protocol, so this function * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while * returning `NULL`. * @@ -2981,9 +2981,9 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); * @remark The size of the specified gamma ramp should match the size of the * current ramp for that monitor. * - * @remark @win32 The gamma ramp size must be 256. + * @remark __Win32:__ The gamma ramp size must be 256. * - * @remark @wayland Monitor gamma is a privileged protocol, so this function + * @remark __Wayland:__ Monitor gamma is a privileged protocol, so this function * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * * @pointer_lifetime The specified gamma ramp is copied before this function @@ -3159,32 +3159,32 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value); * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. * - * @remark @win32 Window creation will fail if the Microsoft GDI software + * @remark __Win32:__ Window creation will fail if the Microsoft GDI software * OpenGL implementation is the only one available. * - * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it + * @remark __Win32:__ If the executable has an icon resource named `GLFW_ICON,` it * will be set as the initial icon for the window. If no such icon is present, * the `IDI_APPLICATION` icon will be used instead. To set a different icon, * see @ref glfwSetWindowIcon. * - * @remark @win32 The context to share resources with must not be current on + * @remark __Win32:__ The context to share resources with must not be current on * any other thread. * - * @remark @macos The OS only supports core profile contexts for OpenGL + * @remark __macOS:__ The OS only supports core profile contexts for OpenGL * versions 3.2 and later. Before creating an OpenGL context of version 3.2 or * later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) * hint accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all * on macOS. * - * @remark @macos The GLFW window has no icon, as it is not a document + * @remark __macOS:__ The GLFW window has no icon, as it is not a document * window, but the dock icon will be the same as the application bundle's icon. * For more information on bundles, see the * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library. * * [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/ * - * @remark @macos The window frame will not be rendered at full resolution on - * Retina displays unless the + * @remark __macOS:__ The window frame will not be rendered at full resolution + * on Retina displays unless the * [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the * application bundle's `Info.plist`. For more information, see @@ -3195,11 +3195,11 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value); * * [hidpi-guide]: https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html * - * @remark @macos When activating frame autosaving with + * @remark __macOS:__ When activating frame autosaving with * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified * window size and position may be overridden by previously saved values. * - * @remark @wayland GLFW uses [libdecor][] where available to create its window + * @remark __Wayland:__ GLFW uses [libdecor][] where available to create its window * decorations. This in turn uses server-side XDG decorations where available * and provides high quality client-side decorations on compositors like GNOME. * If both XDG decorations and libdecor are unavailable, GLFW falls back to @@ -3208,15 +3208,15 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value); * * [libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor * - * @remark @x11 Some window managers will not respect the placement of + * @remark __X11:__ Some window managers will not respect the placement of * initially hidden windows. * - * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for + * @remark __X11:__ Due to the asynchronous nature of X11, it may take a moment for * a window to reach its requested state. This means you may not be able to * query the final size, position or other attributes directly after window * creation. * - * @remark @x11 The class part of the `WM_CLASS` window property will by + * @remark __X11:__ The class part of the `WM_CLASS` window property will by * default be set to the window title passed to this function. The instance * part will use the contents of the `RESOURCE_NAME` environment variable, if * present and not empty, or fall back to the window title. Set the @@ -3349,7 +3349,7 @@ GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @macos The window title will not be updated until the next time you + * @remark __macOS:__ The window title will not be updated until the next time you * process events. * * @thread_safety This function must only be called from the main thread. @@ -3358,7 +3358,7 @@ GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window); * @sa @ref glfwGetWindowTitle * * @since Added in version 1.0. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -3392,14 +3392,14 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); * @pointer_lifetime The specified image data is copied before this function * returns. * - * @remark @macos Regular windows do not have icons on macOS. This function + * @remark __macOS:__ Regular windows do not have icons on macOS. This function * will emit @ref GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as * the application bundle's icon. For more information on bundles, see the * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library. * * [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/ * - * @remark @wayland There is no existing protocol to change an icon, the + * @remark __Wayland:__ There is no existing protocol to change an icon, the * window will thus inherit the one defined in the application's desktop file. * This function will emit @ref GLFW_FEATURE_UNAVAILABLE. * @@ -3430,7 +3430,7 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* i * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland Window positions are not currently part of any common + * @remark __Wayland:__ Window positions are not currently part of any common * Wayland protocol, so this function cannot be implemented and will emit @ref * GLFW_FEATURE_UNAVAILABLE. * @@ -3464,7 +3464,7 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland Window positions are not currently part of any common + * @remark __Wayland:__ Window positions are not currently part of any common * Wayland protocol, so this function cannot be implemented and will emit @ref * GLFW_FEATURE_UNAVAILABLE. * @@ -3474,7 +3474,7 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); * @sa @ref glfwGetWindowPos * * @since Added in version 1.0. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -3504,7 +3504,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); * @sa @ref glfwSetWindowSize * * @since Added in version 1.0. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -3539,7 +3539,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); * @remark If you set size limits and an aspect ratio that conflict, the * results are undefined. * - * @remark @wayland The size limits will not be applied until the window is + * @remark __Wayland:__ The size limits will not be applied until the window is * actually resized, either by the user or by the compositor. * * @thread_safety This function must only be called from the main thread. @@ -3582,7 +3582,7 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minhe * @remark If you set size limits and an aspect ratio that conflict, the * results are undefined. * - * @remark @wayland The aspect ratio will not be applied until the window is + * @remark __Wayland:__ The aspect ratio will not be applied until the window is * actually resized, either by the user or by the compositor. * * @thread_safety This function must only be called from the main thread. @@ -3628,7 +3628,7 @@ GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); * @sa @ref glfwSetWindowMonitor * * @since Added in version 1.0. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -3778,7 +3778,7 @@ GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland There is no way to set an opacity factor for a window. + * @remark __Wayland:__ There is no way to set an opacity factor for a window. * This function will emit @ref GLFW_FEATURE_UNAVAILABLE. * * @thread_safety This function must only be called from the main thread. @@ -3814,7 +3814,7 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); * @sa @ref glfwMaximizeWindow * * @since Added in version 2.1. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -3834,9 +3834,9 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @wayland Restoring a window from maximization is not currently part - * of any common Wayland protocol, so this function can only restore windows - * from maximization. + * @remark __Wayland:__ Restoring a window from maximization is not currently + * part of any common Wayland protocol, so this function can only restore + * windows from maximization. * * @thread_safety This function must only be called from the main thread. * @@ -3845,7 +3845,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window); * @sa @ref glfwMaximizeWindow * * @since Added in version 2.1. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -3892,7 +3892,7 @@ GLFWAPI void glfwMaximizeWindow(GLFWwindow* window); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @wayland Because Wayland wants every frame of the desktop to be + * @remark __Wayland:__ Because Wayland wants every frame of the desktop to be * complete, this function does not immediately make the window visible. * Instead it will become visible the next time the window framebuffer is * updated after this call. @@ -3955,7 +3955,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @wayland The compositor will likely ignore focus requests unless + * @remark __Wayland:__ The compositor will likely ignore focus requests unless * another window created by the same application already has input focus. * * @thread_safety This function must only be called from the main thread. @@ -3983,7 +3983,7 @@ GLFWAPI void glfwFocusWindow(GLFWwindow* window); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @macos Attention is requested to the application as a whole, not the + * @remark __macOS:__ Attention is requested to the application as a whole, not the * specific window. * * @thread_safety This function must only be called from the main thread. @@ -4058,7 +4058,7 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); * affected by any resizing or mode switching, although you may need to update * your viewport if the framebuffer size has changed. * - * @remark @wayland Window positions are not currently part of any common + * @remark __Wayland:__ Window positions are not currently part of any common * Wayland protocol. The window position arguments are ignored. * * @thread_safety This function must only be called from the main thread. @@ -4096,7 +4096,7 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int * errors. However, this function should not fail as long as it is passed * valid arguments and the library has been [initialized](@ref intro_init). * - * @remark @wayland Checking whether a window is iconified is not currently + * @remark __Wayland:__ Checking whether a window is iconified is not currently * part of any common Wayland protocol, so the @ref GLFW_ICONIFIED attribute * cannot be implemented and is always `GLFW_FALSE`. * @@ -4140,7 +4140,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); * @remark Calling @ref glfwGetWindowAttrib will always return the latest * value, even if that value is ignored by the current mode of the window. * - * @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is + * @remark __Wayland:__ The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is * not supported. Setting this will emit @ref GLFW_FEATURE_UNAVAILABLE. * * @thread_safety This function must only be called from the main thread. @@ -4220,7 +4220,7 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * - * @remark @wayland This callback will not be called. The Wayland protocol + * @remark __Wayland:__ This callback will not be called. The Wayland protocol * provides no way to be notified of when a window is moved. * * @thread_safety This function must only be called from the main thread. @@ -4259,7 +4259,7 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindow * @sa @ref window_size * * @since Added in version 1.0. - * @glfw3 Added window handle parameter and return value. + * __GLFW 3:__ Added window handle parameter and return value. * * @ingroup window */ @@ -4291,7 +4291,7 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * - * @remark @macos Selecting Quit from the application menu will trigger the + * @remark __macOS:__ Selecting Quit from the application menu will trigger the * close callback for all windows. * * @thread_safety This function must only be called from the main thread. @@ -4299,7 +4299,7 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind * @sa @ref window_close * * @since Added in version 2.5. - * @glfw3 Added window handle parameter and return value. + * __GLFW 3:__ Added window handle parameter and return value. * * @ingroup window */ @@ -4335,7 +4335,7 @@ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwi * @sa @ref window_refresh * * @since Added in version 2.5. - * @glfw3 Added window handle parameter and return value. + * __GLFW 3:__ Added window handle parameter and return value. * * @ingroup window */ @@ -4396,7 +4396,7 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * - * @remark @wayland This callback will not be called. The Wayland protocol + * @remark __Wayland:__ This callback will not be called. The Wayland protocol * provides no way to be notified of when a window is iconified, and no way to * check whether a window is currently iconified. * @@ -4905,7 +4905,7 @@ GLFWAPI int glfwGetKeyScancode(int key); * @sa @ref input_key * * @since Added in version 1.0. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup input */ @@ -4937,7 +4937,7 @@ GLFWAPI int glfwGetKey(GLFWwindow* window, int key); * @sa @ref input_mouse_button * * @since Added in version 1.0. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup input */ @@ -5007,7 +5007,7 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * - * @remark @wayland This function will only work when the cursor mode is + * @remark __Wayland:__ This function will only work when the cursor mode is * `GLFW_CURSOR_DISABLED`, otherwise it will emit @ref GLFW_FEATURE_UNAVAILABLE. * * @thread_safety This function must only be called from the main thread. @@ -5205,7 +5205,7 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); * @sa @ref input_key * * @since Added in version 1.0. - * @glfw3 Added window handle parameter and return value. + * __GLFW 3:__ Added window handle parameter and return value. * * @ingroup input */ @@ -5248,7 +5248,7 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback); * @sa @ref input_char * * @since Added in version 2.4. - * @glfw3 Added window handle parameter and return value. + * __GLFW 3:__ Added window handle parameter and return value. * * @ingroup input */ @@ -5332,7 +5332,7 @@ GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmods * @sa @ref input_mouse_button * * @since Added in version 1.0. - * @glfw3 Added window handle parameter and return value. + * __GLFW 3:__ Added window handle parameter and return value. * * @ingroup input */ @@ -5562,7 +5562,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count); * @sa @ref joystick_button * * @since Added in version 2.2. - * @glfw3 Changed to return a dynamic array. + * __GLFW 3:__ Changed to return a dynamic array. * * @ingroup input */ @@ -5926,7 +5926,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @win32 The clipboard on Windows has a single global lock for reading and + * @remark __Win32:__ The clipboard on Windows has a single global lock for reading and * writing. GLFW tries to acquire it a few times, which is almost always enough. If it * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns. * It is safe to try this multiple times. @@ -5959,7 +5959,7 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * - * @remark @win32 The clipboard on Windows has a single global lock for reading and + * @remark __Win32:__ The clipboard on Windows has a single global lock for reading and * writing. GLFW tries to acquire it a few times, which is almost always enough. If it * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns. * It is safe to try this multiple times. @@ -6176,7 +6176,7 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void); * @sa @ref glfwSwapInterval * * @since Added in version 1.0. - * @glfw3 Added window handle parameter. + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -6443,7 +6443,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * - * @remark @macos This function currently always returns `GLFW_TRUE`, as the + * @remark __macOS:__ This function currently always returns `GLFW_TRUE`, as the * `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide * a `vkGetPhysicalDevice*PresentationSupport` type function. * @@ -6501,15 +6501,15 @@ GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhys * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should * eliminate almost all occurrences of these errors. * - * @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the + * @remark __macOS:__ GLFW prefers the `VK_EXT_metal_surface` extension, with the * `VK_MVK_macos_surface` extension as a fallback. The name of the selected * extension, if any, is included in the array returned by @ref * glfwGetRequiredInstanceExtensions. * - * @remark @macos This function creates and sets a `CAMetalLayer` instance for + * @remark __macOS:__ This function creates and sets a `CAMetalLayer` instance for * the window content view, which is required for MoltenVK to function. * - * @remark @x11 By default GLFW prefers the `VK_KHR_xcb_surface` extension, + * @remark __X11:__ By default GLFW prefers the `VK_KHR_xcb_surface` extension, * with the `VK_KHR_xlib_surface` extension as a fallback. You can make * `VK_KHR_xlib_surface` the preferred extension by setting the * [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init From 4c64184455f393b85ca55408ece3e8c596af7050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 13 Mar 2024 00:19:11 +0100 Subject: [PATCH 13/16] Remove title member from window config The window title is already available in the window struct. --- src/cocoa_window.m | 2 +- src/internal.h | 1 - src/win32_window.c | 2 +- src/window.c | 1 - src/x11_window.c | 10 +++++----- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index e69b5fe0c..2bff22a6b 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -884,7 +884,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, [window->ns.object setContentView:window->ns.view]; [window->ns.object makeFirstResponder:window->ns.view]; - [window->ns.object setTitle:@(wndconfig->title)]; + [window->ns.object setTitle:@(window->title)]; [window->ns.object setDelegate:window->ns.delegate]; [window->ns.object setAcceptsMouseMovedEvents:YES]; [window->ns.object setRestorable:NO]; diff --git a/src/internal.h b/src/internal.h index 4f097aa82..de703740f 100644 --- a/src/internal.h +++ b/src/internal.h @@ -402,7 +402,6 @@ struct _GLFWwndconfig int ypos; int width; int height; - const char* title; GLFWbool resizable; GLFWbool visible; GLFWbool decorated; diff --git a/src/win32_window.c b/src/win32_window.c index 26f9684b7..6427a673e 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1377,7 +1377,7 @@ static int createNativeWindow(_GLFWwindow* window, frameHeight = rect.bottom - rect.top; } - wideTitle = _glfwCreateWideStringFromUTF8Win32(wndconfig->title); + wideTitle = _glfwCreateWideStringFromUTF8Win32(window->title); if (!wideTitle) return GLFW_FALSE; diff --git a/src/window.c b/src/window.c index e03121a46..3a3b66dfe 100644 --- a/src/window.c +++ b/src/window.c @@ -208,7 +208,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, wndconfig.width = width; wndconfig.height = height; - wndconfig.title = title; ctxconfig.share = (_GLFWwindow*) share; if (!_glfwIsValidContextConfig(&ctxconfig)) diff --git a/src/x11_window.c b/src/x11_window.c index 322349f08..986bfb93b 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -754,13 +754,13 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, const char* resourceName = getenv("RESOURCE_NAME"); if (resourceName && strlen(resourceName)) hint->res_name = (char*) resourceName; - else if (strlen(wndconfig->title)) - hint->res_name = (char*) wndconfig->title; + else if (strlen(window->title)) + hint->res_name = (char*) window->title; else hint->res_name = (char*) "glfw-application"; - if (strlen(wndconfig->title)) - hint->res_class = (char*) wndconfig->title; + if (strlen(window->title)) + hint->res_class = (char*) window->title; else hint->res_class = (char*) "GLFW-Application"; } @@ -780,7 +780,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, if (_glfw.x11.im) _glfwCreateInputContextX11(window); - _glfwSetWindowTitleX11(window, wndconfig->title); + _glfwSetWindowTitleX11(window, window->title); _glfwGetWindowPosX11(window, &window->x11.xpos, &window->x11.ypos); _glfwGetWindowSizeX11(window, &window->x11.width, &window->x11.height); From 1a0b7827d45238e23df05f13dee47dda331bde05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 29 Aug 2025 17:08:36 +0200 Subject: [PATCH 14/16] EGL: Fix error return value for glfwGetEGLSurface This is a semantic fix only. The behavior is unchanged. --- src/egl_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egl_context.c b/src/egl_context.c index 517c64cb2..272e7a4d2 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -939,7 +939,7 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle) window->context.source != GLFW_NATIVE_CONTEXT_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); - return EGL_NO_CONTEXT; + return EGL_NO_SURFACE; } } From 621e99d53ec3a49033f59e2656436d607812f5ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 29 Aug 2025 15:44:34 +0200 Subject: [PATCH 15/16] Add glfwGetEGLConfig native access function This adds the glfwGetEGLConfig function for querying the EGLConfig of the EGLSurface of a window. This is a re-implementation of the PR #2045 by knokko, slightly redesigned to handle EGLConfig being an opaque type in core EGL. Closes #2045 --- CONTRIBUTORS.md | 1 + README.md | 1 + docs/news.md | 10 ++++++++++ include/GLFW/glfw3native.h | 23 +++++++++++++++++++++++ src/egl_context.c | 22 ++++++++++++++++++++++ 5 files changed, 57 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 22ef76d0a..cfb4f42ca 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -124,6 +124,7 @@ video tutorials. - Josh Kilmer - Byunghoon Kim - Cameron King + - knokko - Peter Knut - Christoph Kubisch - Yuri Kunde Schlesner diff --git a/README.md b/README.md index 5148467a7..cfb748f9f 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ information on what to include when reporting a bug. - Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond the limit of the mouse button tokens to be reported (#2423) + - Added `glfwGetEGLConfig` function to query the `EGLConfig` of a window (#2045) - Updated minimum CMake version to 3.16 (#2541) - Removed support for building with original MinGW (#2540) - [Win32] Removed support for Windows XP and Vista (#2505) diff --git a/docs/news.md b/docs/news.md index 640ae7a57..0e0cb029b 100644 --- a/docs/news.md +++ b/docs/news.md @@ -14,6 +14,13 @@ values over 8. For compatibility with older versions, the @ref GLFW_UNLIMITED_MOUSE_BUTTONS input mode needs to be set to make use of this. + +### EGLConfig native access function {#eglconfig} + +GLFW now provides the @ref glfwGetEGLConfig native access function for querying +the `EGLConfig` of a window that has a `EGLSurface`. + + ## Caveats {#caveats} ## Deprecations {#deprecations} @@ -39,6 +46,9 @@ actively maintained and available on many platforms. ### New functions {#new_functions} + - @ref glfwGetEGLConfig + + ### New types {#new_types} ### New constants {#new_constants} diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index 011b239c8..0071d12bf 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -586,6 +586,29 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window); * @ingroup native */ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window); + +/*! @brief Retrieves the `EGLConfig` of the specified window's `EGLSurface`. + * + * @param[in] window The window whose `EGLSurface` to query. + * @param[out] config The `EGLConfig` of the window `EGLSurface`, if available. + * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an + * [error](@ref error_handling) occurred. + * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref + * GLFW_NO_WINDOW_CONTEXT. + * + * @remark `EGLConfig` is an opaque type. Unlike other GLFW functions, the @p + * config out parameter is not cleared on error, as core EGL does not define + * any invalid value. + * + * @thread_safety This function may be called from any thread. Access is not + * synchronized. + * + * @since Added in version 3.5. + * + * @ingroup native + */ +GLFWAPI int glfwGetEGLConfig(GLFWwindow* window, EGLConfig* config); #endif #if defined(GLFW_EXPOSE_NATIVE_OSMESA) diff --git a/src/egl_context.c b/src/egl_context.c index 272e7a4d2..0ef7f7295 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -946,3 +946,25 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle) return window->context.egl.surface; } +GLFWAPI int glfwGetEGLConfig(GLFWwindow* handle, EGLConfig* config) +{ + _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); + + _GLFWwindow* window = (_GLFWwindow*) handle; + assert(window != NULL); + assert(config != NULL); + + if (window->context.source != GLFW_EGL_CONTEXT_API) + { + if (_glfw.platform.platformID != GLFW_PLATFORM_WAYLAND || + window->context.source != GLFW_NATIVE_CONTEXT_API) + { + _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); + return GLFW_FALSE; + } + } + + *config = window->context.egl.config; + return GLFW_TRUE; +} + From 8e15281d34a8b9ee9271ccce38177a3d812456f8 Mon Sep 17 00:00:00 2001 From: knokko Date: Sun, 27 Jun 2021 17:36:01 +0200 Subject: [PATCH 16/16] Add glfwGetGLXFBConfig native access function This adds the glfwGetGLXFBConfig function for querying the GLXFBConfig the GLXWindow of a window. This commit is a squashed and modified version of PR #1925 by knokko. The following changes were made by elmindreda: The function signature was changed to handle GLXFBConfig being an opaque value in core GLX. The function error checks were fixed and updated. The struct member name was changed. The struct member clearing on context destruction was removed. All documentation snippets were updated. Closes #1925 --- README.md | 1 + docs/news.md | 7 +++++++ include/GLFW/glfw3native.h | 23 +++++++++++++++++++++++ src/glx_context.c | 26 ++++++++++++++++++++++++++ src/x11_platform.h | 1 + 5 files changed, 58 insertions(+) diff --git a/README.md b/README.md index cfb748f9f..1c7ced36e 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ information on what to include when reporting a bug. - Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond the limit of the mouse button tokens to be reported (#2423) - Added `glfwGetEGLConfig` function to query the `EGLConfig` of a window (#2045) + - Added `glfwGetGLXFBConfig` function to query the `GLXFBConfig` of a window (#1925) - Updated minimum CMake version to 3.16 (#2541) - Removed support for building with original MinGW (#2540) - [Win32] Removed support for Windows XP and Vista (#2505) diff --git a/docs/news.md b/docs/news.md index 0e0cb029b..f752ce427 100644 --- a/docs/news.md +++ b/docs/news.md @@ -21,6 +21,12 @@ GLFW now provides the @ref glfwGetEGLConfig native access function for querying the `EGLConfig` of a window that has a `EGLSurface`. +### GLXFBConfig native access function {#glxfbconfig} + +GLFW now provides the @ref glfwGetGLXFBConfig native access function for +querying the `GLXFBConfig` of a window that has a `GLXWindow`. + + ## Caveats {#caveats} ## Deprecations {#deprecations} @@ -47,6 +53,7 @@ actively maintained and available on many platforms. ### New functions {#new_functions} - @ref glfwGetEGLConfig + - @ref glfwGetGLXFBConfig ### New types {#new_types} diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index 0071d12bf..8db2cfa3b 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -478,6 +478,29 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window); * @ingroup native */ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window); + +/*! @brief Retrieves the `GLXFBConfig` of the specified window's `GLXWindow`. + * + * @param[in] window The window whose `GLXWindow` to query. + * @param[out] config The `GLXFBConfig` of the window `GLXWindow`, if available. + * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an + * [error](@ref error_handling) occurred. + * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref + * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE. + * + * @remark `GLXFBConfig` is an opaque type. Unlike other GLFW functions, the + * @p config out parameter is not cleared on error, as core GLX does not define + * any invalid value. + * + * @thread_safety This function may be called from any thread. Access is not + * synchronized. + * + * @since Added in version 3.5 + * + * @ingroup native + */ +GLFWAPI int glfwGetGLXFBConfig(GLFWwindow* window, GLXFBConfig* config); #endif #if defined(GLFW_EXPOSE_NATIVE_WAYLAND) diff --git a/src/glx_context.c b/src/glx_context.c index a2464a9d6..098c4bade 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -626,6 +626,8 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, return GLFW_FALSE; } + window->context.glx.fbconfig = native; + window->context.makeCurrent = makeContextCurrentGLX; window->context.swapBuffers = swapBuffersGLX; window->context.swapInterval = swapIntervalGLX; @@ -719,5 +721,29 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle) return window->context.glx.window; } +GLFWAPI int glfwGetGLXFBConfig(GLFWwindow* handle, GLXFBConfig* config) +{ + _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); + + if (_glfw.platform.platformID != GLFW_PLATFORM_X11) + { + _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "GLX: Platform not initialized"); + return GLFW_FALSE; + } + + _GLFWwindow* window = (_GLFWwindow*) handle; + assert(window != NULL); + assert(config != NULL); + + if (window->context.source != GLFW_NATIVE_CONTEXT_API) + { + _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); + return GLFW_FALSE; + } + + *config = window->context.glx.fbconfig; + return GLFW_TRUE; +} + #endif // _GLFW_X11 diff --git a/src/x11_platform.h b/src/x11_platform.h index 30326c5be..1bfeaab49 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -470,6 +470,7 @@ typedef struct _GLFWcontextGLX { GLXContext handle; GLXWindow window; + GLXFBConfig fbconfig; } _GLFWcontextGLX; // GLX-specific global data