locale: Implemented SDL_GetPreferredLocales().

This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
This commit is contained in:
Ryan C. Gordon
2020-05-04 02:27:29 -04:00
parent 1e5dd06f83
commit fa23e3d00b
42 changed files with 1318 additions and 4 deletions

View File

@@ -117,6 +117,7 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
}
- (id)init;
- (void)localeDidChange:(NSNotification *)notification;
@end
@implementation SDLAppDelegate : NSObject
@@ -137,6 +138,11 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
selector:@selector(focusSomeWindow:)
name:NSApplicationDidBecomeActiveNotification
object:nil];
[center addObserver:self
selector:@selector(localeDidChange:)
name:NSCurrentLocaleDidChangeNotification
object:nil];
}
return self;
@@ -148,6 +154,7 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
[center removeObserver:self name:NSWindowWillCloseNotification object:nil];
[center removeObserver:self name:NSApplicationDidBecomeActiveNotification object:nil];
[center removeObserver:self name:NSCurrentLocaleDidChangeNotification object:nil];
[super dealloc];
}
@@ -226,6 +233,11 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
}
}
- (void)localeDidChange:(NSNotification *)notification;
{
SDL_SendLocaleChangedEvent();
}
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
return (BOOL)SDL_SendDropFile(NULL, [filename UTF8String]) && SDL_SendDropComplete(NULL);