From 93a3ba808067134b5a964b1a1c44701450386fe4 Mon Sep 17 00:00:00 2001 From: moritz-h <7849248+moritz-h@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:37:46 +0100 Subject: [PATCH 01/11] Win32: Add library name suffix to pkg-config file Closes #2386 --- CMake/glfw3.pc.in | 2 +- src/CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMake/glfw3.pc.in b/CMake/glfw3.pc.in index 37f4efd9..36ee218e 100644 --- a/CMake/glfw3.pc.in +++ b/CMake/glfw3.pc.in @@ -8,6 +8,6 @@ Description: A multi-platform library for OpenGL, window and input Version: @GLFW_VERSION@ URL: https://www.glfw.org/ Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@ -Libs: -L${libdir} -l@GLFW_LIB_NAME@ +Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@ Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@ Cflags: -I${includedir} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 01f191c9..5acac0d0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -126,6 +126,7 @@ if (UNIX AND GLFW_BUILD_SHARED_LIBRARY) else() set(GLFW_LIB_NAME glfw3) endif() +set(GLFW_LIB_NAME_SUFFIX "") set_target_properties(glfw PROPERTIES OUTPUT_NAME ${GLFW_LIB_NAME} @@ -337,6 +338,7 @@ if (GLFW_BUILD_SHARED_LIBRARY) # Add a suffix to the import library to avoid naming conflicts set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib") endif() + set (GLFW_LIB_NAME_SUFFIX "dll") target_compile_definitions(glfw INTERFACE GLFW_DLL) endif() From 46c2e35c554d96fdb8a94c3f19c88e34a613532a Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Wed, 15 Nov 2023 16:44:24 +0100 Subject: [PATCH 02/11] Updated changelog --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e3d18ec8..5f86a9eb 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ information on what to include when reporting a bug. - Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization - Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization - Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092) + - [Win32] Fix pkg-config for dynamic library on Windows (#2386, #2420) - [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access to the window menu - [Win32] Added a version info resource to the GLFW DLL From 9a80225ddfdaf9457c80c97ce4c12aed3377dd24 Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Wed, 15 Nov 2023 16:48:19 +0100 Subject: [PATCH 03/11] Add credits Related to #2386 and #2420 --- CONTRIBUTORS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 020bb26e..908b8169 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -150,6 +150,7 @@ video tutorials. - Alexander Monakov - Pierre Morel - Jon Morton + - moritz-h - Pierre Moulon - Martins Mozeiko - Pascal Muetschard @@ -247,6 +248,7 @@ video tutorials. - Corentin Wallez - Torsten Walluhn - Patrick Walton + - Jim Wang - Xo Wang - Andre Weissflog - Jay Weisskopf From 3ed6e9d89aa518b44ab30e598e5b813879eda71c Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Wed, 15 Nov 2023 17:48:30 +0100 Subject: [PATCH 04/11] Updated credit --- CONTRIBUTORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 908b8169..cba9ac73 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -83,6 +83,7 @@ video tutorials. - Stephen Gutekanst - Jonathan Hale - hdf89shfdfs + - Moritz Heinemann - Sylvain Hellegouarch - Björn Hempel - Matthew Henry @@ -150,7 +151,6 @@ video tutorials. - Alexander Monakov - Pierre Morel - Jon Morton - - moritz-h - Pierre Moulon - Martins Mozeiko - Pascal Muetschard From 938a3c29b2e1b93a681cfde82876dfce97635658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 19 Jul 2023 17:40:22 +0200 Subject: [PATCH 05/11] Update Doxyfile template for Doxygen 1.9.7 --- docs/Doxyfile.in | 180 +++++++++++++++++++++++++++++------------------ 1 file changed, 113 insertions(+), 67 deletions(-) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 6505aa33..067619c7 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -1,4 +1,4 @@ -# Doxyfile 1.9.5 +# Doxyfile 1.9.7 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -86,7 +86,7 @@ CREATE_SUBDIRS = NO # level increment doubles the number of directories, resulting in 4096 # directories at level 8 which is the default and also the maximum value. The # sub-directories are organized in 2 levels, the first level always has a fixed -# numer of 16 directories. +# number of 16 directories. # Minimum value: 0, maximum value: 8, default value: 8. # This tag requires that the tag CREATE_SUBDIRS is set to YES. @@ -364,6 +364,17 @@ MARKDOWN_SUPPORT = YES TOC_INCLUDE_HEADINGS = 5 +# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to +# generate identifiers for the Markdown headings. Note: Every identifier is +# unique. +# Possible values are: DOXYGEN Use a fixed 'autotoc_md' string followed by a +# sequence number starting at 0. and GITHUB Use the lower case version of title +# with any whitespace replaced by '-' and punctations characters removed.. +# The default value is: DOXYGEN. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +MARKDOWN_ID_STYLE = DOXYGEN + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or @@ -404,7 +415,7 @@ SIP_SUPPORT = NO # should set this option to NO. # The default value is: YES. -IDL_PROPERTY_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES then doxygen will reuse the documentation of the first @@ -488,6 +499,14 @@ LOOKUP_CACHE_SIZE = 0 NUM_PROC_THREADS = 1 +# If the TIMESTAMP tag is set different from NO then each generated page will +# contain the date or date and time when the page was generated. Setting this to +# NO can help when comparing the output of multiple runs. +# Possible values are: YES, NO, DATETIME and DATE. +# The default value is: NO. + +TIMESTAMP = NO + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -569,7 +588,8 @@ HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO @@ -860,11 +880,26 @@ WARN_IF_INCOMPLETE_DOC = YES WARN_NO_PARAMDOC = YES +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS # then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but # at the end of the doxygen process doxygen will return with a non-zero status. -# Possible values are: NO, YES and FAIL_ON_WARNINGS. +# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves +# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not +# write the warning messages in between other messages but write them at the end +# of a run, in case a WARN_LOGFILE is defined the warning messages will be +# besides being in the defined file also be shown at the end of a run, unless +# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case +# the behavior will remain as with the setting FAIL_ON_WARNINGS. +# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT. # The default value is: NO. WARN_AS_ERROR = NO @@ -987,9 +1022,6 @@ EXCLUDE_PATTERNS = # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # ANamespace::AClass, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = APIENTRY GLFWAPI @@ -1186,10 +1218,11 @@ VERBATIM_HEADERS = YES ALPHABETICAL_INDEX = YES -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = glfw GLFW_ @@ -1268,7 +1301,12 @@ HTML_STYLESHEET = # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css" @@ -1284,17 +1322,13 @@ HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css" HTML_EXTRA_FILES = "@GLFW_SOURCE_DIR@/docs/spaces.svg" # The HTML_COLORSTYLE tag can be used to specify if the generated HTML output -# should be rendered with a dark or light theme. Default setting AUTO_LIGHT -# enables light output unless the user preference is dark output. Other options -# are DARK to always use dark mode, LIGHT to always use light mode, AUTO_DARK to -# default to dark mode unless the user prefers light mode, and TOGGLE to let the -# user toggle between dark and light mode via a button. -# Possible values are: LIGHT Always generate light output., DARK Always generate -# dark output., AUTO_LIGHT Automatically set the mode according to the user -# preference, use light mode if no preference is set (the default)., AUTO_DARK -# Automatically set the mode according to the user preference, use dark mode if -# no preference is set. and TOGGLE Allow to user to switch between light and -# dark mode via a button.. +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. # The default value is: AUTO_LIGHT. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1330,15 +1364,6 @@ HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_GAMMA = 80 -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = YES - # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that # are dynamically created via JavaScript. If disabled, the navigation index will @@ -1488,6 +1513,16 @@ BINARY_TOC = NO TOC_EXPAND = NO +# The SITEMAP_URL tag is used to specify the full URL of the place where the +# generated documentation will be placed on the server by the user during the +# deployment of the documentation. The generated sitemap is called sitemap.xml +# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL +# is specified no sitemap is generated. For information about the sitemap +# protocol see https://www.sitemaps.org +# This tag requires that the tag GENERATE_HTML is set to YES. + +SITEMAP_URL = + # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help @@ -1627,7 +1662,7 @@ ENUM_VALUES_PER_LINE = 4 # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. -TREEVIEW_WIDTH = 300 +TREEVIEW_WIDTH = 250 # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. @@ -1976,9 +2011,16 @@ PDF_HYPERLINKS = YES USE_PDFLATEX = YES -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode -# command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. +# The LATEX_BATCHMODE tag ignals the behavior of LaTeX in case of an error. +# Possible values are: NO same as ERROR_STOP, YES same as BATCH, BATCH In batch +# mode nothing is printed on the terminal, errors are scrolled as if is +# hit at every error; missing files that TeX tries to input or request from +# keyboard input (\read on a not open input stream) cause the job to abort, +# NON_STOP In nonstop mode the diagnostic message will appear on the terminal, +# but there is no possibility of user interaction just like in batch mode, +# SCROLL In scroll mode, TeX will stop only for missing files to input or if +# keyboard input is necessary and ERROR_STOP In errorstop mode, TeX will stop at +# each error, asking for user intervention. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1999,14 +2041,6 @@ LATEX_HIDE_INDICES = NO LATEX_BIB_STYLE = plain -# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_TIMESTAMP = NO - # The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) # path from which the emoji images will be read. If a relative path is entered, # it will be relative to the LATEX_OUTPUT directory. If left blank the @@ -2172,7 +2206,7 @@ DOCBOOK_OUTPUT = docbook #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. @@ -2353,16 +2387,9 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to diagram generator tools #--------------------------------------------------------------------------- -# You can include diagrams made with dia in doxygen documentation. Doxygen will -# then run dia to produce the diagram and insert it in the documentation. The -# DIA_PATH tag allows you to specify the directory where the dia binary resides. -# If left empty dia is assumed to be found in the default search path. - -DIA_PATH = - # If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. @@ -2371,7 +2398,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2424,13 +2451,15 @@ DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a -# graph for each documented class showing the direct and indirect inheritance -# relations. In case HAVE_DOT is set as well dot will be used to draw the graph, -# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set -# to TEXT the direct and indirect inheritance relations will be shown as texts / -# links. -# Possible values are: NO, YES, TEXT and GRAPH. +# If the CLASS_GRAPH tag is set to YES or GRAPH or BUILTIN then doxygen will +# generate a graph for each documented class showing the direct and indirect +# inheritance relations. In case the CLASS_GRAPH tag is set to YES or GRAPH and +# HAVE_DOT is enabled as well, then dot will be used to draw the graph. In case +# the CLASS_GRAPH tag is set to YES and HAVE_DOT is disabled or if the +# CLASS_GRAPH tag is set to BUILTIN, then the built-in generator will be used. +# If the CLASS_GRAPH tag is set to TEXT the direct and indirect inheritance +# relations will be shown as texts / links. +# Possible values are: NO, YES, TEXT, GRAPH and BUILTIN. # The default value is: YES. CLASS_GRAPH = YES @@ -2571,7 +2600,7 @@ DIR_GRAPH_MAX_DEPTH = 1 # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). @@ -2608,11 +2637,12 @@ DOT_PATH = DOTFILE_DIRS = -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the \mscfile -# command). +# You can include diagrams made with dia in doxygen documentation. Doxygen will +# then run dia to produce the diagram and insert it in the documentation. The +# DIA_PATH tag allows you to specify the directory where the dia binary resides. +# If left empty dia is assumed to be found in the default search path. -MSCFILE_DIRS = +DIA_PATH = # The DIAFILE_DIRS tag can be used to specify one or more directories that # contain dia files that are included in the documentation (see the \diafile @@ -2689,3 +2719,19 @@ GENERATE_LEGEND = YES # The default value is: YES. DOT_CLEANUP = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. If the MSCGEN_TOOL tag is left empty (the default), then doxygen will +# use a built-in version of mscgen tool to produce the charts. Alternatively, +# the MSCGEN_TOOL tag can also specify the name an external tool. For instance, +# specifying prog as the value, doxygen will call the tool as prog -T +# -o . The external tool should support +# output file formats "png", "eps", "svg", and "ismap". + +MSCGEN_TOOL = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the \mscfile +# command). + +MSCFILE_DIRS = From 01d7c331fddd5d027f7d85c651c6473b18d0ea37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 3 Aug 2023 18:10:24 +0200 Subject: [PATCH 06/11] Wayland: Fix zero being used in place of NULL --- src/wl_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wl_window.c b/src/wl_window.c index 7b9e3d0d..fc4a671a 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2478,7 +2478,7 @@ void _glfwSetWindowMousePassthroughWayland(_GLFWwindow* window, GLFWbool enabled wl_region_destroy(region); } else - wl_surface_set_input_region(window->wl.surface, 0); + wl_surface_set_input_region(window->wl.surface, NULL); } float _glfwGetWindowOpacityWayland(_GLFWwindow* window) From 509f4131bec5303b04e30617a123e7ce18a95798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 15 Nov 2023 17:55:07 +0100 Subject: [PATCH 07/11] Win32: Fix glfwWaitEventsTimeout ignoring messages The bitmask passed to MsgWaitForMultipleObjects was missing QS_SENDMESSAGE, causing glfwWaitEventsTimeout not to return when the thread received messages sent from other threads. Fixes #2408 --- CONTRIBUTORS.md | 1 + README.md | 1 + src/win32_window.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index cba9ac73..99aab7b1 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -142,6 +142,7 @@ video tutorials. - Marcel Metz - Liam Middlebrook - Ave Milia + - Icyllis Milica - Jonathan Miller - Kenneth Miller - Bruce Mitchener diff --git a/README.md b/README.md index 5f86a9eb..2ced3ffb 100644 --- a/README.md +++ b/README.md @@ -230,6 +230,7 @@ information on what to include when reporting a bug. - [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395) - [Win32] Bugfix: The OSMesa library was not unloaded on termination - [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050) + - [Win32] Bugfix: `glfwWaitEventsTimeout` did not return for some sent messages (#2408) - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619) - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle - [Cocoa] Moved main menu creation to GLFW initialization time (#1649) diff --git a/src/win32_window.c b/src/win32_window.c index 676640bf..a4a18171 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -2121,7 +2121,7 @@ void _glfwWaitEventsWin32(void) void _glfwWaitEventsTimeoutWin32(double timeout) { - MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLEVENTS); + MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLINPUT); _glfwPollEventsWin32(); } From 0bd3e879e1fd8c5ed4562929fb0365a5a7089833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 16 Nov 2023 17:28:17 +0100 Subject: [PATCH 08/11] 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. --- docs/context.dox | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/context.dox b/docs/context.dox index c64a0709..21672ad7 100644 --- a/docs/context.dox +++ b/docs/context.dox @@ -88,9 +88,10 @@ window, even if none of them are visible. @subsection context_less Windows without contexts You can disable context creation by setting the -[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. Windows -without contexts must not be passed to @ref glfwMakeContextCurrent or @ref -glfwSwapBuffers. +[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. + +Windows without contexts should not be passed to @ref glfwMakeContextCurrent or +@ref glfwSwapBuffers. Doing this generates a @ref GLFW_NO_WINDOW_CONTEXT error. @section context_current Current context From c992226a9c63f80e157d6bd9bf2372acd2a1c795 Mon Sep 17 00:00:00 2001 From: Michael Skec Date: Thu, 9 Nov 2023 15:04:19 +1100 Subject: [PATCH 09/11] Linux: Fix memory leak when inotify init failed This introduces regex_compiled boolean to track whether the regex is compiled successfully. Closes #2229 --- src/linux_joystick.c | 8 ++++++-- src/linux_joystick.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/linux_joystick.c b/src/linux_joystick.c index 26db853e..5b2c3b34 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -326,7 +326,9 @@ GLFWbool _glfwInitJoysticksLinux(void) // Continue without device connection notifications if inotify fails - if (regcomp(&_glfw.linjs.regex, "^event[0-9]\\+$", 0) != 0) + _glfw.linjs.regex_compiled = regcomp(&_glfw.linjs.regex, + "^event[0-9]\\+$", 0) == 0; + if (!_glfw.linjs.regex_compiled) { _glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex"); return GLFW_FALSE; @@ -378,8 +380,10 @@ void _glfwTerminateJoysticksLinux(void) inotify_rm_watch(_glfw.linjs.inotify, _glfw.linjs.watch); close(_glfw.linjs.inotify); - regfree(&_glfw.linjs.regex); } + + if (_glfw.linjs.regex_compiled) + regfree(&_glfw.linjs.regex); } GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode) diff --git a/src/linux_joystick.h b/src/linux_joystick.h index df605e72..3e1fe8c8 100644 --- a/src/linux_joystick.h +++ b/src/linux_joystick.h @@ -50,6 +50,7 @@ typedef struct _GLFWlibraryLinux int inotify; int watch; regex_t regex; + GLFWbool regex_compiled; GLFWbool dropped; } _GLFWlibraryLinux; From 2a4dd9c28f663c1ef410d6430aaa3fe90085bf6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 16 Nov 2023 23:08:30 +0100 Subject: [PATCH 10/11] Cleanup --- src/linux_joystick.c | 7 +++---- src/linux_joystick.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/linux_joystick.c b/src/linux_joystick.c index 5b2c3b34..78d867eb 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -326,9 +326,8 @@ GLFWbool _glfwInitJoysticksLinux(void) // Continue without device connection notifications if inotify fails - _glfw.linjs.regex_compiled = regcomp(&_glfw.linjs.regex, - "^event[0-9]\\+$", 0) == 0; - if (!_glfw.linjs.regex_compiled) + _glfw.linjs.regexCompiled = (regcomp(&_glfw.linjs.regex, "^event[0-9]\\+$", 0) == 0); + if (!_glfw.linjs.regexCompiled) { _glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex"); return GLFW_FALSE; @@ -382,7 +381,7 @@ void _glfwTerminateJoysticksLinux(void) close(_glfw.linjs.inotify); } - if (_glfw.linjs.regex_compiled) + if (_glfw.linjs.regexCompiled) regfree(&_glfw.linjs.regex); } diff --git a/src/linux_joystick.h b/src/linux_joystick.h index 3e1fe8c8..64462b04 100644 --- a/src/linux_joystick.h +++ b/src/linux_joystick.h @@ -50,7 +50,7 @@ typedef struct _GLFWlibraryLinux int inotify; int watch; regex_t regex; - GLFWbool regex_compiled; + GLFWbool regexCompiled; GLFWbool dropped; } _GLFWlibraryLinux; From a87acd8c1fac78011013bebb537926e18fe49f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 16 Nov 2023 20:47:27 +0100 Subject: [PATCH 11/11] Update changelog and add credit Related to #2229 --- CONTRIBUTORS.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 99aab7b1..3ad802f2 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -215,6 +215,7 @@ video tutorials. - Dmitri Shuralyov - Joao da Silva - Daniel Sieger + - Michael Skec - Daniel Skorupski - Slemmie - Anthony Smith diff --git a/README.md b/README.md index 2ced3ffb..eb19011b 100644 --- a/README.md +++ b/README.md @@ -390,6 +390,7 @@ information on what to include when reporting a bug. - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043) + - [Linux] Bugfix: A small amount of memory could leak if initialization failed (#2229) - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) - [NSGL] Removed enforcement of forward-compatible flag for core contexts - [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer