Skip to content

Commit

Permalink
修正在 macOS 10.13 beta 上無法叫出偏好設定的問題
Browse files Browse the repository at this point in the history
修正根據請參考以下連結:
openvanilla/openvanilla@3241c7f
  • Loading branch information
ovadmin authored and mjhsieh committed Sep 5, 2017
1 parent 4cf379b commit 3267a91
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Source/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#import <Cocoa/Cocoa.h>

@class PreferencesWindowController;
@class UpdateNotificationController;

@interface AppDelegate : NSObject <NSApplicationDelegate>
Expand All @@ -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
10 changes: 10 additions & 0 deletions Source/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ @implementation AppDelegate

- (void)dealloc
{
[_preferencesWindowController release];
[_updateCheckConnection release];
[_updateNotificationController release];
[super dealloc];
Expand Down Expand Up @@ -122,6 +123,15 @@ - (void)checkForUpdateForced:(BOOL)forced
[_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];
Expand Down
6 changes: 5 additions & 1 deletion Source/InputMethodController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,11 @@ - (void)_showCandidateWindowUsingVerticalMode:(BOOL)useVerticalMode client:(id)c
- (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];
}

Expand Down

0 comments on commit 3267a91

Please sign in to comment.