-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GameController][Xcode12] Updates through beta 4 #9265
[GameController][Xcode12] Updates through beta 4 #9265
Conversation
src/gamecontroller.cs
Outdated
[DisableDefaultCtor] // return nil handle -> only exposed as getter | ||
partial interface GCGamepad { | ||
|
||
[NullAllowed] | ||
//[NullAllowed] This seems like it's a breaking change... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a breaking change? 🤔 It doesn't seem like it. Any code that assumes that a null may be returned will still work here - we're restricting the return value to a subset of what it used to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think changing this has any effect on our generated code (IOW it's fine).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK it is not an issue at all. It is a get and not a set, so we do not care. @whitneyschmidt on a 'set' we do check for the value and throw a NRE depending on the value, but since we only return, we are fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope not a breaking change
src/gamecontroller.cs
Outdated
[Export ("supportedLocalities", ArgumentSemantic.Strong)] | ||
NSSet<NSString> SupportedLocalities { get; } | ||
|
||
// Dependency on Xcode 12 CoreHaptics bindings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @mandel-macaque.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this guy. It is in my feedback report, thanks for the headsup :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to link to the issue here for easier record keeping? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add it here #8943
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like CoreHaptics is blocked on AVAudioSession for Mac bindings :(
src/gamecontroller.cs
Outdated
GCControllerButtonInput PaddleButton4 { get; } | ||
} | ||
|
||
[Static] // I tried moving GCKey and GCKeyCode to separate files, but ran into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way for GCKey
and GCKeyCode
to live in their own files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible, but it's somewhat of a special case.
Basically you'd have to add it like xkit.cs is added here:
xamarin-macios/src/frameworks.sources
Line 1799 in 53dcedc
AppKit XKit \ |
I don't think it's worth it to have binding code in a separate file, xkit.cs is literally the only exception, and that's only because we want the code in both UIKit and AppKit at the same time.
src/gamecontroller.cs
Outdated
[DisableDefaultCtor] // return nil handle -> only exposed as getter | ||
partial interface GCGamepad { | ||
|
||
[NullAllowed] | ||
//[NullAllowed] This seems like it's a breaking change... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think changing this has any effect on our generated code (IOW it's fine).
src/gamecontroller.cs
Outdated
GCControllerButtonInput PaddleButton4 { get; } | ||
} | ||
|
||
[Static] // I tried moving GCKey and GCKeyCode to separate files, but ran into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible, but it's somewhat of a special case.
Basically you'd have to add it like xkit.cs is added here:
xamarin-macios/src/frameworks.sources
Line 1799 in 53dcedc
AppKit XKit \ |
I don't think it's worth it to have binding code in a separate file, xkit.cs is literally the only exception, and that's only because we want the code in both UIKit and AppKit at the same time.
src/gamecontroller.cs
Outdated
[DisableDefaultCtor] // return nil handle -> only exposed as getter | ||
partial interface GCGamepad { | ||
|
||
[NullAllowed] | ||
//[NullAllowed] This seems like it's a breaking change... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK it is not an issue at all. It is a get and not a set, so we do not care. @whitneyschmidt on a 'set' we do check for the value and throw a NRE depending on the value, but since we only return, we are fine.
@@ -202,7 +226,7 @@ partial interface GCGamepadSnapshot { | |||
|
|||
[iOS (7,0)] | |||
[Mac (10,9)] | |||
[BaseType (typeof (NSObject))] | |||
[BaseType (typeof (GCPhysicalInputProfile))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this base changes are ok, but do remember that changing a base COULD be a breaking change. Not in this case since GCPhysicalInputProfile is a NSObject and it was the parent of the old class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be listed as a breaking change but there is nothing we can do about it, if a base changes we have to honor that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case technically should not be an issue. Others might: https://docs.microsoft.com/en-us/dotnet/core/compatibility/#types
REQUIRES JUDGMENT: Introducing a new base class
A type can be introduced into a hierarchy between two existing types if it doesn't introduce any new abstract members or change the semantics or behavior of existing types. For example, in .NET Framework 2.0, the DbConnection class became a new base class for SqlConnection, which had previously derived directly from Component.
src/gamecontroller.cs
Outdated
[TV (14, 0), Mac (11, 0), iOS (14, 0)] | ||
[Export ("acceleration")] | ||
GCAcceleration Acceleration { get; } | ||
|
||
[TV (14,0), Mac (11,0), iOS (14,0)] | ||
[Export ("setAcceleration:")] | ||
void SetAcceleration (GCAcceleration acceleration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method and a property? That is very weird? Acceleration and SetAcceleration do look like a perfect candidate for a property.
src/gamecontroller.cs
Outdated
[Export ("supportedLocalities", ArgumentSemantic.Strong)] | ||
NSSet<NSString> SupportedLocalities { get; } | ||
|
||
// Dependency on Xcode 12 CoreHaptics bindings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this guy. It is in my feedback report, thanks for the headsup :)
Build success |
src/gamecontroller.cs
Outdated
[TV (14, 0), Mac (11, 0), iOS (14, 0)] | ||
[Export ("acceleration")] | ||
GCAcceleration Acceleration { get; } | ||
|
||
[TV (14,0), Mac (11,0), iOS (14,0)] | ||
[Export ("setAcceleration:")] | ||
void SetAcceleration (GCAcceleration acceleration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[TV (14, 0), Mac (11, 0), iOS (14, 0)] | |
[Export ("acceleration")] | |
GCAcceleration Acceleration { get; } | |
[TV (14,0), Mac (11,0), iOS (14,0)] | |
[Export ("setAcceleration:")] | |
void SetAcceleration (GCAcceleration acceleration); | |
[TV (14, 0), Mac (11, 0), iOS (14, 0)] | |
[Export ("acceleration")] | |
GCAcceleration Acceleration { get; set; } | |
src/gamecontroller.cs
Outdated
[Export ("supportedLocalities", ArgumentSemantic.Strong)] | ||
NSSet<NSString> SupportedLocalities { get; } | ||
|
||
// Dependency on Xcode 12 CoreHaptics bindings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add it here #8943
src/gamecontroller.cs
Outdated
[Field ("GCHapticsLocalityDefault")] | ||
NSString LocalityDefault { get; } | ||
|
||
[Field ("GCHapticsLocalityAll")] | ||
NSString LocalityAll { get; } | ||
|
||
[Field ("GCHapticsLocalityHandles")] | ||
NSString LocalityHandles { get; } | ||
|
||
[Field ("GCHapticsLocalityLeftHandle")] | ||
NSString LocalityLeftHandle { get; } | ||
|
||
[Field ("GCHapticsLocalityRightHandle")] | ||
NSString LocalityRightHandle { get; } | ||
|
||
[Field ("GCHapticsLocalityTriggers")] | ||
NSString LocalityTriggers { get; } | ||
|
||
[Field ("GCHapticsLocalityLeftTrigger")] | ||
NSString LocalityLeftTrigger { get; } | ||
|
||
[Field ("GCHapticsLocalityRightTrigger")] | ||
NSString LocalityRightTrigger { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if these should be grouped on their own static class or smart enum depending on how they are used for example
[Static]
interface GCHapticsLocality {
[Field ("GCHapticsLocalityDefault")]
NSString Default { get; }
[Field ("GCHapticsLocalityAll")]
NSString All { get; }
[Field ("GCHapticsLocalityHandles")]
NSString Handles { get; }
[Field ("GCHapticsLocalityLeftHandle")]
NSString LeftHandle { get; }
[Field ("GCHapticsLocalityRightHandle")]
NSString RightHandle { get; }
[Field ("GCHapticsLocalityTriggers")]
NSString Triggers { get; }
[Field ("GCHapticsLocalityLeftTrigger")]
NSString LeftTrigger { get; }
[Field ("GCHapticsLocalityRightTrigger")]
NSString RightTrigger { get; }
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
src/gamecontroller.cs
Outdated
[Field ("GCHapticDurationInfinite")] | ||
float DurationInfinite { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we should remove the Haptic part, else I am unsure what infinite duration is it about
[Field ("GCHapticDurationInfinite")] | |
float DurationInfinite { get; } | |
[Field ("GCHapticDurationInfinite")] | |
float HapticDurationInfinite { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 😄
src/gamecontroller.cs
Outdated
[Notification, Field ("GCKeyboardDidDisconnectNotification")] | ||
NSString DisconnectNotification { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Notification, Field ("GCKeyboardDidDisconnectNotification")] | |
NSString DisconnectNotification { get; } | |
[Notification, Field ("GCKeyboardDidDisconnectNotification")] | |
NSString DidDisconnectNotification { get; } |
src/gamecontroller.cs
Outdated
[BaseType (typeof (NSObject))] | ||
[Protocol] | ||
[Model] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[BaseType (typeof (NSObject))] | |
[Protocol] | |
[Model] | |
[Protocol] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! So we can have just [Protocol]
if we remove [Model]
and [BaseType...]
! So [Model]
and [BaseType...]
always go together but [Protocol]
can be independent. Thank you @dalexsoto :)
src/gamecontroller.cs
Outdated
[TV (9, 0), Mac (10, 9), iOS (7, 0)] | ||
[Abstract] | ||
[Export ("handlerQueue", ArgumentSemantic.Strong)] | ||
DispatchQueue HandlerQueue { get; set; } | ||
|
||
[TV (9, 0), Mac (10, 9), iOS (7, 0)] | ||
[Abstract] | ||
[NullAllowed, Export ("vendorName")] | ||
string VendorName { get; } | ||
|
||
[TV (13, 0), Mac (10, 15), iOS (13, 0)] | ||
[Abstract] | ||
[Export ("productCategory")] | ||
string ProductCategory { get; } | ||
|
||
[TV (14, 0), Mac (11, 0), iOS (14, 0)] | ||
[Abstract] | ||
[Export ("physicalInputProfile", ArgumentSemantic.Strong)] | ||
GCPhysicalInputProfile PhysicalInputProfile { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The availability attributes do not make sense here, specially since the container protocol is [TV (14,0), Mac (11,0), iOS (14,0)]
so someone is lying to us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is bizarre because the availability attributes in the header match these ones...but it's impossible for that to be true. I'm thinking we should just leave the container protocol's availability attribute and remove the rest of them so that everything has [TV (14,0), Mac (11,0), iOS (14,0)]
.
src/gamecontroller.cs
Outdated
|
||
[Export ("objectForKeyedSubscript:")] | ||
[return: NullAllowed] | ||
GCControllerElement ObjectForKeyedSubscript (string key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GCControllerElement ObjectForKeyedSubscript (string key); | |
GCControllerElement GetObjectForKeyedSubscript (string key); |
NSString RightGui { get; } | ||
} | ||
|
||
[TV (14, 0), Mac (11, 0), iOS (14, 0)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation :)
Build failure Test results3 tests failed, 73 tests passed.Failed tests
|
src/gamecontroller.cs
Outdated
[Static] | ||
[TV (14, 0), Mac (11, 0), iOS (14, 0)] | ||
partial interface GCKey | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is space here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Thank you 😄
src/gamecontroller.cs
Outdated
|
||
using System; | ||
|
||
using CoreFoundation; | ||
using Foundation; | ||
using ObjCRuntime; | ||
using OpenTK; | ||
//#using CoreHaptics; // need CoreHaptics update for TV 14.0 inclusion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR with support for CoreHaptics on tvOS landed on the xcode12 branch: #9273
e230e75
to
05766d6
Compare
Build success |
// iOS 14 beta 3 (to be reviewed) | ||
case "GCDeviceBattery": | ||
case "GCDeviceLight": | ||
case "GCDualShockGamepad": | ||
case "GCKeyboard": | ||
case "GCMouse": | ||
case "GCXboxGamepad": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this and the one below filled as an issue somewhere? So we do not forget to review these in the future or you could check for a specific Xcode Version in the tests so they fail if not fixed in the future, also if you consider this to be an Apple mistake file a bug :)
src/gamecontroller.cs
Outdated
@@ -535,4 +616,1157 @@ interface GCEventViewController { | |||
[Export ("controllerUserInteractionEnabled")] | |||
bool ControllerUserInteractionEnabled { get; set; } | |||
} | |||
|
|||
[TV (14,0), Mac (11,0), iOS (14,0)] | |||
[BaseType (typeof( NSObject))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[BaseType (typeof( NSObject))] | |
[BaseType (typeof (NSObject))] |
Build success |
No description provided.