From 8e9a5d29a8258d2e82250102db9ae713794be321 Mon Sep 17 00:00:00 2001 From: FuzzyQuills Date: Tue, 12 Dec 2023 06:25:44 +1000 Subject: [PATCH 1/6] Cocoa: No NSWindowStyleMaskResizable in fullscreen On macOS 10.15 Catalina and earlier, not having the resizable bit cleared in NSWindowStyleMask in fullscreen leads to windows minimising when clicked anywhere in the content area. On all tested macOS versions it also causes the fullscreen window to be resizable by the user. Regression introduced by 0d599026d04ddcc2695ae938fc1864523dab7a34. Fixes #2377 Closes #2405 --- src/cocoa_window.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index c030c2d5..9d794940 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1284,7 +1284,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, if (window->monitor) { - styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable); styleMask |= NSWindowStyleMaskBorderless; } else From 7b152019dab027dfd276e37cacaacd439075f6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 11 Dec 2023 17:07:47 +0100 Subject: [PATCH 2/6] Add credit Related to #2377 Related to #2405 --- CONTRIBUTORS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a78fd5ce..7ee3c514 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -72,6 +72,7 @@ video tutorials. - Mário Freitas - GeO4d - Marcus Geelnard + - Gegy - ghuser404 - Charles Giessen - Ryan C. Gordon @@ -131,6 +132,7 @@ video tutorials. - Luflosi - lukect - Tristam MacDonald + - Jean-Luc Mackail - Hans Mackowiak - Ramiro Magno - Дмитри Малышев From 378e5fc814ec7d6071d7b3423aac5182b0336f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 12 Dec 2023 13:46:48 +0100 Subject: [PATCH 3/6] Fix Markdown formatting for changelog entry --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d7810cd5..95ee0baf 100644 --- a/README.md +++ b/README.md @@ -407,7 +407,7 @@ information on what to include when reporting a bug. (#442) - [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension (#1380) - [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL + - [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL - [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843) - [GLX] Added loading of glvnd `libGLX.so.0` where available - [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library From eeeb56eb23c9a23866e8042fb23d7b0b4d96d106 Mon Sep 17 00:00:00 2001 From: lo-v-ol Date: Mon, 5 Jun 2023 08:56:15 +0100 Subject: [PATCH 4/6] EGL: Fix GLFW_CONTEXT_NO_ERROR on Mesa Mesa EGL requires the context version to be set to 2.0 or greater before EGL_CONTEXT_OPENGL_NO_ERROR_KHR in the attribute list. Without this, context creation via Mesa EGL with EGL_CONTEXT_OPENGL_NO_ERROR_KHR set fails with EGL_BAD_ATTRIBUTE. Fixes #2348 --- src/egl_context.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/egl_context.c b/src/egl_context.c index a18590b9..6e997b11 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -641,18 +641,18 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; } - if (ctxconfig->noerror) - { - if (_glfw.egl.KHR_create_context_no_error) - SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE); - } - if (ctxconfig->major != 1 || ctxconfig->minor != 0) { SET_ATTRIB(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major); SET_ATTRIB(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor); } + if (ctxconfig->noerror) + { + if (_glfw.egl.KHR_create_context_no_error) + SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE); + } + if (mask) SET_ATTRIB(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask); From ea3ea627086f06f207928dceb61a8ea5d0fb3fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 12 Dec 2023 13:39:54 +0100 Subject: [PATCH 5/6] Update changelog and add credit Related to #2348 --- CONTRIBUTORS.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 7ee3c514..0b66f2ef 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -127,6 +127,7 @@ video tutorials. - Anders Lindqvist - Leon Linhart - Marco Lizza + - lo-v-ol - Eyal Lotem - Aaron Loucks - Luflosi diff --git a/README.md b/README.md index 95ee0baf..831bdba6 100644 --- a/README.md +++ b/README.md @@ -409,6 +409,7 @@ information on what to include when reporting a bug. (#1380) - [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL - [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843) + - [EGL] Bugfix: Setting `GLFW_CONTEXT_DEBUG` caused creation to fail (#2348) - [GLX] Added loading of glvnd `libGLX.so.0` where available - [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library From 2c1d31009fdc527d5a44ff887659a25ecbf1f7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 12 Dec 2023 17:38:52 +0100 Subject: [PATCH 6/6] Cocoa: Fix segfault querying joystick elements It is reportedly possible for IOHIDDeviceCopyMatchingElements to return NULL on macOS 13 if the application lacks input monitoring permissions. This commit only prevents the segfault. More work will be needed to correctly handle this situation, including Game Controller support. Related to #2320 Closes #2321 --- CONTRIBUTORS.md | 1 + README.md | 2 ++ src/cocoa_joystick.m | 11 ++++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0b66f2ef..75533ec3 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -85,6 +85,7 @@ video tutorials. - Andrew Gutekanst - Stephen Gutekanst - Jonathan Hale + - Daniel Hauser - hdf89shfdfs - Moritz Heinemann - Sylvain Hellegouarch diff --git a/README.md b/README.md index 831bdba6..cebe62bc 100644 --- a/README.md +++ b/README.md @@ -276,6 +276,8 @@ information on what to include when reporting a bug. subdirectory (#2113,#2120) - [Cocoa] Bugfix: Compilation failed on OS X 10.8 due to unconditional use of 10.9+ symbols (#2161) + - [Cocoa] Bugfix: Querying joystick elements could reportedly segfault on macOS + 13 Ventura (#2320) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: Key names were not updated when the keyboard layout changed (#1462,#1528) diff --git a/src/cocoa_joystick.m b/src/cocoa_joystick.m index 865adac7..caeb4725 100644 --- a/src/cocoa_joystick.m +++ b/src/cocoa_joystick.m @@ -136,6 +136,14 @@ static void matchCallback(void* context, return; } + CFArrayRef elements = + IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone); + + // It is reportedly possible for this to fail on macOS 13 Ventura + // if the application does not have input monitoring permissions + if (!elements) + return; + axes = CFArrayCreateMutable(NULL, 0, NULL); buttons = CFArrayCreateMutable(NULL, 0, NULL); hats = CFArrayCreateMutable(NULL, 0, NULL); @@ -179,9 +187,6 @@ static void matchCallback(void* context, name[8], name[9], name[10]); } - CFArrayRef elements = - IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone); - for (CFIndex i = 0; i < CFArrayGetCount(elements); i++) { IOHIDElementRef native = (IOHIDElementRef)