SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Window (mouse) enter / leave events should provide mouse id

Open rohlem opened this issue 2 years ago • 0 comments

Since SDL's mouse events provide a mouse id, I think it's natural to expect SDL to support multi-mouse environments. In such an environment, a window (mouse) enter / leave event without mouse id is not very helpful - I don't know which mouse just entered or left a given window, until that mouse happens to generate a mouse event in a window I control/monitor.

Particularly in the case of leaving an SDL window, I can't know which mouse it was if it now interacts with windows from a different program - unless I specially keep track of all other mice so I know which ones I can eliminate, which is a fairly complex workaround. The solution would be for SDL to simply pass along this information (which I assume it should already know on all platforms).

EDIT: After reading the code I think I have misinterpreted status-quo, and "mouse focus" is a boolean attribute, and enter events only fire for the first mouse entering a window? (Why?) This means applications need to duplicate this bookkeeping for themselves if they want to support multiple mice that aren't all constrained to a single window. If that's correct this issue would have to become a larger proposal to send window enter/leave events per mouse.

(Unrelated: docs/migration-guide.md still lists intermediary names SDL_EVENT_WINDOW_ENTER and SDL_EVENT_WINDOW_LEAVE instead of the new SDL_EVENT_WINDOW_MOUSE_ENTER and SDL_EVENT_WINDOW_MOUSE_LEAVE, making the new events a bit harder to find)

rohlem avatar May 20 '23 17:05 rohlem