SDL
SDL copied to clipboard
SDL3, POPUP windows. mouse captured by wrong window.
When popup window is shown without setting keyboard focus on it, SDL_UpdateMouseCapture sets capture to wrong window - not to the popup window as it should.
This leads to mouse handling problems on popups. For example SDL_EVENT_MOUSE_BUTTON_UP is not delivered to the popup.
I suspect that this line
capture_window = SDL_GetKeyboardFocus();
shall be replaced by
capture_window = mouse->focus;
keyboard focus
window is not always the one that contains the mouse.
Think about popup window of combobox (dropdown select), or a menu. Such popups do not have input (keyboard) focus.