glfw/glfw-legacy — pull request #1 by shurcooL (2013-04-18 20:18:14+00:00)
Title: Changed so user calls to glfwEnable(GLFW_MOUSE_CURSOR) have a long-term effect when cursor is temporarily made visible by GLFW (due to iconification/losing focus).

This is a fix for the following situation. Imagine you have a GLFW app that hides the cursor normally, but when Esc is pressed, a menu appears and cursor is made visible. When the user alt-tabs or presses Windows key, the app loses focus. GLFW makes the cursor temporarily visible (until the window regains focus). At this point, the app wants to open its menu and make mouse cursor remain visible for when window regains focus. Previously, calling glfwEnable(GLFW_MOUSE_CURSOR) had no effect when the window already lost focus, since it had no way to reset oldMouseLockValid which would make the cursor invisible when the window gets focus again. With this fix, it will ensure when you call glfwEnable(GLFW_MOUSE_CURSOR), GLFW will keep the cursor visible even as the app regains focus.

See my thought process on leaving this out of glfwDisable(GLFW_MOUSE_CURSOR) case in the (lengthy) commit messages.

The first commit was used heavily by myself a long time ago. But I've made changes to the code (both to clean it up visually, and to simplify it in the glfwDisable case) since then and it is untested as is (I don't have a readily accessible Windows dev environment atm).