Skip to content

Commit bce2a33

Browse files
committed
Use the default window focus behavior on macOS
We had to work around odd behavior in really old versions of macOS, but the current behavior is great. Fixes #3954
1 parent 400489c commit bce2a33

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/video/cocoa/SDL_cocoaevents.m

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,10 @@ - (void)focusSomeWindow:(NSNotification *)aNotification
261261
return;
262262
}
263263

264+
// Restore any fullscreen window
264265
device = SDL_GetVideoDevice();
265266
if (device && device->windows) {
266-
SDL_Window *window = device->windows;
267-
int i;
268-
for (i = 0; i < device->num_displays; ++i) {
267+
for (int i = 0; i < device->num_displays; ++i) {
269268
SDL_Window *fullscreen_window = device->displays[i]->fullscreen_window;
270269
if (fullscreen_window) {
271270
if (fullscreen_window->flags & SDL_WINDOW_MINIMIZED) {
@@ -274,12 +273,6 @@ - (void)focusSomeWindow:(NSNotification *)aNotification
274273
return;
275274
}
276275
}
277-
278-
if (window->flags & SDL_WINDOW_MINIMIZED) {
279-
SDL_RestoreWindow(window);
280-
} else {
281-
SDL_RaiseWindow(window);
282-
}
283276
}
284277
}
285278

@@ -370,9 +363,9 @@ - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app
370363

371364
- (IBAction)menu:(id)sender
372365
{
373-
SDL_TrayEntry *entry = [[sender representedObject] pointerValue];
366+
SDL_TrayEntry *entry = [[sender representedObject] pointerValue];
374367

375-
SDL_ClickTrayEntry(entry);
368+
SDL_ClickTrayEntry(entry);
376369
}
377370

378371
@end

0 commit comments

Comments
 (0)