From 9be64e0a486c44527521eccd5ba338cd1c0e8afc Mon Sep 17 00:00:00 2001 From: ovadmin Date: Tue, 5 Sep 2017 12:05:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9C=A8=20macOS=2010.13=20b?= =?UTF-8?q?eta=20=E4=B8=8A=E7=84=A1=E6=B3=95=E5=8F=AB=E5=87=BA=E5=81=8F?= =?UTF-8?q?=E5=A5=BD=E8=A8=AD=E5=AE=9A=E7=9A=84=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正根據請參考以下連結: https://github.com/openvanilla/openvanilla/commit/3241c7f688fae807f4a1e39259c762eae7b7c6ec --- Source/AppDelegate.h | 3 +++ Source/AppDelegate.m | 10 ++++++++++ Source/InputMethodController.mm | 6 +++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Source/AppDelegate.h b/Source/AppDelegate.h index 19796d7e..eb216be0 100644 --- a/Source/AppDelegate.h +++ b/Source/AppDelegate.h @@ -34,6 +34,7 @@ #import +@class PreferencesWindowController; @class UpdateNotificationController; @interface AppDelegate : NSObject @@ -42,11 +43,13 @@ NSWindow *_window; NSURLConnection *_updateCheckConnection; NSMutableData *_receivingData; + PreferencesWindowController *_preferencesWindowController; UpdateNotificationController *_updateNotificationController; } - (void)checkForUpdate; - (void)checkForUpdateForced:(BOOL)forced; +- (void)showPreferences; @property (assign, nonatomic) IBOutlet NSWindow *window; @end diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index 8989d537..02b4270c 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -52,6 +52,7 @@ static const NSTimeInterval kTimeoutInterval = 60.0; - (void)dealloc { + [_preferencesWindowController release]; [_updateCheckConnection release]; [_updateNotificationController release]; [super dealloc]; @@ -122,6 +123,15 @@ static const NSTimeInterval kTimeoutInterval = 60.0; [_updateCheckConnection start]; } +- (void)showPreferences +{ + if (!_preferencesWindowController) { + _preferencesWindowController = [[PreferencesWindowController alloc] initWithWindowNibName:@"preferences"]; + } + [[_preferencesWindowController window] center]; + [[_preferencesWindowController window] orderFront:self]; +} + - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { [_receivingData release]; diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index 199cd044..5e207827 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -1385,7 +1385,11 @@ public: - (void)showPreferences:(id)sender { // show the preferences panel, and also make the IME app itself the focus - [super showPreferences:sender]; + if ([IMKInputController instancesRespondToSelector:@selector(showPreferences:)]) { + [super showPreferences:sender]; + } else { + [(AppDelegate *)[NSApp delegate] showPreferences]; + } [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; }