summaryrefslogtreecommitdiff
path: root/macosx/plugins/DFInput/macsrc/PadController.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-22 23:53:37 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-08-22 23:53:37 +0000
commit531ad373b2c22e00a341a6635023cf8949571bd5 (patch)
tree029961f0aa19ec396f6d7cc09f3ff93987c9aa62 /macosx/plugins/DFInput/macsrc/PadController.m
parent9628a367530657e7fefb17be0a125dbe3f5d7614 (diff)
Moving most of the OS X preferences to auto layout, and all to 10.7.
Changing some lists of independent checkbox buttons to matrices. Fix a discrepancy between SDL versions 1.2 and 2.0 APIs in OS X's input preferences. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86849 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFInput/macsrc/PadController.m')
-rwxr-xr-xmacosx/plugins/DFInput/macsrc/PadController.m51
1 files changed, 38 insertions, 13 deletions
diff --git a/macosx/plugins/DFInput/macsrc/PadController.m b/macosx/plugins/DFInput/macsrc/PadController.m
index e3942158..1a4997c6 100755
--- a/macosx/plugins/DFInput/macsrc/PadController.m
+++ b/macosx/plugins/DFInput/macsrc/PadController.m
@@ -24,12 +24,22 @@
#include "pad.h"
#import "ARCBridge.h"
+static inline void RunOnMainThreadSync(dispatch_block_t block)
+{
+ if ([NSThread isMainThread]) {
+ block();
+ } else {
+ dispatch_sync(dispatch_get_main_queue(), block);
+ }
+}
+
static NSWindow *padWindow = nil;
static PadController *padController = nil;
#define APP_ID @"net.pcsxr.DFInputPlugin"
-void DoAbout() {
+void DoAbout()
+{
// Get parent application instance
NSApplication *app = [NSApplication sharedApplication];
NSBundle *bundle = [NSBundle bundleWithIdentifier:APP_ID];
@@ -65,19 +75,26 @@ void DoAbout() {
RELEASEOBJ(infoPaneDict);
}
-long DoConfiguration() {
- SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE);
- LoadPADConfig();
-
- if (padWindow == nil) {
- if (padController == nil) {
- padController = [[PadController alloc] initWithWindowNibName:@"NetPcsxrHIDInputPluginMain"];
+long DoConfiguration()
+{
+ RunOnMainThreadSync(^{
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ SDL_InitSubSystem(SDL_INIT_JOYSTICK);
+#else
+ SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE);
+#endif
+ LoadPADConfig();
+
+ if (padWindow == nil) {
+ if (padController == nil) {
+ padController = [[PadController alloc] initWithWindowNibName:@"NetPcsxrHIDInputPluginMain"];
+ }
+ padWindow = [padController window];
}
- padWindow = [padController window];
- }
-
- [padWindow center];
- [padWindow makeKeyAndOrderFront:nil];
+
+ [padWindow center];
+ [padWindow makeKeyAndOrderFront:nil];
+ });
return 0;
}
@@ -86,14 +103,22 @@ long DoConfiguration() {
- (IBAction)cancel:(id)sender
{
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+#else
SDL_Quit();
+#endif
[self close];
}
- (IBAction)ok:(id)sender
{
SavePADConfig();
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+#else
SDL_Quit();
+#endif
[self close];
}