based on glfw 2.7.7 and some more tweaks