Mac: Bring back FS windows when appropriate
This automatically restores FS windows when the application is made active (Cmd-Tab, you click the Dock icon, or you launch the .app again).
This commit is contained in:
parent
7aa0cf9eaa
commit
074edba0c1
1 changed files with 28 additions and 0 deletions
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
@interface SDLAppDelegate : NSObject
|
@interface SDLAppDelegate : NSObject
|
||||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
|
||||||
|
- (void)applicationDidBecomeActive:(NSNotification *)aNotification;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SDLAppDelegate : NSObject
|
@implementation SDLAppDelegate : NSObject
|
||||||
|
@ -52,6 +53,33 @@
|
||||||
return NSTerminateCancel;
|
return NSTerminateCancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
SDL_VideoDevice *device = SDL_GetVideoDevice();
|
||||||
|
if (device && device->windows)
|
||||||
|
{
|
||||||
|
SDL_Window *window = device->windows;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < device->num_displays; ++i)
|
||||||
|
{
|
||||||
|
SDL_Window *fullscreen_window = device->displays[i].fullscreen_window;
|
||||||
|
if (fullscreen_window)
|
||||||
|
{
|
||||||
|
if (fullscreen_window->flags & SDL_WINDOW_MINIMIZED) {
|
||||||
|
SDL_RestoreWindow(fullscreen_window);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->flags & SDL_WINDOW_MINIMIZED) {
|
||||||
|
SDL_RestoreWindow(window);
|
||||||
|
} else {
|
||||||
|
SDL_RaiseWindow(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||||
{
|
{
|
||||||
return (BOOL)SDL_SendDropFile([filename UTF8String]);
|
return (BOOL)SDL_SendDropFile([filename UTF8String]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue