From 5dbca2e2c9b2b021ebe4fb5f9ba5506360b3e10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 2 Jun 2020 19:54:30 +0200 Subject: [PATCH 01/12] Wayland: Fix repeated keys reported to NULL window This fixes a race between the key repeat logic and the surface leave event handler, which could result in repeated keys being reported with a window of NULL. Fixes #1704. (cherry picked from commit c72da994bac2a21ef07f891a44ab49570d650dec) --- README.md | 2 ++ src/wl_window.c | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9fc19451..292ceef8 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ information on what to include when reporting a bug. non-printable keys (#1598) - [X11] Bugfix: Function keys were mapped to `GLFW_KEY_UNKNOWN` for some layout combinaitons (#1598) + - [Wayland] Bugfix: Repeated keys could be reported with `NULL` window (#1704) ## Contact @@ -333,6 +334,7 @@ skills. - Torsten Walluhn - Patrick Walton - Xo Wang + - Waris - Jay Weisskopf - Frank Wille - Ryogo Yoshimura diff --git a/src/wl_window.c b/src/wl_window.c index 61785fe7..0cc725a5 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -870,10 +870,17 @@ static void handleEvents(int timeout) if (read_ret != 8) return; - for (i = 0; i < repeats; ++i) - _glfwInputKey(_glfw.wl.keyboardFocus, _glfw.wl.keyboardLastKey, - _glfw.wl.keyboardLastScancode, GLFW_REPEAT, - _glfw.wl.xkb.modifiers); + if (_glfw.wl.keyboardFocus) + { + for (i = 0; i < repeats; ++i) + { + _glfwInputKey(_glfw.wl.keyboardFocus, + _glfw.wl.keyboardLastKey, + _glfw.wl.keyboardLastScancode, + GLFW_REPEAT, + _glfw.wl.xkb.modifiers); + } + } } if (fds[2].revents & POLLIN) From d7b67a2eb4d89e17ff92dea5142f2839c67ae090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 25 May 2020 22:23:22 +0200 Subject: [PATCH 02/12] Fix MinGW linker flag tests breaking later tests (cherry picked from commit cfc23cd0879171c796b6ddff4ee178dd111a526c) --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index be2eaf96..be7b6397 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,9 @@ if (MINGW) if (_GLFW_HAS_64ASLR) set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}") endif() + + # Clear flags again to avoid breaking later tests + set(CMAKE_REQUIRED_FLAGS) endif() #-------------------------------------------------------------------- From 307ce3aa1a5366be1b790fa2034fafdd756a0dde Mon Sep 17 00:00:00 2001 From: Tatsuya Yatagawa Date: Fri, 5 Jun 2020 12:57:43 +0900 Subject: [PATCH 03/12] Fix GLU header inclusion being disabled This fixes a regression introduced by 105cf32e0b05e207d4cd5efa462887569ca2116a where GLFW_INCLUDE_GLU had no effect if the GLFW header detected an earlier OpenGL header or loader library header. Closes #1712. (cherry picked from commit 81f475bccbc0e784e8327005f2e66e3546fe8da0) --- include/GLFW/glfw3.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 85f2cfda..5119832c 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -193,6 +193,22 @@ extern "C" { #endif /*__APPLE__*/ +#elif defined(GLFW_INCLUDE_GLU) + + #if defined(__APPLE__) + + #if defined(GLFW_INCLUDE_GLU) + #include + #endif + + #else /*__APPLE__*/ + + #if defined(GLFW_INCLUDE_GLU) + #include + #endif + + #endif /*__APPLE__*/ + #elif !defined(GLFW_INCLUDE_NONE) && \ !defined(__gl_h_) && \ !defined(__gles1_gl_h_) && \ @@ -216,9 +232,6 @@ extern "C" { #define GL_GLEXT_LEGACY #endif #include - #if defined(GLFW_INCLUDE_GLU) - #include - #endif #else /*__APPLE__*/ @@ -226,9 +239,6 @@ extern "C" { #if defined(GLFW_INCLUDE_GLEXT) #include #endif - #if defined(GLFW_INCLUDE_GLU) - #include - #endif #endif /*__APPLE__*/ From 92c6209530815f10f5d599766999e2e0482f8918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 17 Jun 2020 20:21:31 +0200 Subject: [PATCH 04/12] Add credit Related to #1712. (cherry picked from commit 3a3c32c6b1c49d03ea1a0e2c1b721bd0022bceae) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 292ceef8..e835aa26 100644 --- a/README.md +++ b/README.md @@ -337,6 +337,7 @@ skills. - Waris - Jay Weisskopf - Frank Wille + - Tatsuya Yatagawa - Ryogo Yoshimura - Lukas Zanner - Andrey Zholos From 325b4186d3f6196272a58197e3f2bc043f8e5b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 17 Jun 2020 19:31:53 +0200 Subject: [PATCH 05/12] Remove deprecated sudo key from Travis CI config (cherry picked from commit bf1c62b2612dba79365e836830fe2a6105adbe78) --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b6392bd..bc924a90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ matrix: include: - os: linux dist: xenial - sudo: false name: "X11 shared library" addons: apt: @@ -23,7 +22,6 @@ matrix: - CFLAGS=-Werror - os: linux dist: xenial - sudo: false name: "X11 static library" addons: apt: @@ -37,7 +35,6 @@ matrix: - CFLAGS=-Werror - os: linux dist: xenial - sudo: required name: "Wayland shared library" addons: apt: @@ -54,7 +51,6 @@ matrix: - CFLAGS=-Werror - os: linux dist: xenial - sudo: required name: "Wayland static library" addons: apt: @@ -92,14 +88,12 @@ matrix: - USE_OSMESA=ON - CFLAGS=-Werror - os: osx - sudo: false name: "Cocoa shared library" env: - BUILD_SHARED_LIBS=ON - CFLAGS=-Werror - MACOSX_DEPLOYMENT_TARGET=10.8 - os: osx - sudo: false name: "Cocoa static library" env: - BUILD_SHARED_LIBS=OFF From 1730184971321f65fa0961503bb44686e24f2c40 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Tue, 23 Jun 2020 16:20:27 +0200 Subject: [PATCH 06/12] Fix typos (cherry picked from commit b66f105f3ee6b3234f6ebd64af176a3a487d70f1) --- src/x11_monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/x11_monitor.c b/src/x11_monitor.c index 1f804aeb..fb3a67ba 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -164,7 +164,7 @@ void _glfwPollMonitorsX11(void) if (widthMM <= 0 || heightMM <= 0) { // HACK: If RandR does not provide a physical size, assume the - // X11 default 96 DPI and calcuate from the CRTC viewport + // X11 default 96 DPI and calculate from the CRTC viewport // NOTE: These members are affected by rotation, unlike the mode // info and output info members widthMM = (int) (ci->width * 25.4f / 96.f); From 9aefb67358a4528f6d4f749a35268f5aa90387bc Mon Sep 17 00:00:00 2001 From: "A. Tombs" Date: Thu, 18 Jun 2020 02:23:08 +0100 Subject: [PATCH 07/12] Re-word docs for OPENGL_DEBUG_CONTEXT hint Re-worded documentation for the `GLFW_OPENGL_DEBUG_CONTEXT` window hint to avoid implying that it only applies to OpenGL contexts. Added a link to the relevant Khronos extension description. Closes #1720. (cherry picked from commit 8a69a0d7e545a88de3dd88710e4a881932ca07ed) --- docs/window.dox | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/window.dox b/docs/window.dox index 6109fbf5..0908b35a 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -408,10 +408,14 @@ Forward-compatibility is described in detail in the [OpenGL Reference Manual](https://www.opengl.org/registry/). @anchor GLFW_OPENGL_DEBUG_CONTEXT_hint -__GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether to create a debug OpenGL -context, which may have additional error and performance issue reporting -functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If OpenGL ES -is requested, this hint is ignored. +__GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether the context should be created +in debug mode, which may provide additional error and diagnostic reporting +functionality. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. + +@par +Debug contexts for OpenGL and OpenGL ES are described in detail by the +[GL_KHR_debug](https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt) +extension. @anchor GLFW_OPENGL_PROFILE_hint __GLFW_OPENGL_PROFILE__ specifies which OpenGL profile to create the context From f921caf4a61eb8bcd2409bfb1393b2a902c9b513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 28 Jun 2020 19:21:36 +0200 Subject: [PATCH 08/12] Re-word docs for GLFW_OPENGL_DEBUG_CONTEXT attrib Related to #1720. (cherry picked from commit 4e3b43383a1e738dfcf47205671246f2008a8d94) --- docs/window.dox | 4 ++-- include/GLFW/glfw3.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/window.dox b/docs/window.dox index 0908b35a..8eb0df06 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -1332,8 +1332,8 @@ __GLFW_OPENGL_FORWARD_COMPAT__ is `GLFW_TRUE` if the window's context is an OpenGL forward-compatible one, or `GLFW_FALSE` otherwise. @anchor GLFW_OPENGL_DEBUG_CONTEXT_attrib -__GLFW_OPENGL_DEBUG_CONTEXT__ is `GLFW_TRUE` if the window's context is an -OpenGL debug context, or `GLFW_FALSE` otherwise. +__GLFW_OPENGL_DEBUG_CONTEXT__ is `GLFW_TRUE` if the window's context is in debug +mode, or `GLFW_FALSE` otherwise. @anchor GLFW_OPENGL_PROFILE_attrib __GLFW_OPENGL_PROFILE__ indicates the OpenGL profile used by the context. This diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 5119832c..621333fd 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -974,9 +974,9 @@ extern "C" { * and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib). */ #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 -/*! @brief OpenGL debug context hint and attribute. +/*! @brief Debug mode context hint and attribute. * - * OpenGL debug context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and + * Debug mode context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and * [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib). */ #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 From 26aaa007e010c22c74093cf4fd43ffca92681f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 29 Jun 2020 21:14:29 +0200 Subject: [PATCH 09/12] Fix format of change log entry (cherry picked from commit 854ce1db4edfbe16f9c8794fb7a8af5de6d20881) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e835aa26..d0dd79b5 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ information on what to include when reporting a bug. - Bugfix: Some extension loader headers did not prevent default OpenGL header inclusion (#1695) - - [Cocoa] Use `CALayer` instead of `NSView` for `EGLNativeWindowType` (#1169) + - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) - [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636) - [X11] Bugfix: Xlib errors caused by other parts of the application could be reported as GLFW errors From 9cae95faa3311a12f0c8e1e85227d225a58c0c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 29 Jun 2020 21:16:59 +0200 Subject: [PATCH 10/12] Cocoa: Fix non-BMP Unicode codepoint input Supplimentary Plane codepoints were reported as UTF-16 surrogate pairs. Fixes #1635. (cherry picked from commit ad9eb768c9518dbe94232e5201d318d512ad9beb) --- README.md | 3 +++ src/cocoa_window.m | 22 ++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d0dd79b5..e0569a4c 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,8 @@ information on what to include when reporting a bug. - Bugfix: Some extension loader headers did not prevent default OpenGL header inclusion (#1695) - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) + - [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 + (#1635) - [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636) - [X11] Bugfix: Xlib errors caused by other parts of the application could be reported as GLFW errors @@ -341,6 +343,7 @@ skills. - Ryogo Yoshimura - Lukas Zanner - Andrey Zholos + - Aihui Zhu - Santi Zupancic - Jonas Ådahl - Lasse Öörni diff --git a/src/cocoa_window.m b/src/cocoa_window.m index ddd6e909..9431b2e2 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -731,14 +731,24 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; else characters = (NSString*) string; - const NSUInteger length = [characters length]; - for (NSUInteger i = 0; i < length; i++) + NSRange range = NSMakeRange(0, [characters length]); + while (range.length) { - const unichar codepoint = [characters characterAtIndex:i]; - if ((codepoint & 0xff00) == 0xf700) - continue; + uint32_t codepoint = 0; - _glfwInputChar(window, codepoint, mods, plain); + if ([characters getBytes:&codepoint + maxLength:sizeof(codepoint) + usedLength:NULL + encoding:NSUTF32StringEncoding + options:0 + range:range + remainingRange:&range]) + { + if ((codepoint & 0xff00) == 0xf700) + continue; + + _glfwInputChar(window, codepoint, mods, plain); + } } } From e6646c8508453e07695eab7e9047d612f8ceebff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 29 Jun 2020 23:14:16 +0200 Subject: [PATCH 11/12] Cocoa: Fix regression in private use area check This fixes a regression introduced by ad9eb768c9518dbe94232e5201d318d512ad9beb. (cherry picked from commit e47832ffcf924a0580ce79431b9601f0ca0915ee) --- 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 9431b2e2..9fa72a6b 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -744,7 +744,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; range:range remainingRange:&range]) { - if ((codepoint & 0xff00) == 0xf700) + if (codepoint >= 0xf700 && codepoint <= 0xf7ff) continue; _glfwInputChar(window, codepoint, mods, plain); From d858e48860c7fb59aedac098003a5f3d436b2783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 29 Jun 2020 20:43:28 +0200 Subject: [PATCH 12/12] Win32: Fix non-BMP Unicode codepoint input Supplementary Plane codepoints from WM_CHAR and WM_SYSCHAR messages were reported as UTF-16 surrogate pairs. Related to #1635. (cherry picked from commit 6ce207039240a63120a91ee4ba4d39bd0a3ef8c8) --- README.md | 1 + src/win32_platform.h | 2 ++ src/win32_window.c | 32 ++++++++++++++++++++++++++++---- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e0569a4c..9f82fce2 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ information on what to include when reporting a bug. - Bugfix: Some extension loader headers did not prevent default OpenGL header inclusion (#1695) + - [Win32] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) - [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 (#1635) diff --git a/src/win32_platform.h b/src/win32_platform.h index be1dc544..426c0efc 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -318,6 +318,8 @@ typedef struct _GLFWwindowWin32 // The last received cursor position, regardless of source int lastCursorPosX, lastCursorPosY; + // The last recevied high surrogate when decoding pairs of UTF-16 messages + WCHAR highSurrogate; } _GLFWwindowWin32; diff --git a/src/win32_window.c b/src/win32_window.c index 0ce22ee7..b19f6c61 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -645,11 +645,35 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_CHAR: case WM_SYSCHAR: + { + if (wParam >= 0xd800 && wParam <= 0xdbff) + window->win32.highSurrogate = (WCHAR) wParam; + else + { + unsigned int codepoint = 0; + + if (wParam >= 0xdc00 && wParam <= 0xdfff) + { + if (window->win32.highSurrogate) + { + codepoint += (window->win32.highSurrogate - 0xd800) << 10; + codepoint += (WCHAR) wParam - 0xdc00; + codepoint += 0x10000; + } + } + else + codepoint = (WCHAR) wParam; + + window->win32.highSurrogate = 0; + _glfwInputChar(window, codepoint, getKeyMods(), uMsg != WM_SYSCHAR); + } + + return 0; + } + case WM_UNICHAR: { - const GLFWbool plain = (uMsg != WM_SYSCHAR); - - if (uMsg == WM_UNICHAR && wParam == UNICODE_NOCHAR) + if (wParam == UNICODE_NOCHAR) { // WM_UNICHAR is not sent by Windows, but is sent by some // third-party input method engine @@ -657,7 +681,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, return TRUE; } - _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain); + _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GLFW_TRUE); return 0; }