Skip to content

Commit

Permalink
sokol_app.h win32: SAPP_EVENTTYPE_MOUSE_ENTER/LEAVE sets dx/dy to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed May 20, 2023
1 parent 3c836d1 commit 50febb3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sokol_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -7218,6 +7218,8 @@ _SOKOL_PRIVATE LRESULT CALLBACK _sapp_win32_wndproc(HWND hWnd, UINT uMsg, WPARAM
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = _sapp.win32.hwnd;
TrackMouseEvent(&tme);
_sapp.mouse.dx = 0.0f;
_sapp.mouse.dy = 0.0f;
_sapp_win32_mouse_event(SAPP_EVENTTYPE_MOUSE_ENTER, SAPP_MOUSEBUTTON_INVALID);
}
_sapp_win32_mouse_event(SAPP_EVENTTYPE_MOUSE_MOVE, SAPP_MOUSEBUTTON_INVALID);
Expand Down Expand Up @@ -7262,6 +7264,8 @@ _SOKOL_PRIVATE LRESULT CALLBACK _sapp_win32_wndproc(HWND hWnd, UINT uMsg, WPARAM

case WM_MOUSELEAVE:
if (!_sapp.mouse.locked) {
_sapp.mouse.dx = 0.0f;
_sapp.mouse.dy = 0.0f;
_sapp.win32.mouse_tracked = false;
_sapp_win32_mouse_event(SAPP_EVENTTYPE_MOUSE_LEAVE, SAPP_MOUSEBUTTON_INVALID);
}
Expand Down

0 comments on commit 50febb3

Please sign in to comment.