projects
/
enjoyable.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b46786f
)
Support sudden and automatic termination.
author
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 5 Mar 2013 00:45:48 +0000
(
01:45
+0100)
committer
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 5 Mar 2013 00:45:48 +0000
(
01:45
+0100)
English.lproj/MainMenu.xib
patch
|
blob
|
history
EnjoyableApplicationDelegate.h
patch
|
blob
|
history
EnjoyableApplicationDelegate.m
patch
|
blob
|
history
Info.plist
patch
|
blob
|
history
NJMappingsController.m
patch
|
blob
|
history
diff --git
a/English.lproj/MainMenu.xib
b/English.lproj/MainMenu.xib
index
32c3a86
..
00740ba
100644
(file)
--- a/
English.lproj/MainMenu.xib
+++ b/
English.lproj/MainMenu.xib
@@
-333,7
+333,6
@@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 14}, {140, 25}}</string>
<reference key="NSSuperview"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 14}, {140, 25}}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="850080795">
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="850080795">
@@
-383,7
+382,6
@@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{19, 14}, {67, 25}}</string>
<reference key="NSSuperview"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{19, 14}, {67, 25}}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="594076765">
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="594076765">
@@
-462,7
+460,7
@@
<reference ref="981531896"/>
<reference ref="658903347"/>
</array>
<reference ref="981531896"/>
<reference ref="658903347"/>
</array>
- <array
class="NSMutableArray"
key="NSToolbarIBDefaultItems">
+ <array key="NSToolbarIBDefaultItems">
<reference ref="496378711"/>
<reference ref="658903347"/>
<reference ref="981531896"/>
<reference ref="496378711"/>
<reference ref="658903347"/>
<reference ref="981531896"/>
@@
-497,7
+495,7
@@
<string key="NSFrameSize">{200, 298}</string>
<reference key="NSSuperview" ref="698362889"/>
<reference key="NSWindow"/>
<string key="NSFrameSize">{200, 298}</string>
<reference key="NSSuperview" ref="698362889"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="
1036252745
"/>
+ <reference key="NSNextKeyView" ref="
892486973
"/>
<bool key="NSEnabled">YES</bool>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<bool key="NSControlAllowsExpansionToolTips">YES</bool>
<bool key="NSEnabled">YES</bool>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<bool key="NSControlAllowsExpansionToolTips">YES</bool>
@@
-627,7
+625,7
@@
<string key="NSFrameSize">{202, 300}</string>
<reference key="NSSuperview" ref="977242492"/>
<reference key="NSWindow"/>
<string key="NSFrameSize">{202, 300}</string>
<reference key="NSSuperview" ref="977242492"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="
892486973
"/>
+ <reference key="NSNextKeyView" ref="
698362889
"/>
<int key="NSsFlags">150034</int>
<reference key="NSVScroller" ref="1036252745"/>
<reference key="NSHScroller" ref="892486973"/>
<int key="NSsFlags">150034</int>
<reference key="NSVScroller" ref="1036252745"/>
<reference key="NSHScroller" ref="892486973"/>
@@
-691,7
+689,6
@@
<string key="NSFrame">{{227, 55}, {180, 24}}</string>
<reference key="NSSuperview" ref="606740242"/>
<reference key="NSWindow"/>
<string key="NSFrame">{{227, 55}, {180, 24}}</string>
<reference key="NSSuperview" ref="606740242"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="301345285">
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="301345285">
@@
-1036,7
+1033,7
@@
<string key="NSFrameSize">{198, 198}</string>
<reference key="NSSuperview" ref="947403733"/>
<reference key="NSWindow"/>
<string key="NSFrameSize">{198, 198}</string>
<reference key="NSSuperview" ref="947403733"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="
968378655
"/>
+ <reference key="NSNextKeyView" ref="
553414014
"/>
<bool key="NSEnabled">YES</bool>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<bool key="NSControlAllowsExpansionToolTips">YES</bool>
<bool key="NSEnabled">YES</bool>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<bool key="NSControlAllowsExpansionToolTips">YES</bool>
@@
-1128,7
+1125,7
@@
<string key="NSFrame">{{0, 20}, {200, 200}}</string>
<reference key="NSSuperview" ref="671181514"/>
<reference key="NSWindow"/>
<string key="NSFrame">{{0, 20}, {200, 200}}</string>
<reference key="NSSuperview" ref="671181514"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="
553414014
"/>
+ <reference key="NSNextKeyView" ref="
947403733
"/>
<int key="NSsFlags">150034</int>
<reference key="NSVScroller" ref="968378655"/>
<reference key="NSHScroller" ref="553414014"/>
<int key="NSsFlags">150034</int>
<reference key="NSVScroller" ref="968378655"/>
<reference key="NSHScroller" ref="553414014"/>
@@
-1144,7
+1141,6
@@
<string key="NSFrame">{{66, -1}, {134, 23}}</string>
<reference key="NSSuperview" ref="671181514"/>
<reference key="NSWindow"/>
<string key="NSFrame">{{66, -1}, {134, 23}}</string>
<reference key="NSSuperview" ref="671181514"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:22</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="517346822">
<string key="NSReuseIdentifierKey">_NS:22</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="517346822">
@@
-1420,6
+1416,14
@@
</object>
<int key="connectionID">825</int>
</object>
</object>
<int key="connectionID">825</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">window</string>
+ <reference key="source" ref="207406104"/>
+ <reference key="destination" ref="808667431"/>
+ </object>
+ <int key="connectionID">865</int>
+ </object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">removePressed:</string>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">removePressed:</string>
@@
-2398,7
+2402,7
@@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">86
4
</int>
+ <int key="maxID">86
5
</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@
-2410,6
+2414,7
@@
<string key="inputController">NJDeviceController</string>
<string key="mappingsController">NJMappingsController</string>
<string key="outputController">NJOutputController</string>
<string key="inputController">NJDeviceController</string>
<string key="mappingsController">NJMappingsController</string>
<string key="outputController">NJOutputController</string>
+ <string key="window">NSWindow</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="dockMenuBase">
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="dockMenuBase">
@@
-2428,6
+2433,10
@@
<string key="name">outputController</string>
<string key="candidateClassName">NJOutputController</string>
</object>
<string key="name">outputController</string>
<string key="candidateClassName">NJOutputController</string>
</object>
+ <object class="IBToOneOutletInfo" key="window">
+ <string key="name">window</string>
+ <string key="candidateClassName">NSWindow</string>
+ </object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
diff --git
a/EnjoyableApplicationDelegate.h
b/EnjoyableApplicationDelegate.h
index
b77f799
..
6488135
100644
(file)
--- a/
EnjoyableApplicationDelegate.h
+++ b/
EnjoyableApplicationDelegate.h
@@
-12,6
+12,7
@@
@interface EnjoyableApplicationDelegate : NSObject <NSApplicationDelegate> {
IBOutlet NSMenu *dockMenuBase;
@interface EnjoyableApplicationDelegate : NSObject <NSApplicationDelegate> {
IBOutlet NSMenu *dockMenuBase;
+ IBOutlet NSWindow *window;
}
@property (nonatomic, strong) IBOutlet NJDeviceController *inputController;
}
@property (nonatomic, strong) IBOutlet NJDeviceController *inputController;
diff --git
a/EnjoyableApplicationDelegate.m
b/EnjoyableApplicationDelegate.m
index
388103b
..
313ba9a
100644
(file)
--- a/
EnjoyableApplicationDelegate.m
+++ b/
EnjoyableApplicationDelegate.m
@@
-15,8
+15,8
@@
@implementation EnjoyableApplicationDelegate
@implementation EnjoyableApplicationDelegate
-- (void)didSwitchApplication:(NSNotification *)not
ification
{
- NSRunningApplication *currentApp = not
ification
.userInfo[NSWorkspaceApplicationKey];
+- (void)didSwitchApplication:(NSNotification *)not
e
{
+ NSRunningApplication *currentApp = not
e
.userInfo[NSWorkspaceApplicationKey];
[self.mappingsController activateMappingForProcess:currentApp.localizedName];
}
[self.mappingsController activateMappingForProcess:currentApp.localizedName];
}
@@
-46,12
+46,18
@@
[self.mappingsController load];
}
[self.mappingsController load];
}
-- (void)applicationWillTerminate:(NSNotification *)aNotification {
- [NSUserDefaults.standardUserDefaults synchronize];
- [NSNotificationCenter.defaultCenter removeObserver:self];
+- (void)applicationDidBecomeActive:(NSNotification *)notification {
+ [window makeKeyAndOrderFront:nil];
+}
+
+- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication
+ hasVisibleWindows:(BOOL)flag {
+ [window makeKeyAndOrderFront:nil];
+ return NO;
}
- (void)eventTranslationActivated:(NSNotification *)note {
}
- (void)eventTranslationActivated:(NSNotification *)note {
+ [NSProcessInfo.processInfo disableAutomaticTermination:@"Input translation is active."];
[NSWorkspace.sharedWorkspace.notificationCenter
addObserver:self
selector:@selector(didSwitchApplication:)
[NSWorkspace.sharedWorkspace.notificationCenter
addObserver:self
selector:@selector(didSwitchApplication:)
@@
-61,6
+67,7
@@
}
- (void)eventTranslationDeactivated:(NSNotification *)note {
}
- (void)eventTranslationDeactivated:(NSNotification *)note {
+ [NSProcessInfo.processInfo enableAutomaticTermination:@"Input translation is active."];
[NSWorkspace.sharedWorkspace.notificationCenter
removeObserver:self
name:NSWorkspaceDidActivateApplicationNotification
[NSWorkspace.sharedWorkspace.notificationCenter
removeObserver:self
name:NSWorkspaceDidActivateApplicationNotification
@@
-75,10
+82,12
@@
int added = 0;
for (NJMapping *mapping in mappings) {
NSString *keyEquiv = ++added < 10 ? @(added).stringValue : @"";
int added = 0;
for (NJMapping *mapping in mappings) {
NSString *keyEquiv = ++added < 10 ? @(added).stringValue : @"";
- NSMenuItem *item = [
dockMenuBase addItem
WithTitle:mapping.name
- action:@selector(chooseMapping:)
- keyEquivalent:keyEquiv];
+ NSMenuItem *item = [
[NSMenuItem alloc] init
WithTitle:mapping.name
+
action:@selector(chooseMapping:)
+
keyEquivalent:keyEquiv];
item.representedObject = mapping;
item.representedObject = mapping;
+ item.state = mapping == self.mappingsController.currentMapping;
+ [dockMenuBase addItem:item];
}
[_outputController refreshMappings];
}
}
[_outputController refreshMappings];
}
diff --git
a/Info.plist
b/Info.plist
index
8deb6f0
..
2940aaf
100644
(file)
--- a/
Info.plist
+++ b/
Info.plist
@@
-2,6
+2,10
@@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>NSSupportsAutomaticTermination</key>
+ <string>YES</string>
+ <key>NSSupportsSuddenTermination</key>
+ <true/>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
diff --git
a/NJMappingsController.m
b/NJMappingsController.m
index
26ef35f
..
43f6282
100644
(file)
--- a/
NJMappingsController.m
+++ b/
NJMappingsController.m
@@
-281,6
+281,7
@@
if (result != NSFileHandlingPanelOKButton)
return;
[panel close];
if (result != NSFileHandlingPanelOKButton)
return;
[panel close];
+ [NSProcessInfo.processInfo disableSuddenTermination];
NSError *error;
NSDictionary *serialization = [mapping serialize];
NSData *json = [NSJSONSerialization dataWithJSONObject:serialization
NSError *error;
NSDictionary *serialization = [mapping serialize];
NSData *json = [NSJSONSerialization dataWithJSONObject:serialization
@@
-289,6
+290,7
@@
if (!error)
[json writeToURL:panel.URL options:NSDataWritingAtomic error:&error];
if (!error)
[json writeToURL:panel.URL options:NSDataWritingAtomic error:&error];
+ [NSProcessInfo.processInfo enableSuddenTermination];
if (error) {
[window presentError:error
modalForWindow:window
if (error) {
[window presentError:error
modalForWindow:window