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
This commit is contained in:
parent
0abe31f640
commit
b3c099a314
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6246" systemVersion="13F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6249" systemVersion="14A386b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6246"/>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6249"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NetPcsxrHIDInputPluginPadController">
|
||||
|
@ -14,10 +15,10 @@
|
|||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window title="Input Configuration" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Configuration">
|
||||
<windowStyleMask key="styleMask" titled="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<window title="Input Configuration" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" visibleAtLaunch="NO" animationBehavior="documentWindow" id="5" userLabel="Configuration">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="NO"/>
|
||||
<rect key="contentRect" x="87" y="281" width="469" height="474"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1058"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
|
||||
<view key="contentView" id="6">
|
||||
<rect key="frame" x="0.0" y="0.0" width="469" height="474"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
|
@ -76,7 +77,7 @@
|
|||
</connections>
|
||||
</tabView>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="256">
|
||||
<rect key="frame" x="373" y="13" width="82" height="32"/>
|
||||
<rect key="frame" x="372" y="13" width="83" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="257">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
|
@ -89,7 +90,7 @@ DQ
|
|||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="261">
|
||||
<rect key="frame" x="291" y="13" width="82" height="32"/>
|
||||
<rect key="frame" x="289" y="13" width="83" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="262">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
|
@ -114,13 +115,16 @@ Gw
|
|||
<constraint firstItem="256" firstAttribute="width" secondItem="261" secondAttribute="width" id="vHo-ek-FKR"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="zUT-BE-qbs"/>
|
||||
</connections>
|
||||
</window>
|
||||
<customView id="16" userLabel="Controller View" customClass="NetPcsxrHIDInputPluginPadView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="423" height="371"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="194">
|
||||
<rect key="frame" x="18" y="335" width="43" height="14"/>
|
||||
<rect key="frame" x="18" y="335" width="44" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Device:" id="208">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
|
@ -128,9 +132,9 @@ Gw
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<popUpButton verticalHuggingPriority="750" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="189">
|
||||
<rect key="frame" x="64" y="330" width="195" height="22"/>
|
||||
<rect key="frame" x="65" y="330" width="191" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="189" id="4yb-mx-WCf"/>
|
||||
<constraint firstAttribute="width" constant="185" id="4yb-mx-WCf"/>
|
||||
</constraints>
|
||||
<popUpButtonCell key="cell" type="push" title="(Keyboard only)" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="192" id="207">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
|
@ -146,7 +150,7 @@ Gw
|
|||
</connections>
|
||||
</popUpButton>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="185">
|
||||
<rect key="frame" x="62" y="42" width="299" height="14"/>
|
||||
<rect key="frame" x="61" y="42" width="301" height="14"/>
|
||||
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="To reset an entry: Select it and press the delete '←' key" id="206">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" white="0.25" alpha="1" colorSpace="calibratedWhite"/>
|
||||
|
@ -154,7 +158,7 @@ Gw
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="132">
|
||||
<rect key="frame" x="262" y="335" width="36" height="14"/>
|
||||
<rect key="frame" x="259" y="335" width="39" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Type:" id="205">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
|
@ -235,7 +239,7 @@ Gw
|
|||
<rect key="frame" x="-100" y="-100" width="375" height="15"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" verticalHuggingPriority="750" horizontal="NO" id="210">
|
||||
<scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="210">
|
||||
<rect key="frame" x="367" y="17" width="15" height="243"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
|
@ -245,7 +249,7 @@ Gw
|
|||
</tableHeaderView>
|
||||
</scrollView>
|
||||
<button toolTip="Uses the SDL2 Game Controller API to automatically map buttons" translatesAutoresizingMaskIntoConstraints="NO" id="e1h-QZ-6Ge">
|
||||
<rect key="frame" x="18" y="18" width="176" height="18"/>
|
||||
<rect key="frame" x="18" y="18" width="177" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Use Game Controller API" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="XyD-IN-gbq">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
|
@ -280,6 +284,7 @@ Gw
|
|||
<outlet property="typeMenu" destination="126" id="134"/>
|
||||
<outlet property="useSDL2Check" destination="e1h-QZ-6Ge" id="R4k-Le-dph"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="303.5" y="902.5"/>
|
||||
</customView>
|
||||
</objects>
|
||||
</document>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "PadView.h"
|
||||
|
||||
@interface PadController : NSWindowController
|
||||
@interface PadController : NSWindowController <NSWindowDelegate>
|
||||
{
|
||||
IBOutlet PadView *controllerView;
|
||||
IBOutlet id controllerView1;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue