From #7249, reverted the hunks other than #7239.
main
kanjitalk755 2023-09-09 09:10:06 +09:00 committed by Sam Lantinga
parent b79db0a6ea
commit e152129787
2 changed files with 20 additions and 9 deletions

View File

@ -219,15 +219,11 @@ static int Cocoa_ShowCursor(SDL_Cursor *cursor)
SDL_VideoDevice *device = SDL_GetVideoDevice(); SDL_VideoDevice *device = SDL_GetVideoDevice();
SDL_Window *window = (device ? device->windows : NULL); SDL_Window *window = (device ? device->windows : NULL);
for (; window != NULL; window = window->next) { for (; window != NULL; window = window->next) {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_CocoaWindowData *driverdata = (__bridge SDL_CocoaWindowData *)window->driverdata;
if(mouse->focus) { if (driverdata) {
if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) { [driverdata.nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:)
[(__bridge NSCursor*)mouse->cur_cursor->driverdata set]; withObject:[driverdata.nswindow contentView]
} else { waitUntilDone:NO];
[[NSCursor invisibleCursor] set];
}
} else {
[[NSCursor arrowCursor] set];
} }
} }
return 0; return 0;

View File

@ -1727,6 +1727,21 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
return YES; return YES;
} }
- (void)resetCursorRects
{
SDL_Mouse *mouse;
[super resetCursorRects];
mouse = SDL_GetMouse();
if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) {
[self addCursorRect:[self bounds]
cursor:(__bridge NSCursor *)mouse->cur_cursor->driverdata];
} else {
[self addCursorRect:[self bounds]
cursor:[NSCursor invisibleCursor]];
}
}
- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
{ {
if (SDL_GetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH)) { if (SDL_GetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH)) {