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:
51ca12b
)
Update to ARC (probably introducing some leaks, probably fixing others).
author
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 26 Feb 2013 17:28:25 +0000
(18:28 +0100)
committer
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 26 Feb 2013 17:28:25 +0000
(18:28 +0100)
14 files changed:
ApplicationController.h
patch
|
blob
|
history
ApplicationController.m
patch
|
blob
|
history
ConfigsController.h
patch
|
blob
|
history
ConfigsController.m
patch
|
blob
|
history
Enjoy.xcodeproj/project.pbxproj
patch
|
blob
|
history
JSAction.h
patch
|
blob
|
history
JSActionAnalog.m
patch
|
blob
|
history
JSActionHat.m
patch
|
blob
|
history
Joystick.m
patch
|
blob
|
history
JoystickController.h
patch
|
blob
|
history
JoystickController.m
patch
|
blob
|
history
KeyInputTextView.h
patch
|
blob
|
history
SubAction.h
patch
|
blob
|
history
TargetConfig.h
patch
|
blob
|
history
diff --git
a/ApplicationController.h
b/ApplicationController.h
index
9d1607f
..
e6e5614
100644
(file)
--- a/
ApplicationController.h
+++ b/
ApplicationController.h
@@
-24,9
+24,9
@@
}
@property(readwrite) BOOL active;
}
@property(readwrite) BOOL active;
-@property(readonly) JoystickController * jsController;
-@property(readonly) TargetController * targetController;
-@property(readonly) ConfigsController * configsController;
+@property(
strong,
readonly) JoystickController * jsController;
+@property(
strong,
readonly) TargetController * targetController;
+@property(
strong,
readonly) ConfigsController * configsController;
-(IBAction) toggleActivity: (id)sender;
-(void) configsChanged;
-(void) configChanged;
-(IBAction) toggleActivity: (id)sender;
-(void) configsChanged;
-(void) configChanged;
diff --git
a/ApplicationController.m
b/ApplicationController.m
index
4a4deea
..
2edac94
100644
(file)
--- a/
ApplicationController.m
+++ b/
ApplicationController.m
@@
-24,7
+24,7
@@
pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void
et.eventClass = kEventClassApplication;
et.eventKind = kEventAppFrontSwitched;
EventHandlerUPP handler = NewEventHandlerUPP(appSwitch);
et.eventClass = kEventClassApplication;
et.eventKind = kEventAppFrontSwitched;
EventHandlerUPP handler = NewEventHandlerUPP(appSwitch);
- InstallApplicationEventHandler(handler, 1, &et,
self
, NULL);
+ InstallApplicationEventHandler(handler, 1, &et,
(void *)CFBridgingRetain(self)
, NULL);
}
-(void) applicationWillTerminate: (NSNotification *)aNotification {
}
-(void) applicationWillTerminate: (NSNotification *)aNotification {
@@
-39,7
+39,7
@@
pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void
}
pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void* userData) {
}
pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void* userData) {
- ApplicationController* self = (ApplicationController*)userData;
+ ApplicationController* self = (
__bridge
ApplicationController*)userData;
NSDictionary* currentApp = [[NSWorkspace sharedWorkspace] activeApplication];
ProcessSerialNumber psn;
psn.lowLongOfPSN = [currentApp[@"NSApplicationProcessSerialNumberLow"] longValue];
NSDictionary* currentApp = [[NSWorkspace sharedWorkspace] activeApplication];
ProcessSerialNumber psn;
psn.lowLongOfPSN = [currentApp[@"NSApplicationProcessSerialNumberLow"] longValue];
diff --git
a/ConfigsController.h
b/ConfigsController.h
index
39f3a0d
..
7e79f15
100644
(file)
--- a/
ConfigsController.h
+++ b/
ConfigsController.h
@@
-27,8
+27,8
@@
-(NSDictionary*) dumpAll;
-(void) loadAllFrom: (NSDictionary*) dict;
-(NSDictionary*) dumpAll;
-(void) loadAllFrom: (NSDictionary*) dict;
-@property(readonly) Config* currentConfig;
-@property(readonly) Config* currentNeutralConfig;
+@property(
strong,
readonly) Config* currentConfig;
+@property(
strong,
readonly) Config* currentNeutralConfig;
@property(readonly) NSArray* configs;
@property(readonly) ProcessSerialNumber* targetApplication;
-(void) save;
@property(readonly) NSArray* configs;
@property(readonly) ProcessSerialNumber* targetApplication;
-(void) save;
diff --git
a/ConfigsController.m
b/ConfigsController.m
index
3168f8d
..
cc16b6e
100644
(file)
--- a/
ConfigsController.m
+++ b/
ConfigsController.m
@@
-139,7
+139,7
@@
[ary addObject: cfgInfo];
}
envelope[@"configurationList"] = ary;
[ary addObject: cfgInfo];
}
envelope[@"configurationList"] = ary;
- envelope[@"selectedIndex"] =
[NSNumber numberWithInt: [configs indexOfObject: [self currentNeutralConfig] ] ]
;
+ envelope[@"selectedIndex"] =
@([configs indexOfObject: [self currentNeutralConfig] ])
;
return envelope;
}
-(void) loadAllFrom: (NSDictionary*) envelope{
return envelope;
}
-(void) loadAllFrom: (NSDictionary*) envelope{
diff --git
a/Enjoy.xcodeproj/project.pbxproj
b/Enjoy.xcodeproj/project.pbxproj
index
9fbdbb6
..
12361dc
100644
(file)
--- a/
Enjoy.xcodeproj/project.pbxproj
+++ b/
Enjoy.xcodeproj/project.pbxproj
@@
-337,6
+337,7
@@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
@@
-360,6
+361,7
@@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
diff --git
a/JSAction.h
b/JSAction.h
index
50e37e2
..
1e60cf2
100644
(file)
--- a/
JSAction.h
+++ b/
JSAction.h
@@
-12,17
+12,17
@@
@interface JSAction : NSObject {
int usage, index;
void* cookie;
@interface JSAction : NSObject {
int usage, index;
void* cookie;
- NSArray
*
subActions;
+ NSArray
*
subActions;
id base;
id base;
- NSString
*
name;
+ NSString
*
name;
}
@property(readwrite) int usage;
@property(readwrite) void* cookie;
@property(readonly) int index;
}
@property(readwrite) int usage;
@property(readwrite) void* cookie;
@property(readonly) int index;
-@property(
readonl
y) NSArray* subActions;
-@property(readwrite,
retain
) id base;
-@property(
readonl
y) NSString* name;
+@property(
cop
y) NSArray* subActions;
+@property(readwrite,
strong
) id base;
+@property(
cop
y) NSString* name;
@property(readonly) BOOL active;
-(void) notifyEvent: (IOHIDValueRef) value;
@property(readonly) BOOL active;
-(void) notifyEvent: (IOHIDValueRef) value;
diff --git
a/JSActionAnalog.m
b/JSActionAnalog.m
index
2931464
..
027bd5d
100644
(file)
--- a/
JSActionAnalog.m
+++ b/
JSActionAnalog.m
@@
-12,7
+12,6
@@
subActions = @[[[SubAction alloc] initWithIndex: 0 name: @"Low" base: self],
[[SubAction alloc] initWithIndex: 1 name: @"High" base: self],
[[SubAction alloc] initWithIndex: 2 name: @"Analog" base: self]];
subActions = @[[[SubAction alloc] initWithIndex: 0 name: @"Low" base: self],
[[SubAction alloc] initWithIndex: 1 name: @"High" base: self],
[[SubAction alloc] initWithIndex: 2 name: @"Analog" base: self]];
- [subActions retain];
index = newIndex;
name = [[NSString alloc] initWithFormat: @"Axis %d", (index+1)];
}
index = newIndex;
name = [[NSString alloc] initWithFormat: @"Axis %d", (index+1)];
}
diff --git
a/JSActionHat.m
b/JSActionHat.m
index
61241b9
..
13abcda
100644
(file)
--- a/
JSActionHat.m
+++ b/
JSActionHat.m
@@
-32,7
+32,6
@@
NO, NO, YES, NO , // W
[[SubAction alloc] initWithIndex: 1 name: @"Down" base: self],
[[SubAction alloc] initWithIndex: 2 name: @"Left" base: self],
[[SubAction alloc] initWithIndex: 3 name: @"Right" base: self]];
[[SubAction alloc] initWithIndex: 1 name: @"Down" base: self],
[[SubAction alloc] initWithIndex: 2 name: @"Left" base: self],
[[SubAction alloc] initWithIndex: 3 name: @"Right" base: self]];
- [subActions retain];
name = @"Hat switch";
}
return self;
name = @"Hat switch";
}
return self;
diff --git
a/Joystick.m
b/Joystick.m
index
fd08ee6
..
d6c4362
100644
(file)
--- a/
Joystick.m
+++ b/
Joystick.m
@@
-15,9
+15,9
@@
children = [[NSMutableArray alloc]init];
device = newDevice;
children = [[NSMutableArray alloc]init];
device = newDevice;
- productName = (NSString*)IOHIDDeviceGetProperty( device, CFSTR(kIOHIDProductKey) );
- vendorId = [(NSNumber*)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) intValue];
- productId = [(NSNumber*)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) intValue];
+ productName = (
__bridge
NSString*)IOHIDDeviceGetProperty( device, CFSTR(kIOHIDProductKey) );
+ vendorId = [(
__bridge
NSNumber*)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) intValue];
+ productId = [(
__bridge
NSNumber*)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) intValue];
name = productName;
}
name = productName;
}
@@
-42,13
+42,13
@@
}
-(void) populateActions {
}
-(void) populateActions {
- NSArray* elements = (NSArray*)
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone
);
+ NSArray* elements = (NSArray*)
CFBridgingRelease(IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone)
);
int buttons = 0;
int axes = 0;
for(int i=0; i<[elements count]; i++) {
int buttons = 0;
int axes = 0;
for(int i=0; i<[elements count]; i++) {
- IOHIDElementRef element = (IOHIDElementRef)elements[i];
+ IOHIDElementRef element = (
__bridge
IOHIDElementRef)elements[i];
int type = IOHIDElementGetType(element);
int usage = IOHIDElementGetUsage(element);
int usagePage = IOHIDElementGetUsagePage(element);
int type = IOHIDElementGetType(element);
int usage = IOHIDElementGetUsage(element);
int usagePage = IOHIDElementGetUsagePage(element);
@@
-70,7
+70,7
@@
}
if((max - min == 1) || usagePage == kHIDPage_Button || type == kIOHIDElementTypeInput_Button) {
}
if((max - min == 1) || usagePage == kHIDPage_Button || type == kIOHIDElementTypeInput_Button) {
- action = [[JSActionButton alloc] initWithIndex: buttons++ andName: (NSString *)elName];
+ action = [[JSActionButton alloc] initWithIndex: buttons++ andName: (
__bridge
NSString *)elName];
[(JSActionButton*)action setMax: max];
} else if(usage == 0x39)
action = [[JSActionHat alloc] init];
[(JSActionButton*)action setMax: max];
} else if(usage == 0x39)
action = [[JSActionHat alloc] init];
diff --git
a/JoystickController.h
b/JoystickController.h
index
aa95815
..
f0530dc
100644
(file)
--- a/
JoystickController.h
+++ b/
JoystickController.h
@@
-31,7
+31,7
@@
-(void) setup;
-(Joystick*) findJoystickByRef: (IOHIDDeviceRef) device;
-(void) setup;
-(Joystick*) findJoystickByRef: (IOHIDDeviceRef) device;
-@property(readonly) id selectedAction;
+@property(
strong,
readonly) id selectedAction;
@property(readonly) NSMutableArray *joysticks;
@property(readonly) NSMutableArray *runningTargets;
@property(readwrite) BOOL frontWindowOnly;
@property(readonly) NSMutableArray *joysticks;
@property(readonly) NSMutableArray *runningTargets;
@property(readwrite) BOOL frontWindowOnly;
diff --git
a/JoystickController.m
b/JoystickController.m
index
6b748df
..
5056b0e
100644
(file)
--- a/
JoystickController.m
+++ b/
JoystickController.m
@@
-21,20
+21,19
@@
return self;
}
return self;
}
--(void)
finalize
{
+-(void)
dealloc
{
for(int i=0; i<[joysticks count]; i++) {
[joysticks[i] invalidate];
}
IOHIDManagerClose(hidManager, kIOHIDOptionsTypeNone);
CFRelease(hidManager);
for(int i=0; i<[joysticks count]; i++) {
[joysticks[i] invalidate];
}
IOHIDManagerClose(hidManager, kIOHIDOptionsTypeNone);
CFRelease(hidManager);
- [super finalize];
}
static NSMutableDictionary* create_criterion( UInt32 inUsagePage, UInt32 inUsage )
{
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
}
static NSMutableDictionary* create_criterion( UInt32 inUsagePage, UInt32 inUsage )
{
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
- dict[(NSString*)CFSTR(kIOHIDDeviceUsagePageKey)] =
[NSNumber numberWithInt: inUsagePage]
;
- dict[(NSString*)CFSTR(kIOHIDDeviceUsageKey)] =
[NSNumber numberWithInt: inUsage]
;
+ dict[(NSString*)CFSTR(kIOHIDDeviceUsagePageKey)] =
@(inUsagePage)
;
+ dict[(NSString*)CFSTR(kIOHIDDeviceUsageKey)] =
@(inUsage)
;
return dict;
}
return dict;
}
@@
-53,7
+52,7
@@
BOOL objInArray(NSMutableArray *array, id object) {
}
void timer_callback(CFRunLoopTimerRef timer, void *ctx) {
}
void timer_callback(CFRunLoopTimerRef timer, void *ctx) {
- JoystickController *jc = (JoystickController *)ctx;
+ JoystickController *jc = (
__bridge
JoystickController *)ctx;
jc->mouseLoc = [NSEvent mouseLocation];
for (Target *target in [jc runningTargets]) {
[target update: jc];
jc->mouseLoc = [NSEvent mouseLocation];
for (Target *target in [jc runningTargets]) {
[target update: jc];
@@
-61,7
+60,7
@@
void timer_callback(CFRunLoopTimerRef timer, void *ctx) {
}
void input_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDValueRef value) {
}
void input_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDValueRef value) {
- JoystickController* self = (JoystickController*)inContext;
+ JoystickController* self = (
__bridge
JoystickController*)inContext;
IOHIDDeviceRef device = IOHIDQueueGetDevice((IOHIDQueueRef) inSender);
Joystick* js = [self findJoystickByRef: device];
IOHIDDeviceRef device = IOHIDQueueGetDevice((IOHIDQueueRef) inSender);
Joystick* js = [self findJoystickByRef: device];
@@
-133,10
+132,10
@@
int findAvailableIndex(id list, Joystick* js) {
}
void add_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef device) {
}
void add_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef device) {
- JoystickController* self = (JoystickController*)inContext;
+ JoystickController* self = (
__bridge
JoystickController*)inContext;
IOHIDDeviceOpen(device, kIOHIDOptionsTypeNone);
IOHIDDeviceOpen(device, kIOHIDOptionsTypeNone);
- IOHIDDeviceRegisterInputValueCallback(device, input_callback, (void*)
self
);
+ IOHIDDeviceRegisterInputValueCallback(device, input_callback, (void*)
CFBridgingRetain(self)
);
Joystick *js = [[Joystick alloc] initWithDevice: device];
[js setIndex: findAvailableIndex([self joysticks], js)];
Joystick *js = [[Joystick alloc] initWithDevice: device];
[js setIndex: findAvailableIndex([self joysticks], js)];
@@
-155,7
+154,7
@@
void add_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDevic
}
void remove_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef device) {
}
void remove_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef device) {
- JoystickController* self =
(JoystickController*)inContext
;
+ JoystickController* self =
CFBridgingRelease(inContext)
;
Joystick* match = [self findJoystickByRef: device];
if(!match)
Joystick* match = [self findJoystickByRef: device];
if(!match)
@@
-173,14
+172,14
@@
void remove_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDe
create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad),
create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController)];
create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad),
create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController)];
- IOHIDManagerSetDeviceMatchingMultiple(hidManager, (CFArrayRef)
criteria
);
+ IOHIDManagerSetDeviceMatchingMultiple(hidManager, (CFArrayRef)
CFBridgingRetain(criteria)
);
IOHIDManagerScheduleWithRunLoop( hidManager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode );
IOReturn tIOReturn = IOHIDManagerOpen( hidManager, kIOHIDOptionsTypeNone );
(void)tIOReturn;
IOHIDManagerScheduleWithRunLoop( hidManager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode );
IOReturn tIOReturn = IOHIDManagerOpen( hidManager, kIOHIDOptionsTypeNone );
(void)tIOReturn;
- IOHIDManagerRegisterDeviceMatchingCallback( hidManager, add_callback, (void*)self );
- IOHIDManagerRegisterDeviceRemovalCallback(hidManager, remove_callback, (void*) self);
+ IOHIDManagerRegisterDeviceMatchingCallback( hidManager, add_callback, (
__bridge
void*)self );
+ IOHIDManagerRegisterDeviceRemovalCallback(hidManager, remove_callback, (
__bridge
void*) self);
// IOHIDManagerRegisterInputValueCallback(hidManager, input_callback, (void*)self);
// register individually so we can find the device more easily
// IOHIDManagerRegisterInputValueCallback(hidManager, input_callback, (void*)self);
// register individually so we can find the device more easily
@@
-188,7
+187,7
@@
void remove_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDe
// Setup timer for continuous targets
CFRunLoopTimerContext ctx = {
// Setup timer for continuous targets
CFRunLoopTimerContext ctx = {
- 0, (void*)self, NULL, NULL, NULL
+ 0, (
__bridge
void*)self, NULL, NULL, NULL
};
CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault,
CFAbsoluteTimeGetCurrent(), 1.0/80.0,
};
CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault,
CFAbsoluteTimeGetCurrent(), 1.0/80.0,
diff --git
a/KeyInputTextView.h
b/KeyInputTextView.h
index
69d8f10
..
e327c78
100644
(file)
--- a/
KeyInputTextView.h
+++ b/
KeyInputTextView.h
@@
-20,7
+20,7
@@
@property(readonly) BOOL hasKey;
@property(readwrite) int vk;
@property(readonly) BOOL hasKey;
@property(readwrite) int vk;
-@property(
readonl
y) NSString* descr;
+@property(
cop
y) NSString* descr;
@property(readwrite) BOOL enabled;
-(void) clear;
@property(readwrite) BOOL enabled;
-(void) clear;
diff --git
a/SubAction.h
b/SubAction.h
index
48969ca
..
d09fa3a
100644
(file)
--- a/
SubAction.h
+++ b/
SubAction.h
@@
-18,7
+18,7
@@
-(id) initWithIndex:(int)newIndex name: (NSString*)newName base: (JSAction*)newBase;
-(id) initWithIndex:(int)newIndex name: (NSString*)newName base: (JSAction*)newBase;
-@property(readwrite,
assign
) JSAction* base;
+@property(readwrite,
strong
) JSAction* base;
@property(readwrite, copy) NSString* name;
@property(readwrite) int index;
@property(readwrite) BOOL active;
@property(readwrite, copy) NSString* name;
@property(readwrite) int index;
@property(readwrite) BOOL active;
diff --git
a/TargetConfig.h
b/TargetConfig.h
index
0f164b9
..
b08e31b
100644
(file)
--- a/
TargetConfig.h
+++ b/
TargetConfig.h
@@
-14,7
+14,7
@@
Config *config;
}
Config *config;
}
-@property(readwrite,
retain
) Config* config;
+@property(readwrite,
strong
) Config* config;
+(TargetConfig*) unstringifyImpl: (NSArray*) comps withConfigList: (NSArray*) configs;
@end
+(TargetConfig*) unstringifyImpl: (NSArray*) comps withConfigList: (NSArray*) configs;
@end