Win32: Invoke cursor enter callback before cursor position callback

This commit is contained in:
Leon Linhart 2019-05-27 22:42:12 +02:00
parent d834f01ca4
commit 3f7308ccd7
No known key found for this signature in database
GPG Key ID: 832BEDF8BC1E7425
2 changed files with 15 additions and 13 deletions

View File

@ -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 - 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 - Bugfix: The CMake config-file package used an absolute path and was not
relocatable (#1470) 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) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
- [NSGL] Removed enforcement of forward-compatible flag for core contexts - [NSGL] Removed enforcement of forward-compatible flag for core contexts
@ -223,6 +224,7 @@ skills.
- Glenn Lewis - Glenn Lewis
- Shane Liesegang - Shane Liesegang
- Anders Lindqvist - Anders Lindqvist
- Leon Linhart
- Eyal Lotem - Eyal Lotem
- Aaron Loucks - Aaron Loucks
- Tristam MacDonald - Tristam MacDonald

View File

@ -828,6 +828,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
const int x = GET_X_LPARAM(lParam); const int x = GET_X_LPARAM(lParam);
const int y = GET_Y_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) if (window->cursorMode == GLFW_CURSOR_DISABLED)
{ {
const int dx = x - window->win32.lastCursorPosX; 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.lastCursorPosX = x;
window->win32.lastCursorPosY = y; 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; return 0;
} }