Reproduce the bug this way: - Press left mouse button on an SDL window (turn mouse capturing on) and drag mouse outside the window. - While still holding the left mouse button, press Win + Tab and select a different window using the keyboard (arrow buttons and Enter). - Release the left mouse button. - When we move the mouse over the SDL window again, the left mouse button seems to be still pressed (SDL_GetMouseState returns SDL_BUTTON_LMASK). - Win + Tab and select the SDL window again (now window becomes highlighted) -> delayed mouse button up event arrives.