You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After running git bisect, I found this to be the offending commit:
ea642fe9ff17e90a0ccc0ec95d007859c4ab02bc is the first bad commit
commit ea642fe9ff17e90a0ccc0ec95d007859c4ab02bc
Author: Sam Lantinga <[email protected]>
Date: Wed Jan 15 23:34:20 2025 -0800
cocoa: clear mouse focus based on NSEventTypeMouseExited events (#11991)
We can't directly set the mouse focus since we may get spammed by entered/exited events,
but we can process the current focus later in the mouseMoved handler in line with the
mouse motion event sequence.
Fixes https://github.com/libsdl-org/SDL/issues/8188
src/video/cocoa/SDL_cocoaevents.m | 2 ++
src/video/cocoa/SDL_cocoamouse.h | 1 +
src/video/cocoa/SDL_cocoamouse.m | 28 ++++++++++++++++++++++------
src/video/cocoa/SDL_cocoawindow.m | 6 ++++++
4 files changed, 31 insertions(+), 6 deletions(-)
Mouse events behave very wonky, they 100% don't work the first few seconds/moments/events. Then they start working but very oddly. I haven't fully figured out what's going on. I'm suspecting a state-bug, given the simple changes in the commit. @slouken you seemed to have edited this code last in #11991, while fixing #8188.
The text was updated successfully, but these errors were encountered:
I'm not 100% sure what the mechanic is, but I suspect that the initial mouse entered event is missing for me when the window spawns underneath the cursor. Otherwise I don't know immediately under which conditions the Cocoa_MouseFocus global is not set. Leaving and reentering the window with the mouse does not fix the issue, so I'm suspecting my macOS version (12.7) doesn't report those enter / leave events the same way as it happens on a more modern version of macOS?
This quick-and-dirty test fixes the mouse again:
--- a/src/video/cocoa/SDL_cocoamouse.m+++ b/src/video/cocoa/SDL_cocoamouse.m@@ -480,6 +480,9 @@ void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event)
return;
}
+ // Any event coming through clearly was happening inside a window.+ Cocoa_MouseFocus = [event window];+
mouse = SDL_GetMouse();
data = (SDL_MouseData *)mouse->internal;
if (!data) {
However, perhaps even this is a slightly better fix (also works):
After running git bisect, I found this to be the offending commit:
Mouse events behave very wonky, they 100% don't work the first few seconds/moments/events. Then they start working but very oddly. I haven't fully figured out what's going on. I'm suspecting a state-bug, given the simple changes in the commit. @slouken you seemed to have edited this code last in #11991, while fixing #8188.
The text was updated successfully, but these errors were encountered: