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/56aad76b164be741af21688ea3832093c2069cef.