Closes https://github.com/kovidgoyal/kitty/issues/1884. From https://github.com/glfw/glfw/commit/a337c568486025d22443535b7c047a563bc34373.
Reduces the difference to upstream. From https://github.com/glfw/glfw/commit/ab118b2529a8da3e6b5f847b80ee86bb8c6bf6bb.