Don't assert or change window draggable state if SDL isn't managing hit testing

Fixes an assert if the application has set up its own hit testing on macOS
This commit is contained in:
Sam Lantinga 2024-07-29 09:15:55 -07:00
parent 5318e30ee5
commit 5637cd009a

View file

@ -1526,8 +1526,6 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
{ {
SDL_Window *window = _data.window; SDL_Window *window = _data.window;
SDL_assert(isDragAreaRunning == [_data.nswindow isMovableByWindowBackground]);
if (window->hit_test) { /* if no hit-test, skip this. */ if (window->hit_test) { /* if no hit-test, skip this. */
const NSPoint location = [theEvent locationInWindow]; const NSPoint location = [theEvent locationInWindow];
const SDL_Point point = { (int)location.x, window->h - (((int)location.y) - 1) }; const SDL_Point point = { (int)location.x, window->h - (((int)location.y) - 1) };
@ -1538,14 +1536,14 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
[_data.nswindow setMovableByWindowBackground:YES]; [_data.nswindow setMovableByWindowBackground:YES];
} }
return YES; /* dragging! */ return YES; /* dragging! */
} } else {
}
if (isDragAreaRunning) { if (isDragAreaRunning) {
isDragAreaRunning = NO; isDragAreaRunning = NO;
[_data.nswindow setMovableByWindowBackground:NO]; [_data.nswindow setMovableByWindowBackground:NO];
return YES; /* was dragging, drop event. */ return YES; /* was dragging, drop event. */
} }
}
}
return NO; /* not a special area, carry on. */ return NO; /* not a special area, carry on. */
} }