From b3c099a3146fe08b1f19fbe99fe599d68eb44a72 Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Wed, 8 Oct 2014 16:32:55 +0000 Subject: OS X: DFInput fixes: Set the window delegate from the nib, instead of relying on setting the notifications by NSNotificationCenter. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@91801 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/plugins/DFInput/macsrc/PadController.h | 2 +- macosx/plugins/DFInput/macsrc/PadController.m | 33 +++++++++++++-------------- 2 files changed, 17 insertions(+), 18 deletions(-) (limited to 'macosx/plugins/DFInput/macsrc') diff --git a/macosx/plugins/DFInput/macsrc/PadController.h b/macosx/plugins/DFInput/macsrc/PadController.h index bc99f82a..4e56a206 100755 --- a/macosx/plugins/DFInput/macsrc/PadController.h +++ b/macosx/plugins/DFInput/macsrc/PadController.h @@ -24,7 +24,7 @@ #import #import "PadView.h" -@interface PadController : NSWindowController +@interface PadController : NSWindowController { IBOutlet PadView *controllerView; IBOutlet id controllerView1; diff --git a/macosx/plugins/DFInput/macsrc/PadController.m b/macosx/plugins/DFInput/macsrc/PadController.m index fbc03619..07030c4c 100755 --- a/macosx/plugins/DFInput/macsrc/PadController.m +++ b/macosx/plugins/DFInput/macsrc/PadController.m @@ -136,7 +136,7 @@ void LoadPADConfig() SetDefaultConfig(); BOOL tryToLoadOld = YES; //Do we have the new settings? - //This is placed here so we don't have the prefskey defined. + //This is placed here so we don't have the PrefsKey defined. NSUserDefaults *usrDefaults = [NSUserDefaults standardUserDefaults]; if ([usrDefaults objectForKey:PrefsKey]) { //Yes we do, don't load the old. @@ -157,6 +157,8 @@ void LoadPADConfig() FILE *fp = fopen([oldPrefPath fileSystemRepresentation], "r"); if (fp == NULL) { + //Delete the old preferences + [fm removeItemAtPath:oldPrefPath error:NULL]; return; } @@ -328,8 +330,8 @@ void SavePADConfig() [pad2Dict addEntriesFromDictionary:SavePadArray(1)]; [defaults setObject:@{kDFThreading: g.cfg.Threaded ? @YES : @NO, - kDFPad1: pad1Dict, - kDFPad2: pad2Dict} forKey:PrefsKey]; + kDFPad1: pad1Dict, + kDFPad2: pad2Dict} forKey:PrefsKey]; [defaults synchronize]; } @@ -416,10 +418,6 @@ long DoConfiguration() - (void)awakeFromNib { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowWillClose:) - name:NSWindowWillCloseNotification object:[self window]]; - [controllerView1 addSubview: controllerView]; [controllerView setController:0]; } @@ -442,21 +440,22 @@ long DoConfiguration() - (void)windowBecameKey:(NSNotification *)notification { - if ([[controllerView1 subviews] count] > 0) - [controllerView setController:0]; - else if ([[controllerView2 subviews] count] > 0) - [controllerView setController:1]; - - [[NSNotificationCenter defaultCenter] removeObserver:self - name:NSWindowDidBecomeKeyNotification object:[self window]]; + if ([notification object] == [self window]) { + if ([[controllerView1 subviews] count] > 0) + [controllerView setController:0]; + else if ([[controllerView2 subviews] count] > 0) + [controllerView setController:1]; + } } - (void)windowWillClose:(NSNotification *)aNotification { if ([aNotification object] == [self window]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowBecameKey:) - name:NSWindowDidBecomeKeyNotification object:[self window]]; +#if SDL_VERSION_ATLEAST(2, 0, 0) + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); +#else + SDL_Quit(); +#endif } } -- cgit v1.2.3