diff --git a/ShadowsocksX-NG.xcodeproj/project.pbxproj b/ShadowsocksX-NG.xcodeproj/project.pbxproj index f24e94b..151b495 100644 --- a/ShadowsocksX-NG.xcodeproj/project.pbxproj +++ b/ShadowsocksX-NG.xcodeproj/project.pbxproj @@ -38,6 +38,7 @@ 9B3FFF4C1D09D8F70019A709 /* install_helper.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF4B1D09D8F70019A709 /* install_helper.sh */; }; 9B3FFF4F1D09D9D50019A709 /* ProxyConfHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF4E1D09D9D50019A709 /* ProxyConfHelper.m */; }; 9B3FFF541D09E2D10019A709 /* proxy_conf_helper in Resources */ = {isa = PBXBuildFile; fileRef = 9B3FFF441D09CD3B0019A709 /* proxy_conf_helper */; }; + 9BB706A71D1B982300551F0E /* SWBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BB706A51D1B982300551F0E /* SWBApplication.m */; }; 9BE8FBBF1D0B211600CAFD01 /* libcrypto.1.0.0.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9BE8FBBD1D0B1FB900CAFD01 /* libcrypto.1.0.0.dylib */; }; 9BEEF0691D04D4D500FC52B3 /* install_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0651D04CB8500FC52B3 /* install_ss_local.sh */; }; 9BEEF06A1D04D4D500FC52B3 /* start_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0661D04CE8D00FC52B3 /* start_ss_local.sh */; }; @@ -136,6 +137,8 @@ 9B3FFF4E1D09D9D50019A709 /* ProxyConfHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProxyConfHelper.m; sourceTree = ""; }; 9B3FFF501D09DAEA0019A709 /* proxy_conf_helper_version.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = proxy_conf_helper_version.h; sourceTree = ""; }; 9B3FFF511D09DBA20019A709 /* ShadowsocksX-NG-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ShadowsocksX-NG-Bridging-Header.h"; sourceTree = ""; }; + 9BB706A51D1B982300551F0E /* SWBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWBApplication.m; sourceTree = ""; }; + 9BB706A61D1B982300551F0E /* SWBApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWBApplication.h; sourceTree = ""; }; 9BE8FBBD1D0B1FB900CAFD01 /* libcrypto.1.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libcrypto.1.0.0.dylib; sourceTree = ""; }; 9BE8FBC11D0B71CF00CAFD01 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/PreferencesWindowController.strings"; sourceTree = ""; }; 9BEEF0651D04CB8500FC52B3 /* install_ss_local.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = install_ss_local.sh; sourceTree = ""; }; @@ -247,6 +250,8 @@ 9B0BFFE71D0460A70040E62B /* ShadowsocksX-NG */ = { isa = PBXGroup; children = ( + 9BB706A51D1B982300551F0E /* SWBApplication.m */, + 9BB706A61D1B982300551F0E /* SWBApplication.h */, 9B3FFF511D09DBA20019A709 /* ShadowsocksX-NG-Bridging-Header.h */, 9B3FFF151D072FDE0019A709 /* LaunchAtLoginController.h */, 9B3FFF161D072FDE0019A709 /* LaunchAtLoginController.m */, @@ -593,6 +598,7 @@ files = ( 9B3FFF171D072FDE0019A709 /* LaunchAtLoginController.m in Sources */, 9B3FFF4F1D09D9D50019A709 /* ProxyConfHelper.m in Sources */, + 9BB706A71D1B982300551F0E /* SWBApplication.m in Sources */, 9B3FFF1E1D0732660019A709 /* Utils.m in Sources */, 9B3FFF321D08CEE40019A709 /* SWBQRCodeWindowController.m in Sources */, 9B3FFF211D08826E0019A709 /* PACUtils.swift in Sources */, diff --git a/ShadowsocksX-NG/Info.plist b/ShadowsocksX-NG/Info.plist index 01b772e..a8991db 100644 --- a/ShadowsocksX-NG/Info.plist +++ b/ShadowsocksX-NG/Info.plist @@ -48,6 +48,6 @@ NSMainNibFile MainMenu NSPrincipalClass - NSApplication + SWBApplication diff --git a/ShadowsocksX-NG/SWBApplication.h b/ShadowsocksX-NG/SWBApplication.h new file mode 100644 index 0000000..c04a8b6 --- /dev/null +++ b/ShadowsocksX-NG/SWBApplication.h @@ -0,0 +1,11 @@ +// +// Created by clowwindy on 3/1/14. +// Copyright (c) 2014 clowwindy. All rights reserved. +// + +#import +@import AppKit; + + +@interface SWBApplication : NSApplication +@end \ No newline at end of file diff --git a/ShadowsocksX-NG/SWBApplication.m b/ShadowsocksX-NG/SWBApplication.m new file mode 100644 index 0000000..171af4a --- /dev/null +++ b/ShadowsocksX-NG/SWBApplication.m @@ -0,0 +1,49 @@ +// +// Created by clowwindy on 3/1/14. +// Copyright (c) 2014 clowwindy. All rights reserved. +// + +#import "SWBApplication.h" + + +@implementation SWBApplication { + +} + +// Enable Key Shortcuts +// http://stackoverflow.com/questions/970707/cocoa-keyboard-shortcuts-in-dialog-without-an-edit-menu +- (void) sendEvent:(NSEvent *)event { + if ([event type] == NSKeyDown) { + if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == NSCommandKeyMask) { + if ([[event charactersIgnoringModifiers] isEqualToString:@"x"]) { + if ([self sendAction:@selector(cut:) to:nil from:self]) + return; + } + else if ([[event charactersIgnoringModifiers] isEqualToString:@"c"]) { + if ([self sendAction:@selector(copy:) to:nil from:self]) + return; + } + else if ([[event charactersIgnoringModifiers] isEqualToString:@"v"]) { + if ([self sendAction:@selector(paste:) to:nil from:self]) + return; + } + else if ([[event charactersIgnoringModifiers] isEqualToString:@"z"]) { + if ([self sendAction:@selector(undo:) to:nil from:self]) + return; + } + else if ([[event charactersIgnoringModifiers] isEqualToString:@"a"]) { + if ([self sendAction:@selector(selectAll:) to:nil from:self]) + return; + } + } + else if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSShiftKeyMask)) { + if ([[event charactersIgnoringModifiers] isEqualToString:@"Z"]) { + if ([self sendAction:@selector(redo:) to:nil from:self]) + return; + } + } + } + [super sendEvent:event]; +} + +@end \ No newline at end of file