diff --git a/README.md b/README.md index 56e5e17ab..fde05499e 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ information on what to include when reporting a bug. - Disabled tests and examples by default when built as a CMake subdirectory - Bugfix: The CMake config-file package used an absolute path and was not relocatable (#1470) + - [Win32] Bugfix: Invoke cursor enter callback before cursor position callback - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [NSGL] Removed enforcement of forward-compatible flag for core contexts @@ -223,6 +224,7 @@ skills. - Glenn Lewis - Shane Liesegang - Anders Lindqvist + - Leon Linhart - Eyal Lotem - Aaron Loucks - Tristam MacDonald diff --git a/src/win32_window.c b/src/win32_window.c index b8d0dc3d5..a2e9a08eb 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -828,6 +828,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, const int x = GET_X_LPARAM(lParam); const int y = GET_Y_LPARAM(lParam); + if (!window->win32.cursorTracked) + { + TRACKMOUSEEVENT tme; + ZeroMemory(&tme, sizeof(tme)); + tme.cbSize = sizeof(tme); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = window->win32.handle; + TrackMouseEvent(&tme); + + window->win32.cursorTracked = GLFW_TRUE; + _glfwInputCursorEnter(window, GLFW_TRUE); + } + if (window->cursorMode == GLFW_CURSOR_DISABLED) { const int dx = x - window->win32.lastCursorPosX; @@ -848,19 +861,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, window->win32.lastCursorPosX = x; window->win32.lastCursorPosY = y; - if (!window->win32.cursorTracked) - { - TRACKMOUSEEVENT tme; - ZeroMemory(&tme, sizeof(tme)); - tme.cbSize = sizeof(tme); - tme.dwFlags = TME_LEAVE; - tme.hwndTrack = window->win32.handle; - TrackMouseEvent(&tme); - - window->win32.cursorTracked = GLFW_TRUE; - _glfwInputCursorEnter(window, GLFW_TRUE); - } - return 0; }